/* =========================================================================
   Keron — base stylesheet
   Structure, typography and components. Every color goes through a custom
   property defined in light.css / dark.css, so this file is theme-agnostic
   and a new component only ever has to be written once.
   ========================================================================= */

/* ---------- Reset ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Clears the sticky header when jumping to an anchor */
  scroll-padding-top: 5.5rem;
}

body,
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul[class], ol[class] { list-style: none; padding: 0; }

img, svg { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

table { border-collapse: collapse; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Type scale & tokens ---------- */

:root {
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --page-max: 74rem;

  --step-eyebrow: 0.75rem;
  --step-small:   0.875rem;
  --step-body:    1.0625rem;
  --step-lead:    clamp(1.125rem, 0.4vw + 1.05rem, 1.3125rem);
  --step-h3:      clamp(1.125rem, 0.5vw + 1rem, 1.3125rem);
  --step-h2:      clamp(1.5rem, 1.4vw + 1.15rem, 2.125rem);
  --step-h1:      clamp(2.25rem, 4.6vw + 1rem, 4.25rem);
}

/* ---------- Base elements ---------- */

body {
  font-family: var(--font-sans);
  font-size: var(--step-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Nothing on any page may push the viewport sideways */
  overflow-x: hidden;
}

::selection { background: var(--selection); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.14;
  text-wrap: balance;
}

h1 { font-size: var(--step-h1); letter-spacing: -0.03em; }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); line-height: 1.3; }

p { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 3px;
}

code, kbd, samp, pre { font-family: var(--font-mono); }

code {
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-rule);
  border-radius: 5px;
  padding: 0.12em 0.38em;
  word-break: break-word;
}

pre {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-rule);
  border-radius: 10px;
  font-size: var(--step-small);
  line-height: 1.6;
  overflow-x: auto;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

kbd {
  font-size: 0.8em;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.4em;
  white-space: nowrap;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* ---------- Layout primitives ---------- */

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: var(--measure); }

.prose p + p,
.prose p + ul,
.prose ul + p { margin-top: 1rem; }

.prose ul {
  margin: 1rem 0;
  padding-left: 1.1rem;
  list-style: none;
}

.prose li { position: relative; padding-left: 0.9rem; }
.prose li + li { margin-top: 0.5rem; }

.prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--rule-strong);
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus { top: 0.5rem; }

/* ---------- Mono utility text ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.9rem;
}

.eyebrow--accent { color: var(--accent); }

.mono { font-family: var(--font-mono); font-size: var(--step-small); }

.dim { color: var(--text-dim); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.brand__mark { width: 30px; height: 30px; border-radius: 7px; }

.nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-family: var(--font-mono);
  font-size: var(--step-small);
}

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
}

.nav a:hover { color: var(--text); border-bottom-color: var(--rule-strong); }

.nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- Theme switch ---------- */

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--surface-sunk);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.theme-switch__btn {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0.3rem 0.62rem;
  border-radius: 999px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.theme-switch__btn:hover { color: var(--text); }

.theme-switch__btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* No JS: the switch can't do anything, so don't advertise it. */
.no-js .theme-switch { display: none; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step-small);
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 0.75rem 1.35rem;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  text-decoration: none;
}

.btn--primary:hover { background: var(--btn-bg-hover); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--rule-strong);
  text-decoration: none;
}

.btn--ghost:hover { border-color: var(--text-faint); background: var(--surface); }

.btn--lg { padding: 0.95rem 1.75rem; font-size: 1rem; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid var(--rule);
}

.section--flush { border-top: 0; }

.section--alt { background: var(--bg-alt); }

.section__head { max-width: var(--measure); margin-bottom: 2.5rem; }

.section__head p { color: var(--text-dim); margin-top: 0.85rem; }

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3rem, 6vw, 5rem);
}

.hero__grid {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 62rem) {
  .hero__grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); }
}

.hero h1 { margin-bottom: 1.25rem; }

.hero__lead {
  font-size: var(--step-lead);
  color: var(--text-dim);
  max-width: 34rem;
  margin-bottom: 2rem;
}

.hero__meta {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  color: var(--text-faint);
  margin-top: 1.5rem;
  letter-spacing: 0.04em;
}

/* The desktop hero mockup (menu bar, wallpaper, dock, cycling notification
   presets) lives in its own stylesheet — see hero.css — since it's a large,
   self-contained visual block rendered by DesktopHero.astro. */

/* ---------- Numbered feature entries ---------- */

.entry {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 5vw, 3.75rem);
  border-top: 1px solid var(--rule);
  align-items: start;
}

