/* cowmoney.app's shared layout, on the COW Money design system: tokens.css holds its values and type styles,
   components.css its components (cow-…), and this file arranges them. Every page loads it: the basics, the brand, the
   footer, the reading pages (FAQ, How safe to spend works, Envelope budgeting, About, the press kit, Security, Support,
   the Privacy Policy and the Terms of Use) and the small pages. The
   home page adds home.css and home.js (index.html only). Every color, space, corner and type size is a token (AGENTS.md).
   Pages carry no inline styles or scripts, so the Content-Security-Policy in _headers can refuse anything that doesn't
   come from this site. */

/* Basics */
:root {
  color-scheme: light dark;
  --gx: max(var(--space-20), env(safe-area-inset-left), env(safe-area-inset-right));
  --header: calc(64px + env(safe-area-inset-top));
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header); }
body { margin: 0; background: var(--canvas); color: var(--ink); font: var(--type-body-long);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
h1, h2, h3, p, figure, ul { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: var(--size-page); margin: 0 auto; padding-left: var(--gx); padding-right: var(--gx); }
/* The design system's rule for ledes: muted. */
.lede { color: var(--muted); text-wrap: pretty; }

/* The brand, in every header and footer */
.brand { display: inline-flex; align-items: center; gap: var(--space-10); color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { width: 32px; height: 32px; border-radius: var(--radius-small); }
.tagline { color: var(--muted); }
/* What COW stands for, left out where it would push the page sideways */
@media (max-width: 359px) { .tagline { display: none; } }

/* The free beta through TestFlight, until launch: the FAQ's closing note and the home page (owner, October 13, 2026).
   Its button is hay with hay-ink text and a soft hay glow (the design system's primary is ink); on light grounds hay
   is only ever a fill behind ink text. The home page adds a sheen. */
.beta-note { margin-top: var(--space-8); color: var(--muted); }
.btn-hay { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-capsule);
  background-color: var(--hay); color: var(--hay-ink); text-decoration: none; white-space: nowrap;
  box-shadow: 0 14px 34px -12px color-mix(in oklab, var(--hay) 72%, transparent);
  transition: transform .3s var(--ease-out), box-shadow .3s ease; }
.btn-hay:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -12px color-mix(in oklab, var(--hay) 82%, transparent); }
.btn-hay:active { opacity: var(--opacity-pressed); }

/* Footer, on every page. Every link is a 44px target: each gets the same padding (the list's negative margin keeps
   the words lined up with the page). The links sit in tidy columns: four across (two rows of four), two on phones. */
.site-footer { padding: var(--space-48) 0 calc(env(safe-area-inset-bottom) + var(--space-48)); border-top: 1px solid var(--border);
  color: var(--muted); }
.site-footer .brand { min-height: var(--size-tap); }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-16) var(--space-32); }
.footer-links { display: grid; grid-template-columns: repeat(4, max-content); column-gap: var(--space-8); margin: 0 calc(-1 * var(--space-8)); }
.footer-links a { display: inline-flex; align-items: center; min-height: var(--size-tap); padding: 0 var(--space-8); color: var(--muted);
  text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 599px) {
  .footer-links { grid-template-columns: repeat(2, minmax(0, max-content)); gap: var(--space-4) var(--space-16); }
}
.legal { display: grid; gap: 6px; margin-top: var(--space-24); }

/* Pages of reading: FAQ, How safe to spend works, Envelope budgeting, About, Security, Support, the Privacy Policy
   and the Terms of Use. Header, text and footer share the reading width. */
.doc-header .wrap, .doc-header ~ .site-footer .wrap { max-width: var(--size-reading); }
.doc-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); min-height: 76px; }
.doc-header .brand { min-height: var(--size-tap); }
.doc-nav { display: flex; gap: var(--space-2); }
.doc-nav a { display: inline-flex; align-items: center; min-height: var(--size-tap); padding: 0 var(--space-10); border-radius: var(--radius-small);
  color: var(--muted); font-weight: 500; text-decoration: none; }
