/* EqDownload site. Same tokens as the app (docs/design/direction.md): navy, cream and amber, Unbounded and Onest,
   square corners, no rules, no shadows, no gradients. Dark only. */
@font-face { font-family: 'Unbounded'; font-weight: 800; font-display: swap; src: url('fonts/unbounded-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-weight: 400; font-display: swap; src: url('fonts/onest-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-weight: 500; font-display: swap; src: url('fonts/onest-latin-500-normal.woff2') format('woff2'); }

:root {
  --bg: #0B132B; --surface: #1C2541; --ink: #F4D6B0; --muted: #5BC0DE; --track: #3A506B;
  --accent: #D97706; --accent-ink: #0B132B; --inverse: #D97706; --inverse-ink: #0B132B;
  --font-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --font-text: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --small: 0.9375rem; --body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); --lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --head: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); --monument: clamp(2.1rem, 11.9vw, 22rem);
  --margin: clamp(1rem, 2.2vw, 2rem); --target: 3rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--body)/1.6 var(--font-text);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
h1, h2, h3, p, ul, table { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Bar: plain links, one action. */
.bar { padding: calc(env(safe-area-inset-top) + 0.75rem) var(--margin) 0; }
.bar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.25rem 1.5rem; font-size: var(--small); font-weight: 500; }
.bar a { min-height: var(--target); display: inline-flex; align-items: center; text-decoration: none; }
.bar .logo { margin-right: auto; }
.bar .logo img { display: block; width: 3.5rem; height: 3.5rem; border-radius: 22%; }
.bar a:hover { text-decoration: underline; text-underline-offset: 4px; }
.bar .action { background: var(--accent); color: var(--accent-ink); padding: 0 1.1rem; transition: transform 140ms var(--ease); }
.bar .action:hover { text-decoration: none; }
.bar .action:active { transform: scale(0.97); }

/* The monument. */
.monument { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.045em; line-height: 0.9; font-size: var(--monument); white-space: nowrap; }
.hero { position: relative; isolation: isolate; overflow: clip; padding: clamp(2.5rem, 8vh, 6rem) var(--margin) clamp(3rem, 9vh, 7rem); }
/* The Eq mark as a large, faint backdrop: part of the theme, not a picture on top of it. */
.hero::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  top: 50%; right: -6vw; width: min(78vw, 52rem); aspect-ratio: 1; transform: translateY(-46%);
  background: url(mark.png) center / contain no-repeat; opacity: 0.16;
}
.monument-text { display: inline-block; transform-origin: left bottom; }

/* The equals sign: the upper bar is the original, the lower one the copy. They fill until equal. */
.meter { margin-top: clamp(1rem, 3vw, 2.5rem); display: grid; gap: 0.75rem; }
.meter span { display: block; height: 0.75rem; background: var(--ink); transform-origin: left; }
.js .meter .bar-copy { transform: scaleX(0); animation: fill 2.4s 0.4s var(--ease) forwards; }
@keyframes fill { to { transform: scaleX(1); } }

.hero-copy { margin-top: clamp(2rem, 5vw, 4rem); max-width: 34rem; display: grid; gap: 1.25rem; }
.lead { font-size: var(--lead); line-height: 1.4; }
.note { font-size: var(--small); color: var(--muted); }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--target); padding: 0 1.5rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 500; text-decoration: none; border-radius: 0;
  transition: transform 140ms var(--ease), background-color 180ms var(--ease);
}
.button:active { transform: scale(0.97); }
.button.inverse { background: var(--inverse-ink); color: var(--inverse); }

