/* nookd. — the app's Soft UI on the web (DESIGN.md: Soft UI base, glass for overlays only,
   spring motion). Colour values are the app's Assets.xcassets/Colors tokens, light and dark. */

:root {
  --app-bg: #E0E5EC;
  --surface: #E0E5EC;
  --surface-elevated: #EEF2F7;
  --surface-recessed: #D5DBE4;
  --border: #A3B1C6;
  --text: #2C3544;
  --text-2: #6B778C;
  --neon: #2C3544;
  --neon-soft: #6B778C;
  --accent-soft: #C8D0E4;
  --hl: #FFFFFF;
  --sh: #A3B1C6;
  --gloss: rgba(255, 255, 255, 0.85);
  --gloss-strong: rgba(255, 255, 255, 0.9);
  --on-neon: #EEF2F7;
  --success: #5A9A78;
  --clay-base: #DCE2EA;
  --clay-low: #ECF0F5;
  --clay-mid: #F4F7FA;
  --clay-high: #FCFDFE;
  --clay-highlight: #FFFFFF;
  --clay-shade: #92A0B6;
  --clay-name: #5B6678;
  --glass: rgba(238, 242, 247, 0.58);
  --glass-shadow: 0 10px 30px rgba(44, 53, 68, 0.14);
  --glow: rgba(44, 53, 68, 0.28);

  /* Soft UI shadows (SoftUIShadow: --neu-out 9/18, --neu-out-sm 4/10, --neu-in 6/12, --neu-in-sm 3/7). */
  --raised: 9px 9px 18px var(--sh), -9px -9px 18px var(--hl);
  --raised-sm: 4px 4px 10px var(--sh), -4px -4px 10px var(--hl);
  --recessed: inset 6px 6px 12px var(--sh), inset -6px -6px 12px var(--hl);
  --recessed-sm: inset 3px 3px 7px var(--sh), inset -3px -3px 7px var(--hl);
  --pop-text: 1px 1px 1px var(--hl), -1px -1px 1px rgba(163, 177, 198, 0.35);

  /* TactileMotion springs; site.js swaps these for exact linear() curves of the same springs. */
  --ease-press: cubic-bezier(0.34, 1.45, 0.64, 1);
  --dur-press: 0.45s;
  --ease-enter: cubic-bezier(0.22, 1.12, 0.36, 1);
  --dur-enter: 0.5s;
  --ease-layout: cubic-bezier(0.25, 1.04, 0.4, 1);
  --dur-layout: 0.55s;

  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-card: 28px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --app-bg: #2C333D;
    --surface: #2C333D;
    --surface-elevated: #353D4A;
    --surface-recessed: #252B34;
    --border: #3A4350;
    --text: #E6EAF1;
    --text-2: #9AA6B8;
    --neon: #FFFFFF;
    --neon-soft: #CCCCCC;
    --accent-soft: #3E4A5F;
    --hl: #3A4350;
    --sh: #1A1F27;
    --gloss: rgba(255, 255, 255, 0.08);
    --gloss-strong: rgba(255, 255, 255, 0.12);
    --on-neon: #2C333D;
    --success: #6EBB92;
    --clay-base: #242A33;
    --clay-low: #38404D;
    --clay-mid: #434D5C;
    --clay-high: #525D6E;
    --clay-highlight: #647082;
    --clay-shade: #080A0E;
    --clay-name: #C9D1DC;
    --glass: rgba(53, 61, 74, 0.55);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --glow: rgba(255, 255, 255, 0.32);
    --pop-text: 1px 1px 1px rgba(0, 0, 0, 0.35), -1px -1px 1px rgba(255, 255, 255, 0.04);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --app-bg: #2C333D;
  --surface: #2C333D;
  --surface-elevated: #353D4A;
  --surface-recessed: #252B34;
  --border: #3A4350;
  --text: #E6EAF1;
  --text-2: #9AA6B8;
  --neon: #FFFFFF;
  --neon-soft: #CCCCCC;
  --accent-soft: #3E4A5F;
  --hl: #3A4350;
  --sh: #1A1F27;
  --gloss: rgba(255, 255, 255, 0.08);
  --gloss-strong: rgba(255, 255, 255, 0.12);
  --on-neon: #2C333D;
  --success: #6EBB92;
  --clay-base: #242A33;
  --clay-low: #38404D;
  --clay-mid: #434D5C;
  --clay-high: #525D6E;
  --clay-highlight: #647082;
  --clay-shade: #080A0E;
  --clay-name: #C9D1DC;
  --glass: rgba(53, 61, 74, 0.55);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow: rgba(255, 255, 255, 0.32);
  --pop-text: 1px 1px 1px rgba(0, 0, 0, 0.35), -1px -1px 1px rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

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

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; border-radius: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { width: min(1080px, 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Glass navigation (an overlay, so it's glass) ---------- */

.nav {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 20;
  translate: -50% 0;
  width: min(1080px, 100% - 24px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--gloss-strong), inset 0 0 0 1px var(--gloss);
}
.nav-name {
  font-weight: 900;
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--clay-name);
  text-decoration: none;
  margin-right: auto;
}
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--gloss); }

.theme-toggle {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-recessed) 70%, transparent);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}
.theme-toggle button {
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform var(--dur-press) var(--ease-press);
}
.theme-toggle button:active { transform: scale(0.92); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}
.theme-toggle svg { width: 16px; height: 16px; }

