/* laderchi.com — site-wide styles for the public homepage.
 *
 * Deliberately small and token-driven: everything visual is a custom property
 * in :root, so a design pass can be done by editing this block alone. This is
 * NOT the Granola design system (docs/granola/design-system/) — that one is
 * scoped to the Granola app, and the personal site keeps its own identity so
 * the two can evolve independently.
 *
 * Cache-busted via ?v=… on the href in index.html — bump it when editing. */

/* Light / dark.
 *
 * The default is the operating system's preference, and the public pages leave
 * it at that. `/me` adds a Settings control that can pin a mode, and does it by
 * stamping `data-mode="light"|"dark"` on <html> before first paint — so the
 * three rules below are, in order: the OS preference unless something has
 * pinned light; an explicit dark; an explicit light (already the base tokens,
 * but `color-scheme` still has to be told, or the browser paints form controls
 * and scrollbars dark under a light page).
 *
 * The dark tokens are written twice rather than being reached through a second
 * layer of custom properties. A `--dark-paper`-style indirection would remove
 * the duplication and cost every colour on the site an extra variable hop to
 * read; ten repeated lines in one place is the cheaper of the two. */
:root {
  color-scheme: light dark;

  /* Palette — monochrome ink on warm paper, one accent used sparingly. */
  --paper:      #fbfaf8;
  --paper-2:    #f3f1ed;
  --ink:        #14161a;
  --ink-muted:  #5e6673;
  --ink-faint:  #8d94a1;
  --rule:       #e5e2dc;
  --accent:     #d9502f;
  --accent-ink: #ffffff;

  /* Type */
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter,
               Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.83rem, 0.80rem + 0.14vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.20vw, 1.12rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.45vw, 1.55rem);
  --step-2:  clamp(1.70rem, 1.45rem + 1.20vw, 2.50rem);
  --step-3:  clamp(2.40rem, 1.80rem + 2.90vw, 4.75rem);

  /* Space + shape */
  --gap:     clamp(1rem, 0.7rem + 1.4vw, 1.75rem);
  --section: clamp(3.5rem, 2.4rem + 5vw, 7rem);
  --measure: 34rem;
  --shell:   62rem;
  --radius:  14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --paper:      #0e0f12;
    --paper-2:    #16181d;
    --ink:        #eceef2;
    --ink-muted:  #9aa1af;
    --ink-faint:  #6b7280;
    --rule:       #24272e;
    --accent:     #ff7a5c;
    --accent-ink: #16181d;
  }
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --paper:      #0e0f12;
  --paper-2:    #16181d;
  --ink:        #eceef2;
  --ink-muted:  #9aa1af;
  --ink-faint:  #6b7280;
  --rule:       #24272e;
  --accent:     #ff7a5c;
  --accent-ink: #16181d;
}

:root[data-mode="light"] { color-scheme: light; }

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.shell { width: min(100% - 2.5rem, var(--shell)); margin-inline: auto; }

/* ── Header ─────────────────────────────────────────── */
.site-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--gap); flex-wrap: wrap;
  padding-block: 1.75rem;
}
.wordmark {
  font-size: var(--step-0); font-weight: 600; letter-spacing: -0.015em;
}
.wordmark .dot { color: var(--accent); }
.site-nav { display: flex; gap: 1.5rem; font-size: var(--step--1); color: var(--ink-muted); }
.site-nav a { transition: color .15s ease; }
.site-nav a:hover { color: var(--ink); }

/* ── Hero ───────────────────────────────────────────── */
.hero { padding-block: clamp(2.5rem, 1rem + 7vw, 6rem) var(--section); }
.hero h1 {
  font-size: var(--step-3);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  max-width: 15ch;
}
.hero .role {
  margin-top: 1.5rem;
  font-size: var(--step-1);
  color: var(--ink-muted);
  letter-spacing: -0.01em;
  max-width: var(--measure);
}
.hero .bio {
  margin-top: 1.25rem;
  max-width: var(--measure);
  color: var(--ink-muted);
}
.hero .bio strong { color: var(--ink); font-weight: 550; }

/* ── Sections ───────────────────────────────────────── */
.section { padding-block: var(--section); border-top: 1px solid var(--rule); }
.section-label {
  font-size: var(--step--1);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-faint);
  margin-bottom: 2rem;
}

/* ── Projects ───────────────────────────────────────── */
.projects { display: grid; gap: 1px; background: var(--rule); border-block: 1px solid var(--rule); }
.project {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--gap);
  padding: 1.75rem 0.25rem;
  background: var(--paper);
  transition: background .18s ease, padding-inline .18s ease;
}
a.project:hover, a.project:focus-visible { background: var(--paper-2); padding-inline: 1rem 0.25rem; }
.project h3 {
  font-size: var(--step-1); font-weight: 600; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.project p { margin-top: .5rem; color: var(--ink-muted); max-width: var(--measure); }
.project .arrow { color: var(--ink-faint); font-size: var(--step-1); line-height: 1.2; transition: transform .18s ease, color .18s ease; }
a.project:hover .arrow { color: var(--accent); transform: translateX(3px); }

.tag {
  font-family: var(--font-mono);
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.28em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  white-space: nowrap;
}
.tag.is-beta { border-color: color-mix(in oklab, var(--accent) 45%, transparent); color: var(--accent); }

/* ── Elsewhere ──────────────────────────────────────── */
.links { display: flex; flex-wrap: wrap; gap: .75rem; }
.links a {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.05rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: var(--step--1);
  color: var(--ink-muted);
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.links a:hover { border-color: var(--ink-faint); color: var(--ink); background: var(--paper-2); }
.links svg { width: 1.05em; height: 1.05em; flex: none; }

/* ── Footer ─────────────────────────────────────────── */
.site-foot {
  padding-block: 2.5rem 3.5rem;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: var(--gap); flex-wrap: wrap;
  font-size: var(--step--1);
  color: var(--ink-faint);
}
.site-foot a { border-bottom: 1px solid transparent; transition: border-color .18s ease, color .18s ease; }
.site-foot a:hover { color: var(--ink); border-bottom-color: var(--accent); }

@media (max-width: 34rem) {
  .project { grid-template-columns: 1fr; }
  .project .arrow { display: none; }
}