/* Finder: one field, one action, the result below. */
.finder { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.finder input { flex: 1 1 100%; min-height: var(--target); padding: 0 1rem; background: var(--surface); color: var(--ink); border: 0; border-radius: 0; font: 400 var(--body)/1.2 var(--font-text); -webkit-appearance: none; appearance: none; }
.finder input::placeholder { color: var(--ink); opacity: 0.35; } /* an example, not text to type after */
.finder-actions { display: flex; gap: 0.75rem; flex: 1 1 100%; }
.finder-actions .button { flex: 0 0 auto; min-width: 7rem; }
.finder .button { border: 0; font: 500 var(--body)/1 var(--font-text); cursor: pointer; }
.finder .paste { background: var(--track); color: var(--ink); }
.finder .paste[hidden] { display: none; }
.result:empty { display: none; }
.result { display: grid; gap: 1rem; }
.result img { display: block; width: 100%; max-width: 22rem; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); }
.result .loader { display: grid; gap: 0.5rem; max-width: 22rem; overflow: hidden; }
.result .loader span { display: block; height: 0.5rem; background: var(--track); position: relative; overflow: hidden; }
.result .loader span::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform: translateX(-100%); animation: load 1.3s var(--ease) infinite; }
.result .loader span + span::after { animation-delay: 0.25s; }
@keyframes load { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
.result .r-links.has-photos a.button { background: var(--track); color: var(--ink); }
.result .r-links .photos { border: 0; font-family: inherit; cursor: pointer; width: 100%; max-width: 22rem; min-height: 3.5rem; font-size: var(--lead); font-weight: 700; justify-content: center; }
.result .r-hint { font-size: var(--small); color: var(--muted); max-width: 22rem; }
.result .r-title { font-size: var(--lead); line-height: 1.3; }
.result .r-links { display: grid; gap: 0.75rem; justify-items: start; }
.hero-copy a { text-underline-offset: 4px; }

/* How it works: one run-in column that starts at 30% of the width. */
.how { padding: clamp(5rem, 14vh, 12rem) var(--margin); }
.how .column { margin-left: 30%; max-width: 36rem; display: grid; gap: 1.25rem; }
.how h2, .faq h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-size: var(--head); margin-bottom: 1.75rem; }
.how p { color: var(--muted); }
.how strong { color: var(--ink); font-weight: 500; }
.how .column > p:not(:first-of-type) { margin-top: 2.5rem; }