.entry:first-of-type { border-top: 0; padding-top: 0; }

@media (min-width: 56rem) {
  .entry { grid-template-columns: 4rem minmax(0, 1fr) minmax(0, 0.85fr); }
}

.entry__num {
  font-family: var(--font-mono);
  font-size: var(--step-small);
  color: var(--accent);
  padding-top: 0.35rem;
  letter-spacing: 0.06em;
}

.entry__body h3 { margin-bottom: 0.75rem; }
.entry__body p { color: var(--text-dim); }

.entry__figure {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.entry__figure svg { width: 100%; height: auto; }

/* Tag list of concrete capabilities under each entry */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.15rem;
  padding: 0;
  list-style: none;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--surface-sunk);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.22rem 0.5rem;
}

/* ---------- Spec / data tables ---------- */

.table-scroll { overflow-x: auto; }

.spec {
  width: 100%;
  font-size: var(--step-small);
  text-align: left;
  min-width: 30rem;
}

.spec th,
.spec td {
  padding: 0.85rem 1rem 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.spec th {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--step-eyebrow);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  width: 14rem;
}

.spec td { color: var(--text); }

.spec tr:last-child th,
.spec tr:last-child td { border-bottom: 0; }

/* ---------- Callout ---------- */

.callout {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  padding: 1.15rem 1.35rem;
  margin: 1.75rem 0;
}

.callout--warn { border-left-color: var(--signal); }

.callout p { font-size: var(--step-small); color: var(--text-dim); }
.callout p + p { margin-top: 0.6rem; }

.callout strong { color: var(--text); }

/* ---------- Numbered how-to steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  counter-reset: step;
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 2rem 3.25rem;
  border-left: 1px solid var(--rule);
  margin-left: 1rem;
}

.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }

.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: -0.1rem;
  transform: translateX(-50%);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
}

.steps h3 { margin-bottom: 0.5rem; }
.steps p { color: var(--text-dim); font-size: var(--step-small); }
.steps p + p { margin-top: 0.6rem; }

/* ---------- FAQ disclosures ---------- */

.faq { border-top: 1px solid var(--rule); }

.faq details { border-bottom: 1px solid var(--rule); }

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.15rem 2.5rem 1.15rem 0;
  position: relative;
  font-family: var(--font-display);
  font-size: var(--step-h3);
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--text-faint);
  transition: transform 0.2s ease, color 0.2s ease;
}

.faq details[open] summary::after {
  content: "\2212"; /* minus */
  color: var(--accent);
}

.faq summary:hover { color: var(--accent); }

.faq__answer { padding: 0 0 1.5rem; max-width: var(--measure); }
.faq__answer p { color: var(--text-dim); font-size: var(--step-small); }
.faq__answer p + p,
.faq__answer p + pre,
.faq__answer pre + p,
.faq__answer p + ul { margin-top: 0.85rem; }
.faq__answer ul { font-size: var(--step-small); color: var(--text-dim); }

/* ---------- Privacy strip ---------- */

.strip {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--bg-alt);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
}

.strip__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  align-items: center;
  justify-content: space-between;
}

.strip h2 { font-size: var(--step-h3); }
.strip p { color: var(--text-dim); font-size: var(--step-small); margin-top: 0.5rem; max-width: 46ch; }

/* ---------- Card grid ---------- */

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  list-style: none;
  padding: 0;
}

.card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  padding: 1.35rem;
}

.card h3 { font-size: 1.0625rem; margin-bottom: 0.5rem; }
.card p { font-size: var(--step-small); color: var(--text-dim); }

/* ---------- Page masthead (interior pages) ---------- */

.masthead { padding-block: clamp(3rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem); }
.masthead h1 { max-width: 18ch; }
.masthead p {
  font-size: var(--step-lead);
  color: var(--text-dim);
  max-width: var(--measure);
  margin-top: 1.15rem;
}

.masthead__meta {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  color: var(--text-faint);
  margin-top: 1.5rem;
  letter-spacing: 0.04em;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 3rem 3.5rem;
  font-size: var(--step-small);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--font-mono);
}

.site-footer nav a { color: var(--text-dim); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); text-decoration: underline; }

.site-footer__legal {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.site-footer__legal p + p { margin-top: 0.4rem; }

/* ---------- Small-screen header ---------- */

@media (max-width: 46rem) {
  .site-header__inner { padding-block: 0.75rem; }
  .brand { margin-right: 0; width: 100%; }
  .nav { gap: 1rem; margin-right: auto; }
  .nav a { font-size: 0.8125rem; }
}
