/* ==========================================================================
   Quietwell Labs: shared styles for every page.
   Colours come straight from Ninekey's own screens: pale LCD green for paper,
   handset navy for ink, and the amber of its settings toggles as the accent.
   ========================================================================== */

@font-face { font-family: "Lora"; src: url("/assets/fonts/lora-latin.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Quietwell Dot"; src: url("/assets/fonts/quietwell-dot.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Quietwell Pix"; src: url("/assets/fonts/quietwell-pix.woff") format("woff"); font-display: swap; }

:root {
  --paper: #ecefe1;
  --paper-2: #e1e6d2;
  --paper-3: #d3dabf;
  --ink: #1b2230;
  --ink-2: #48526a;
  --line: rgba(27, 34, 48, .16);
  --line-strong: rgba(27, 34, 48, .34);
  --navy: #233049;
  --navy-deep: #131c2b;
  --lcd: #b4c591;
  --lcd-hi: #c3d2a2;
  --lcd-ink: #232e1a;
  --keycap: #aeb6c0;
  --amber: #d4a24c;
  --amber-ink: #3a2a0c;
  --call: #2f9a5c;
  --hang: #c8453b;
  --btn-face: var(--navy);
  --btn-edge: var(--navy-deep);
  --btn-ink: #f2f5ea;
  --focus: #9a5b00;

  --serif: "Lora", "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;
  --dot: "Quietwell Dot", "Quietwell Pix", ui-monospace, "DejaVu Sans Mono", monospace;
  --pix: "Quietwell Pix", ui-monospace, "DejaVu Sans Mono", monospace;
  --cond: "Roboto Condensed", "sans-serif-condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 44px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.3, 1.5, .5, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131c2b; --paper-2: #1a2538; --paper-3: #233049;
    --ink: #e6ecd8; --ink-2: #a7b1a6;
    --line: rgba(230, 236, 216, .16); --line-strong: rgba(230, 236, 216, .36);
    --btn-face: #b4c591; --btn-edge: #7f9160; --btn-ink: #1b2230;
    --focus: #f0c46e;
  }
}
:root[data-theme="dark"] {
  --paper: #131c2b; --paper-2: #1a2538; --paper-3: #233049;
  --ink: #e6ecd8; --ink-2: #a7b1a6;
  --line: rgba(230, 236, 216, .16); --line-strong: rgba(230, 236, 216, .36);
  --btn-face: #b4c591; --btn-edge: #7f9160; --btn-ink: #1b2230;
  --focus: #f0c46e;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 500; line-height: 1.12; letter-spacing: -.015em; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--lcd); color: var(--lcd-ink); }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; }
.skip:focus { top: 12px; }
.pix { width: 1em; height: 1em; fill: currentColor; shape-rendering: crispEdges; flex: none; }

/* ---- header ------------------------------------------------------------- */
.site-head { padding-block: 22px; }
.site-head .wrap { display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; font-size: 1.12rem; letter-spacing: -.01em; margin-right: auto; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand .ring { transform-origin: 20px 20px; transition: transform .6s var(--spring); }
.brand:hover .ring-2 { transform: scale(1.12); }
.brand:hover .ring-3 { transform: scale(1.2); transition-delay: .06s; }
.nav { display: flex; align-items: center; gap: clamp(10px, 3vw, 26px); font-size: 1rem; }
.nav a { text-decoration: none; padding: 8px 2px; position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 2px; background: var(--amber); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.theme-toggle { width: 44px; height: 44px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 12px; background: transparent; cursor: pointer; font-size: 20px; transition: transform .25s var(--spring); }
.theme-toggle:hover { transform: rotate(-12deg) scale(1.06); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ---- buttons: shaped like keys, the face sinks when pressed ---------------- */
.btn { display: inline-block; border: 0; padding: 0; background: var(--btn-edge); border-radius: 16px; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn-face { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 24px; border-radius: 16px; background: var(--btn-face); color: var(--btn-ink); font-weight: 600; font-size: 1.02rem; line-height: 1.2; transform: translateY(-5px); transition: transform .16s var(--ease); will-change: transform; }
.btn:hover .btn-face { transform: translateY(-7px); }
.btn:active .btn-face, .btn.is-down .btn-face { transform: translateY(-1px); transition-duration: .05s; }
.btn-quiet { --btn-face: var(--paper-2); --btn-edge: var(--paper-3); --btn-ink: var(--ink); }
.btn-quiet .btn-face { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn[aria-disabled="true"] { cursor: default; }
.btn.is-nope .btn-face { animation: nope .4s var(--ease); }
@keyframes nope { 20% { transform: translate(-5px, -5px); } 50% { transform: translate(5px, -5px); } 80% { transform: translate(-3px, -5px); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 18px 16px; align-items: center; }

/* ---- reveal on scroll (only when JS is running) -------------------------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal-pop { opacity: 0; transform: scale(.94); transition: opacity .6s var(--ease), transform .7s var(--spring); transition-delay: calc(var(--d, 0) * 90ms); }
.js .reveal-pop.is-in { opacity: 1; transform: none; }

/* gentle parallax, driven by the browser's own scroll timeline (no JS) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .drift { animation: drift linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
    @keyframes drift { from { transform: translateY(var(--drift, 36px)); } to { transform: translateY(calc(var(--drift, 36px) * -1)); } }
  }
}

/* ---- phone mockup -------------------------------------------------------- */
.phone { position: relative; width: min(100%, var(--phone-w, 300px)); aspect-ratio: 720 / 1487; border-radius: 13% / 6.3%; padding: 2.6%; background: #0c121d; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .08) inset, 0 30px 50px -22px rgba(13, 20, 33, .55), 0 10px 18px -10px rgba(13, 20, 33, .4); }
.phone picture, .phone img { width: 100%; height: 100%; border-radius: 10.6% / 5.1%; object-fit: cover; }
.phone img { background: var(--navy); }
.tilt { transition: transform .5s var(--ease); transform-style: preserve-3d; will-change: transform; }

/* ---- small LCD chip ------------------------------------------------------ */
.lcd-chip { display: inline-flex; align-items: center; gap: 8px; font-family: var(--pix); font-size: .86rem; line-height: 1; padding: 9px 12px 8px; background: var(--lcd); color: var(--lcd-ink); border-radius: 9px; box-shadow: inset 0 0 0 1.5px rgba(35, 46, 26, .3); }
.lcd-chip .blink { width: 7px; height: 7px; background: currentColor; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ==========================================================================
   Home
   ========================================================================== */
.hero { position: relative; padding-block: clamp(36px, 7vw, 84px) clamp(64px, 10vw, 128px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 7.4vw, 4.6rem); letter-spacing: -.028em; line-height: 1.04; max-width: 13ch; }
.hero-lede { margin-top: 26px; font-size: clamp(1.1rem, 2.1vw, 1.3rem); line-height: 1.6; max-width: 34em; color: var(--ink-2); }
.hero-lede strong { color: var(--ink); font-weight: 600; }
.hero .btn-row { margin-top: 38px; }
.well { width: min(86vw, 440px); margin-inline: auto; color: var(--ink); }
.well circle { fill: none; stroke: currentColor; stroke-linecap: round; }
.well .drop { fill: var(--amber); stroke: none; }
.well .ripple { opacity: .16; }
.well.is-live .ripple { animation: ripple 6.5s var(--ease) infinite; animation-delay: calc(var(--i) * .42s); }
.well.is-live .drop { animation: drop 6.5s var(--ease) infinite; transform-origin: 220px 220px; }
@keyframes ripple { 0%, 55%, 100% { opacity: .16; } 14% { opacity: .95; } }
@keyframes drop { 0%, 30%, 100% { transform: scale(1); } 6% { transform: scale(1.7); } }
@media (min-width: 860px) {
  .hero .wrap { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
  .well { margin-inline: 0 0; justify-self: end; }
}

.section { padding-block: clamp(56px, 9vw, 112px); }
.section-head { max-width: 40em; margin-bottom: clamp(28px, 5vw, 52px); }
.section-head h2 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
.section-head p { margin-top: 14px; color: var(--ink-2); font-size: 1.1rem; }

/* apps */
.apps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.app-card { position: relative; display: grid; border-radius: 30px; overflow: hidden; text-decoration: none; isolation: isolate; }
.app-ninekey { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .09); background: linear-gradient(170deg, #263550, #141d2c); color: #eef2e2; min-height: 420px; grid-template-columns: 1fr; }
.app-ninekey .app-text { padding: clamp(26px, 5vw, 52px); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; z-index: 1; }
.app-ninekey h3 { font-family: var(--dot); font-size: clamp(2.6rem, 8vw, 4.4rem); font-weight: 400; letter-spacing: 0; color: var(--lcd); line-height: 1; }
.app-kind { font-size: 1rem; color: #b9c3cf; }
.app-tag { font-size: clamp(1.2rem, 2.6vw, 1.55rem); line-height: 1.35; max-width: 20em; }
.app-more { margin-top: auto; padding-top: 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; }
.app-more .pix { transition: transform .35s var(--spring); }
.app-ninekey:hover .app-more .pix { transform: translateX(6px); }
.app-shot { position: relative; display: flex; justify-content: center; align-items: flex-start; padding: 0 24px; height: 300px; }
.app-shot .phone { --phone-w: 250px; transition: transform .6s var(--ease); transform: rotate(-4deg); }
.app-ninekey:hover .app-shot .phone { transform: rotate(-1deg) translateY(-12px); }
.brew { background: var(--paper-2); border: 1.5px dashed var(--line-strong); padding: clamp(24px, 4vw, 36px); align-content: space-between; gap: 34px; min-height: 230px; color: var(--ink-2); }
.brew h3 { font-size: 1.45rem; color: var(--ink); }
.brew p { margin-top: 8px; }
.steam { display: flex; gap: 9px; align-items: flex-end; height: 44px; }
.steam i { width: 9px; height: 9px; background: var(--ink-2); opacity: .25; }
.is-live .steam i { animation: steam 2.8s var(--ease) infinite; animation-delay: calc(var(--i) * .35s); }
@keyframes steam { 0% { transform: translateY(0); opacity: .25; } 45% { transform: translateY(-30px); opacity: .9; } 100% { transform: translateY(-34px); opacity: 0; } }
@media (min-width: 760px) {
  .apps { grid-template-columns: 1fr 1fr; }
  .app-ninekey { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); min-height: 460px; }
  .app-shot { height: auto; align-items: flex-start; padding-top: 54px; }
  .app-shot .phone { --phone-w: 290px; position: absolute; }
}

/* promises: read like four LCD status readouts */
.promises { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.promise { background: var(--lcd); color: var(--lcd-ink); border-radius: 20px; padding: 20px 18px 22px; box-shadow: inset 0 0 0 2px rgba(35, 46, 26, .22), inset 0 12px 24px -14px rgba(255, 255, 255, .5); }
.promise .pix { width: 26px; height: 26px; margin-bottom: 16px; }
.promise h3 { font-family: var(--dot); font-weight: 400; letter-spacing: 0; font-size: clamp(1.15rem, 3.6vw, 1.6rem); line-height: 1.15; }
.promise p { margin-top: 10px; font-size: .98rem; line-height: 1.5; }
@media (min-width: 900px) { .promises { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } .promise { padding: 26px 24px 28px; } }

@media (max-width: 519px) {
  .promises { grid-template-columns: 1fr; }
  .promise { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: start; }
  .promise .pix { grid-row: span 2; margin: 2px 0 0; }
  .brand { font-size: .98rem; gap: 8px; white-space: nowrap; } .brand svg { width: 28px; height: 28px; }
  .nav { gap: 12px; font-size: .94rem; }
  .theme-toggle { width: 40px; height: 40px; font-size: 18px; }
  .site-head .wrap { gap: 8px; }
}

@media (max-width: 349px) { .brand span { display: none; } }

/* ---- prose pages (privacy, support) -------------------------------------- */
.page-head { padding-block: clamp(28px, 6vw, 64px) clamp(20px, 4vw, 36px); }
.page-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -.025em; }
.page-head p { margin-top: 16px; color: var(--ink-2); font-size: 1.15rem; max-width: 36em; }
.crumbs { font-size: .95rem; color: var(--ink-2); margin-bottom: 18px; }
.prose { max-width: 41em; padding-bottom: clamp(56px, 9vw, 110px); }
.prose h2 { font-size: 1.55rem; margin-top: 2.2em; margin-bottom: .55em; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 1em; }
.prose ul { list-style: none; }
.prose li { position: relative; padding-left: 1.5em; margin-top: .5em; }
.prose li::before { content: ""; position: absolute; left: .2em; top: .68em; width: 7px; height: 7px; background: var(--amber); }
.summary-card { background: var(--lcd); color: var(--lcd-ink); border-radius: 22px; padding: clamp(20px, 4vw, 32px); box-shadow: inset 0 0 0 2px rgba(35, 46, 26, .22); margin-block: 8px 12px; }
.summary-card h2 { margin: 0 0 .5em; font-family: var(--dot); font-weight: 400; font-size: 1.5rem; letter-spacing: 0; }
.summary-card li::before { background: var(--lcd-ink); }
.contact-card { display: grid; gap: 14px; background: var(--paper-2); border-radius: 24px; padding: clamp(22px, 4vw, 34px); border: 1.5px solid var(--line); margin-top: 8px; }
.contact-card .mail { font-size: clamp(1.15rem, 4.4vw, 1.7rem); font-weight: 600; overflow-wrap: anywhere; }

/* ---- FAQ ----------------------------------------------------------------- */
.faq { border-top: 1.5px solid var(--line-strong); }
.faq details { border-bottom: 1.5px solid var(--line-strong); }
.faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 16px; padding: 20px 2px; font-size: 1.16rem; font-weight: 600; line-height: 1.35; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; margin-left: auto; flex: none; width: 14px; height: 14px; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; transition: transform .35s var(--spring); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 2px 24px; max-width: 40em; color: var(--ink-2); }
.faq .answer p + p { margin-top: .8em; }
.faq details[open] .answer { animation: answer .45s var(--ease); }
@keyframes answer { from { opacity: 0; transform: translateY(-8px); } }

/* ---- footer -------------------------------------------------------------- */
.site-foot { border-top: 1.5px solid var(--line); padding-block: 44px 56px; font-size: .98rem; color: var(--ink-2); }
.site-foot .wrap { display: grid; gap: 26px; }
.foot-brand { font-weight: 600; color: var(--ink); font-size: 1.08rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.foot-note { max-width: 44em; font-size: .92rem; }
@media (min-width: 760px) { .site-foot .wrap { grid-template-columns: 1fr auto; align-items: start; } .foot-note { grid-column: 1 / -1; } }

/* ---- 404 ----------------------------------------------------------------- */
.lost { min-height: 70vh; display: grid; place-items: center; padding-block: 40px 80px; }
.lost-lcd { width: min(100%, 520px); margin-inline: auto; background: var(--lcd); color: var(--lcd-ink); border-radius: 26px; padding: clamp(24px, 6vw, 44px); box-shadow: 0 0 0 10px var(--navy-deep), 0 0 0 12px rgba(255, 255, 255, .08), inset 0 0 0 2px rgba(35, 46, 26, .25), 0 30px 50px -20px rgba(13, 20, 33, .5); text-align: center; }
.lost-code { font-family: var(--dot); font-size: clamp(4.4rem, 22vw, 8rem); line-height: 1; letter-spacing: .04em; }
.lost-lcd h1 { font-family: var(--pix); font-weight: 400; letter-spacing: 0; font-size: 1.3rem; margin-top: 14px; line-height: 1.4; }
.lost-lcd p { font-family: var(--pix); font-size: .95rem; line-height: 1.7; margin-top: 12px; }
.lost-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 44px; }
.lost-code span { display: inline-block; animation: hop 2.4s var(--spring) infinite; animation-delay: calc(var(--i) * .18s); }
@keyframes hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-10px); } }

/* ---- calm mode ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .js .reveal, .js .reveal-pop { opacity: 1; transform: none; }
  .well .ripple { opacity: .5; }
  .lcd-chip .blink { animation: none; }
}