/* Interface fragments: the product's own look, drawn at real size. */
[data-ui] { background: var(--surface); color: var(--ink); padding: 1.5rem; min-height: 13.5rem; display: grid; align-content: center; gap: 0.5rem; }
.how .field { color: var(--ink); background: var(--track); padding: 0.75rem 1rem; font-size: var(--small); }
.row { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--small); padding: 0.4rem 0; }
.row b { font-weight: 500; }
.how .go { background: var(--accent); color: var(--accent-ink); padding: 0.75rem 1rem; font-size: var(--small); font-weight: 500; text-align: center; }
.frag-title { color: var(--ink) !important; font-weight: 500; font-size: var(--body); }
.frag-sub { font-size: var(--small); color: var(--muted) !important; }
.presets { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 1rem; }
.presets span { padding: 0.5rem 1rem; background: var(--track); font-size: var(--small); font-weight: 500; }
.presets .on { background: var(--accent); color: var(--accent-ink); }
.frag-meter { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.frag-meter span { display: block; height: 0.5rem; background: var(--track); }
.frag-meter .o { background: var(--ink); }
.frag-meter .c { background: var(--track); position: relative; overflow: hidden; }
.frag-meter .c::after { content: ''; position: absolute; inset: 0 38% 0 0; background: var(--ink); }

/* Get it: a table at one size, separated by space only. */
.get { padding: clamp(4rem, 12vh, 9rem) var(--margin); background: var(--surface); }
.get table { width: 100%; border-collapse: collapse; font-size: var(--lead); line-height: 1.5; margin-bottom: 1rem; }
.get th, .get td { text-align: left; font-weight: 400; padding: 0.35em 0; vertical-align: baseline; }
.get th[scope='row'] { width: 24%; }
.get td:nth-child(2) { width: 30%; }
.get td.num { width: 14%; font-variant-numeric: tabular-nums; }
.get td:last-child { color: var(--muted); }
.get a { text-underline-offset: 6px; text-decoration-thickness: 2px; }
.get a:hover { background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.strip { position: sticky; top: 0; z-index: 2; background: var(--surface); font: 500 var(--lead)/1.5 var(--font-text); color: var(--ink); padding: 3rem 0 1.25rem; }

/* FAQ: a wide heading and indented questions. */
.faq { padding: clamp(5rem, 14vh, 12rem) var(--margin); }
.faq h2 { font-size: clamp(2.25rem, 5.5vw, 5.5rem); margin-bottom: clamp(3rem, 6vw, 5rem); }
.faq-list { margin-left: 33%; display: grid; gap: 2.25rem; }
details { position: relative; }
summary { list-style: none; cursor: pointer; font-size: var(--lead); line-height: 1.35; padding-right: 3rem; min-height: var(--target); display: flex; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ''; position: absolute; right: 0.25rem; top: 0.9em; width: 0.7rem; height: 0.7rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 240ms var(--ease); }
details[open] { background: var(--surface); padding: 1.25rem 1.5rem 1.5rem; margin: -1.25rem -1.5rem; }
details[open] summary::after { transform: rotate(-135deg); top: 1.1em; right: 0.25rem; }
details p { max-width: 48ch; font-size: var(--body); margin-top: 0.75rem; }
.hash code { font: inherit; font-variant-numeric: tabular-nums; word-break: break-all; color: var(--muted); }

/* Close: an invitation over the cropped name, in the inverse colours. */
.close { position: relative; isolation: isolate; background: var(--inverse); color: var(--inverse-ink); min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: clamp(3rem, 8vh, 6rem) var(--margin) 0; overflow: hidden; }
.close::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none; left: -8vw; bottom: 12%; width: min(60vw, 40rem); aspect-ratio: 1;
  background: var(--inverse-ink); opacity: 0.1; -webkit-mask: url(mark.png) center / contain no-repeat; mask: url(mark.png) center / contain no-repeat;
}
.close a:focus-visible { outline-color: var(--inverse-ink); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }
.linklike[hidden] { display: none; }
.close-top { display: grid; grid-template-columns: 7fr 2fr; gap: var(--margin); align-items: start; }
.invite { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-size: clamp(2.5rem, 5.5vw, 5.5rem); margin-bottom: 2rem; }
.links { list-style: none; padding: 0; display: grid; gap: 0.25rem; font-size: var(--small); }
.links a { min-height: var(--target); display: inline-flex; align-items: center; }
.credits { align-self: end; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: var(--small); padding-bottom: 1rem; }
.footer-name { margin: 0; padding-bottom: clamp(1.5rem, 4vw, 3.5rem); }

/* Motion: scroll-linked wordmark, staggered entrances. Content stays visible without script. */
@supports (animation-timeline: scroll()) {
  .monument-text { animation: weigh linear both; animation-timeline: scroll(root); animation-range: 0 60vh; }
  @keyframes weigh { to { transform: scale(0.94); } }
}
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

@media (max-width: 760px) {
  .bar nav { justify-content: space-between; }
  .bar nav { gap: 0.25rem 1rem; }
  .how .column { margin-left: 0; max-width: none; }
  .faq-list { margin-left: 0; }
  .faq h2 { font-size: 10vw; }
  .close-top { grid-template-columns: 1fr; }
  .invite { font-size: 10vw; }
  .get table, .get tbody, .get tr, .get th, .get td { display: block; width: auto !important; }
  .get tr { margin-bottom: 1.1rem; }
  .get th[scope='row'] { font-size: var(--lead); }
  .get td { font-size: var(--small); display: inline; margin-right: 0.75rem; }
  .get td:first-of-type { font-size: var(--body); }
  .strip { font-size: var(--lead); padding-top: 2rem; }
  details[open] { margin: -1rem calc(-1 * var(--margin)); padding: 1rem var(--margin) 1.25rem; }
  .footer-name { padding-bottom: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .result .loader span::after { animation: none; transform: none; opacity: 0.6; }
  html { scroll-behavior: auto; }
  .monument-text { animation: none; }
  .js .meter .bar-copy { animation: none; transform: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  summary::after, .button, .bar .action { transition: none; }
}

/* The Ko-fi tip link: Ko-fi's coral with dark text (7:1), same size as the GitHub button beside it. */
.bar .action.tip { background: #FF5E5B; color: #000; }

/* Bar on any width: logo and the two buttons on the first line, the text links on their own line when space is short. */
.bar .menu { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
@media (max-width: 47.99rem) {
  .bar nav { gap: 0.25rem 0.75rem; }
  .bar .menu { order: 3; flex: 1 0 100%; justify-content: space-between; gap: 0.25rem 1rem; }
  .finder-actions .button { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 22.5rem) {
  .bar .logo img { width: 3rem; height: 3rem; }
  .bar .action { padding: 0 0.75rem; }
}