.doc-nav a:hover, .doc-nav a[aria-current="page"] { color: var(--ink); background: var(--inset); }
/* Phones keep FAQ and Support in the header (Support is the App Store's support link); the footer has every page. */
@media (max-width: 479px) { .doc-nav a[href="/security"] { display: none; } }
@media (max-width: 339px) { .doc-nav a[href="/support"] { display: none; } }
.doc { max-width: var(--size-reading); margin: 0 auto; padding: var(--space-8) var(--gx) var(--space-64); }
.doc h1 { margin: var(--space-24) 0 var(--space-8); font: var(--type-section-title); letter-spacing: var(--type-section-title-tracking);
  text-wrap: balance; }
@media (max-width: 719px) { .doc h1 { font: var(--type-title-1); letter-spacing: normal; } }
.doc h2 { margin: var(--space-32) 0 var(--space-10); font: var(--type-title-2); }
.doc p, .doc li { margin: 0 0 var(--space-10); }
.doc ul { margin: 0 0 var(--space-12); padding-left: var(--space-24); }
.doc li > ul { margin: var(--space-8) 0 0; }
.doc > .lede { margin-bottom: var(--space-8); }
.doc .effective { margin-bottom: var(--space-24); color: var(--muted); }
.doc .path { font-weight: 600; }
.contact { display: flex; align-items: center; gap: var(--space-16); margin: var(--space-24) 0 var(--space-8); padding: var(--space-18) var(--space-20);
  border-radius: var(--radius-card); background: var(--inset); }
.contact img { flex: none; width: 56px; height: 56px; }
.doc .contact p { min-width: 0; margin: 0; text-wrap: pretty; }
/* The address can break rather than push the page sideways, but Cash goes above the words where it wouldn't fit beside
   him, so it stays on one line and never runs past the card. */
.contact a { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 374px) { .contact { flex-direction: column; align-items: flex-start; } }
.doc-cta { margin-top: var(--space-48); padding: var(--space-24); border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); }
.doc .doc-cta h2 { margin: 0 0 var(--space-4); }
.doc .doc-cta > p { margin: 0; color: var(--muted); }
.doc-cta .beta { margin-top: var(--space-20); }
.doc-cta .beta-note { margin: var(--space-8) 0 0; }

/* What COW Money can and can't do, at the top of Security: the home page's trust cards, calm on the reading page.
   Surface cards on the canvas, a check on mint for each thing it can do and a cross on inset for each it can't. */
.can-cant { display: grid; gap: var(--space-12); margin: var(--space-24) 0 var(--space-8); }
@media (min-width: 600px) { .can-cant { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.can-card { padding: var(--space-16) var(--space-20) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); }
.can-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); padding-bottom: var(--space-10); }
.doc .can-head h2 { margin: 0; font: var(--type-headline); }
.can-badge, .can-mark { flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.can-badge { color: var(--muted); }
.can-yes .can-badge { color: var(--green); }
.doc .can-card ul { margin: 0; padding: 0; list-style: none; }
.doc .can-card li { display: flex; align-items: flex-start; gap: var(--space-12); margin: 0; padding: var(--space-12) 0;
  border-top: 1px solid var(--border); }
.can-mark { width: var(--space-24); height: var(--space-24); margin-top: 1px; padding: var(--space-4); border-radius: var(--radius-capsule);
  stroke-width: 2.4; }
.can-yes .can-mark { background: var(--mint); color: var(--green); }
.can-no .can-mark { background: var(--inset); color: var(--ink); }

/* Worked examples on the guides: pieces of Home drawn with the design system's components (SafeToSpendCard, Card
   with AmountRows, EnvelopeRows), straight on the canvas. Their numbers are the home page's and its screenshots'
   (README). */
.example { display: grid; gap: var(--space-10); margin: var(--space-20) 0 var(--space-24); }
.example-col { display: grid; align-content: start; gap: var(--space-10); min-width: 0; }
.example .cow-sts { box-shadow: var(--shadow-float); }
.doc .example-title { margin: var(--space-14) 0 0; }
.doc .example-envelopes { display: grid; gap: var(--space-8); margin: 0; padding: 0; list-style: none; }
.doc .example-envelopes li { margin: 0; }
.example-envelopes-only { max-width: var(--size-app-column); }
@media (min-width: 640px) {
  .example-home { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto 1fr; column-gap: var(--space-20); }
  .example-home > .example-col:last-of-type { grid-column: 2; grid-row: 1 / 3; }
  .doc .example-home .example-title { margin-top: 0; }
}

/* Numbered steps (Envelope budgeting): each number on a mint circle, as the app marks what's done. */
.doc .steps { display: grid; gap: var(--space-14); margin: var(--space-16) 0 var(--space-12); padding: 0; list-style: none;
  counter-reset: step; }
.doc .steps li { position: relative; margin: 0; padding-left: calc(var(--space-32) + var(--space-14)); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -3px; display: grid; place-items: center;
  width: var(--space-32); height: var(--space-32); border-radius: var(--radius-capsule); background: var(--mint); color: var(--green);
  font: var(--type-headline); }

/* Facts for the press (the press kit): a card of label and fact rows, the labels beside the facts where there's room. */
.facts { margin: var(--space-12) 0 var(--space-16); border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); }
.facts > div { display: grid; gap: var(--space-2); padding: var(--space-12) var(--space-18); }
.facts > div + div { border-top: 1px solid var(--border); }
.facts dt { font: var(--type-headline); }
.facts dd { margin: 0; color: var(--muted); }
@media (min-width: 640px) {
  .facts > div { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); align-items: baseline; gap: var(--space-16); }
}