@media (max-width: 640px) {
  .nav { padding-left: 16px; }
  .nav-links a.optional { display: none; }
  .nav-links a { padding: 8px 9px; }
}

/* ---------- Buttons: raised Soft UI capsules that press in ---------- */

.button {
  --scale: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--raised-sm);
  transform: scale(var(--scale));
  transition: transform var(--dur-press) var(--ease-press), box-shadow 0.25s ease-out, background-color 0.2s;
}
.button:hover { text-decoration: none; }
.button:active { --scale: 0.96; box-shadow: var(--recessed-sm); }
.button.primary {
  color: var(--on-neon);
  background: var(--neon);
  box-shadow: var(--raised-sm), 0 0 0 0 var(--glow);
}
.button.primary:hover { box-shadow: var(--raised-sm), 0 0 22px 2px var(--glow); }
.button.primary:active { box-shadow: 0 0 0 0 var(--glow), inset 0 2px 8px rgba(0, 0, 0, 0.35); }
.button[aria-disabled="true"] { cursor: default; }
.button svg { width: 18px; height: 18px; }

/* ---------- Hero: the clay login ---------- */

.hero {
  position: relative;
  min-height: max(640px, 100svh);
  display: grid;
  background: var(--clay-base);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}
.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: max(96px, 12svh) var(--gutter) 64px;
  pointer-events: none;
}
.hero-inner a, .hero-inner button { pointer-events: auto; }
.hero-square {
  width: min(400px, 74vw, 46svh);
  aspect-ratio: 1;
  flex: none;
}
/* Without WebGL, the icon's own frame stands in for the shader. */
.no-clay .hero-square {
  background: url("img/icon-512.png") center / cover;
  border-radius: 22.4%;
  box-shadow: var(--raised);
}
.lede {
  margin-top: clamp(20px, 4svh, 40px);
  font-size: clamp(26px, 4.2vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 18ch;
  text-shadow: var(--pop-text);
}
.hero .sub {
  margin-top: 14px;
  max-width: 34ch;
  font-size: clamp(17px, 2vw, 19px);
  color: var(--text-2);
}
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.hint {
  margin-top: 26px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  transition: opacity 0.6s ease-out, translate var(--dur-enter) var(--ease-enter);
}
.clay-touched .hint, .no-clay .hint { opacity: 0; translate: 0 6px; }
@media (prefers-reduced-motion: reduce) { .hint { display: none; } }

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

.section { padding: clamp(72px, 12vw, 128px) 0; }
.eyebrow {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.section h2 {
  margin-top: 10px;
  font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 20ch;
  text-shadow: var(--pop-text);
}
.section-lede {
  margin-top: 16px;
  max-width: 56ch;
  font-size: 19px;
  color: var(--text-2);
}
.grid { display: grid; gap: clamp(18px, 2.4vw, 28px); margin-top: clamp(36px, 5vw, 56px); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--raised);
  padding: clamp(22px, 3vw, 32px);
}
.card h3 { font-size: 21px; font-weight: 800; margin-top: 18px; }
.card p { margin-top: 8px; color: var(--text-2); }
.card .fine { font-size: 15px; }

/* ClayStamp: a glyph pressed into a small clay plate and inked. */
.stamp {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
  color: var(--clay-name);
}
.stamp svg {
  width: 26px;
  height: 26px;
  filter: drop-shadow(1px 1px 0 var(--hl)) drop-shadow(-0.5px -0.5px 0 rgba(0, 0, 0, 0.18));
}
.stamp.success { color: var(--success); }

/* ---------- Reveal: things rise out of the surface as they arrive ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px) scale(0.94);
  transition: opacity 0.36s ease-out, transform var(--dur-enter) var(--ease-enter);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { transform: none; transition: opacity 0.2s ease-out; transition-delay: 0s; }
}

/* ---------- Folder demo: press to select ---------- */

.demo {
  position: relative;
  margin-top: clamp(36px, 5vw, 56px);
  padding: clamp(18px, 3vw, 28px) clamp(18px, 3vw, 28px) 96px;
}
.demo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 6px 18px; }
.demo-title { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; color: var(--clay-name); }
.demo-meta { font-size: 14px; font-weight: 600; color: var(--text-2); }
.demo-grid { columns: 4 150px; column-gap: 16px; }
@media (max-width: 520px) { .demo-grid { columns: 2; column-gap: 12px; } }

