:root {
  --blotter: #dde3dc;
  --blotter-deep: #cfd7cf;
  --sheet: #fdfdfb;
  --ink: #1f2725;
  --ink-soft: #4d5754;
  --rule: #bfc9c0;
  --petrol: #02667a;
  --petrol-deep: #014656;
  --return-paper: #eef5f7;
  --amber: #c87830;
  --amber-ink: #8f4e17;
  --jade: #e9efe7;
  --jade-edge: #d7e0d4;
  --focus: #02667a;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blotter: #18201d;
    --blotter-deep: #121916;
    --sheet: #f4f4ef;
    --ink: #e8ece8;
    --ink-soft: #b3bdb7;
    --rule: #34403b;
    --petrol: #6cc3d6;
    --petrol-deep: #9fdbe8;
    --return-paper: #142a31;
    --amber: #e6a061;
    --amber-ink: #f0b783;
    --jade: #1d2a22;
    --jade-edge: #2c3a31;
    --focus: #6cc3d6;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--blotter);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
code { font-size: 0.92em; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 0.05em 0.35em; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); color: #111; padding: 8px 12px; }
.skip:focus { left: 8px; z-index: 10; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.05; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); max-width: 11ch; }
h2 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); }
h3 { font-size: 1.85rem; }
p { margin: 0 0 1em; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter);
  max-width: 1280px; margin: 0 auto;
}
.wordmark { font-family: var(--serif); font-size: 1.6rem; text-decoration: none; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 0.98rem; }
.top nav a:not(.btn) { text-decoration: none; }
.top nav a:not(.btn):hover { text-decoration: underline; }
@media (max-width: 640px) { .top nav a:not(.btn) { display: none; } }

.btn {
  display: inline-block; text-decoration: none; font-weight: 600;
  background: var(--ink); color: var(--blotter);
  padding: 0.8em 1.3em; border-radius: 999px; line-height: 1.1;
}
.btn:hover { background: var(--petrol-deep); color: #fff; }
.btn-small { padding: 0.6em 1.05em; font-size: 0.95rem; }
.btn-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-quiet:hover { background: var(--ink); color: var(--blotter); }

/* Hero */
.hero {
  max-width: 1280px; margin: 0 auto;
  padding: clamp(32px, 7vw, 96px) var(--gutter) clamp(48px, 8vw, 120px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center;
}
.lede { font-size: 1.22rem; color: var(--ink-soft); max-width: 34ch; margin-top: 1.4rem; }
.lede a { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }

.desk { position: relative; aspect-ratio: 1 / 1.02; }
.sheet {
  position: absolute; width: 56%;
  background: #fff;
  box-shadow: 0 1px 1px rgba(30, 40, 35, 0.12), 0 14px 30px -12px rgba(30, 40, 35, 0.35);
  transform-origin: 50% 60%;
}
.s1 { left: 2%; top: 9%; transform: rotate(-7deg); }
.s2 { left: 40%; top: 0; transform: rotate(5deg); }
.s3 { left: 20%; top: 26%; transform: rotate(-1.5deg); }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: settle 900ms cubic-bezier(.2,.7,.2,1) both; }
  .s2 { animation-delay: 120ms; }
  .s3 { animation-delay: 240ms; }
  @keyframes settle { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .desk { max-width: 520px; width: 100%; margin: 0 auto; }
}

/* Shelves */
.shelf { padding: clamp(56px, 9vw, 120px) var(--gutter); }
.shelf-return { background: var(--return-paper); }
.shelf-near { background: var(--jade); }
.shelf > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.shelf-head { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: clamp(36px, 6vw, 72px); }
.shelf-head p { max-width: 60ch; color: var(--ink-soft); font-size: 1.12rem; margin-top: 0.9rem; }
.shelf-head p a { color: var(--ink); }
.app-icon { border-radius: 22%; box-shadow: 0 6px 16px -8px rgba(0,0,0,.4); }
.shelf-return h2 { color: var(--petrol-deep); }
.shelf-near h2 { color: var(--amber-ink); }

.products { list-style: none; padding: 0; display: grid; gap: clamp(40px, 6vw, 72px); }
.product { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.product:nth-child(even) img { order: 2; }
.product img { border-radius: 6px; }
.product-body p { color: var(--ink-soft); max-width: 52ch; }
.product-body h3 { margin-bottom: 0.6rem; }
@media (max-width: 760px) {
  .product { grid-template-columns: 1fr; }
  .product:nth-child(even) img { order: 0; }
}

.downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 1.2rem; }
.downloads span { color: var(--ink); font-weight: 600; margin-right: 6px; }
.downloads a {
  text-decoration: none; font-weight: 500; color: var(--ink);
  padding: 0.45em 0.9em; border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--rule);
  background: color-mix(in srgb, var(--sheet) 70%, transparent);
}
.shelf-return .downloads a:hover { box-shadow: inset 0 0 0 1.5px var(--petrol); color: var(--petrol-deep); }
.shelf-near .downloads a:hover { box-shadow: inset 0 0 0 1.5px var(--amber); color: var(--amber-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .downloads a { background: transparent; }
}

/* Store */
.store { padding: clamp(64px, 10vw, 140px) var(--gutter); background: var(--blotter-deep); }
.store-copy { max-width: 46rem; margin: 0 auto; }
.store-copy p { color: var(--ink-soft); font-size: 1.1rem; margin-top: 1rem; }
.store-copy p a:not(.btn) { color: var(--ink); }
.store-copy .btn { margin-top: 0.8rem; }
.fine { font-size: 0.95rem !important; }

/* Built */
.built { padding: clamp(56px, 9vw, 120px) var(--gutter); max-width: 1180px; margin: 0 auto; }
.built-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px 48px; margin-top: 40px; }
.built-grid h3 { font-size: 1.55rem; margin-bottom: 0.5rem; }
.built-grid p { color: var(--ink-soft); }
.repo { margin-top: 2.5rem; font-weight: 600; }

.foot { border-top: 1px solid var(--rule); padding: 32px var(--gutter) 48px; max-width: 1180px; margin: 0 auto; color: var(--ink-soft); font-size: 0.98rem; }
.foot a { color: var(--ink); }