/* The press kit's screenshots (Press): each screen in the home page's iPhone drawn in CSS, at thumbnail size, with its
   name and its light and dark downloads under it. Two across on phones, three from 600px. Each phone is as wide as its
   column, and its padding and corners follow that width (cqi), in the home page's proportions. */
.doc .shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-24) var(--space-16);
  margin: var(--space-16) 0 var(--space-24); padding: 0; list-style: none; }
@media (min-width: 600px) { .doc .shots { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-32) var(--space-24); } }
.doc .shots li { container-type: inline-size; margin: 0; }
.shot-phone { padding: 3cqi; border-radius: 16.5cqi;
  background: linear-gradient(150deg, color-mix(in oklab, var(--scrim), var(--milk) 26%) 0%, var(--scrim) 22%, var(--scrim) 78%,
    color-mix(in oklab, var(--scrim), var(--milk) 16%) 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--milk) 24%, transparent), 0 0 0 1px color-mix(in srgb, var(--scrim) 70%, transparent),
    var(--shadow-lift-soft); }
.shot-screen { display: block; overflow: hidden; border-radius: 13.6cqi; aspect-ratio: 1206 / 2622; background: var(--canvas); }
.shot-screen img { width: 100%; height: 100%; object-fit: cover; }
.doc .shot-name { margin: var(--space-14) 0 0; text-align: center; }
.doc .shot-files { display: flex; justify-content: center; gap: var(--space-4); margin: 0; }
.shot-files a { display: inline-flex; align-items: center; min-height: var(--size-tap); padding: 0 var(--space-8); font-weight: 600; }

/* Questions and answers */
.faq-group { margin-top: var(--space-8); border-top: 1px solid var(--border); }
details { border-bottom: 1px solid var(--border); }
summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); padding: var(--space-18) 0;
  cursor: pointer; list-style: none; font: var(--type-headline); }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; flex: none; width: 28px; height: 28px; border-radius: var(--radius-capsule); transition: transform .2s ease;
  background: linear-gradient(var(--ink), var(--ink)) center / 11px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 2px 11px no-repeat, var(--inset); }
details[open] > summary::after { transform: rotate(45deg); }
.answer { padding: 0 44px var(--space-20) 0; color: var(--muted); }
.answer p + p { margin-top: var(--space-10); }
/* Questions open and close smoothly where the browser can animate to the answer's height. */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details::details-content { block-size: 0; overflow-y: clip; transition: block-size .3s var(--ease-out), content-visibility .3s allow-discrete; }
  details[open]::details-content { block-size: auto; }
}

/* Small pages: not found and Plaid's return page */
.note-page { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: var(--space-32) var(--space-20); text-align: center; }
.note-page main { max-width: 420px; }
.note-page img { width: 96px; height: 96px; margin: 0 auto; }
.note-page h1 { margin: var(--space-20) 0 var(--space-10); font: var(--type-title-1); }
.note-page p { margin: 0 0 var(--space-14); color: var(--muted); }
.note-page a { font-weight: 600; }