.tile {
  --scale: 1;
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  break-inside: avoid;
  -webkit-tap-highlight-color: transparent;
}
.tile .socket {
  position: relative;
  display: block;
  border-radius: 20px;
  background: var(--surface-recessed);
  box-shadow: var(--recessed-sm);
  overflow: hidden;
  transform: scale(var(--scale));
  transition: transform var(--dur-press) var(--ease-press), box-shadow 0.3s ease-out;
}
.tile .socket svg { width: 100%; height: 100%; }
.tile:active { --scale: 0.96; }
.tile[aria-pressed="true"] { --scale: 0.95; }
.tile[aria-pressed="true"] .socket {
  box-shadow: inset 6px 6px 14px var(--sh), inset -4px -4px 10px var(--hl), 0 0 0 2px var(--neon), 0 0 18px 2px var(--glow);
}
.tile .name {
  display: block;
  padding: 8px 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.tile .check {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--neon);
  color: var(--on-neon);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform var(--dur-enter) var(--ease-enter);
}
.tile .check svg { width: 14px; height: 14px; }
.tile[aria-pressed="true"] .check { opacity: 1; transform: none; }

/* Folders are raised Tab cards with a 4:3 cover window. */
.tile.folder .socket { background: var(--surface); box-shadow: var(--raised-sm); padding: 26px 10px 10px; overflow: visible; }
.tile.folder .socket::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 14px;
  width: 42%;
  height: 22px;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  box-shadow: -3px -3px 6px var(--hl);
}
.tile.folder .cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: var(--surface-recessed);
  box-shadow: var(--recessed-sm);
  overflow: hidden;
}
.tile.folder[aria-pressed="true"] .socket {
  box-shadow: inset 4px 4px 10px var(--sh), inset -4px -4px 10px var(--hl), 0 0 0 2px var(--neon), 0 0 18px 2px var(--glow);
}

/* The selection dock: a glass overlay that rises in when something is selected. */
.dock {
  position: absolute;
  left: 50%;
  bottom: 22px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--gloss-strong), inset 0 0 0 1px var(--gloss);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(16px) scale(0.94);
  transform-origin: bottom center;
  pointer-events: none;
  transition: opacity 0.25s ease-out, transform var(--dur-enter) var(--ease-enter);
}
.dock.is-up { opacity: 1; transform: none; pointer-events: auto; }
.dock-count { font-size: 15px; font-weight: 700; margin-right: 8px; min-width: 8ch; }
.dock button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s, transform var(--dur-press) var(--ease-press);
}
.dock button:hover { background: var(--gloss); }
.dock button:active { transform: scale(0.9); }
.dock button svg { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) {
  .dock { transform: none; }
  .tile .socket, .tile .check { transition: box-shadow 0.2s, opacity 0.2s; }
  .tile:active, .tile[aria-pressed="true"] { --scale: 1; }
}

/* ---------- Plans ---------- */

.plan { display: flex; flex-direction: column; }
.plan-art {
  width: 132px;
  height: 132px;
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--raised-sm);
}
.plan-art img { width: 100%; height: 100%; object-fit: cover; }
.plan-free {
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: 44px;
  font-weight: 900;
  color: var(--clay-name);
  text-shadow: var(--pop-text);
}
.price { margin-top: 14px; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.price small { font-size: 16px; font-weight: 600; color: var(--text-2); }
.badge {
  align-self: flex-start;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--text);
}
.plans-note { margin-top: 28px; font-size: 15px; color: var(--text-2); max-width: 70ch; }

/* ---------- Closing band ---------- */

.band {
  position: relative;
  overflow: hidden;
  background: var(--clay-base);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}
.band canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.band-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
  padding: clamp(80px, 12vw, 140px) var(--gutter);
}
.band h2 { font-size: clamp(30px, 5vw, 50px); font-weight: 900; letter-spacing: -0.02em; text-shadow: var(--pop-text); }

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

.footer { padding: 40px 0 48px; color: var(--text-2); font-size: 15px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-right: auto; }
.footer a { text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--text); }

/* ---------- Legal pages ---------- */

.page-head {
  position: relative;
  overflow: hidden;
  background: var(--clay-base);
  /* The band sinks into the page, as the folder title's clay band does. */
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
  mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.page-head canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.page-head .wrap { position: relative; padding: 140px 0 120px; }
.page-head h1 { font-size: clamp(36px, 6vw, 56px); font-weight: 900; letter-spacing: -0.02em; text-shadow: var(--pop-text); }
.page-head p { margin-top: 10px; color: var(--text-2); font-weight: 600; }

.doc { width: min(780px, 100% - 2 * var(--gutter)); margin: -40px auto 0; position: relative; }
.doc .card { padding: clamp(24px, 5vw, 48px); }
.doc h2 { font-size: 24px; font-weight: 800; margin: 40px 0 12px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 18px; font-weight: 800; margin: 24px 0 8px; }
.doc p, .doc li { color: var(--text); }
.doc p + p { margin-top: 12px; }
.doc ul { margin: 12px 0 0; padding-left: 22px; }
.doc li + li { margin-top: 8px; }
.doc .summary {
  margin-bottom: 36px;
  padding: 20px 22px;
  border-radius: 20px;
  background: var(--surface-recessed);
  box-shadow: var(--recessed-sm);
}
.doc .summary p { color: var(--text); font-weight: 600; }

/* ---------- 404 ---------- */

.lost { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: var(--gutter); }
.lost h1 { font-size: clamp(44px, 9vw, 88px); font-weight: 900; color: var(--clay-name); text-shadow: var(--pop-text); }
.lost p { margin: 12px 0 28px; color: var(--text-2); }
