/*
  Grainwork web design system.
  One look for grainwork.app, the sales pages, the demos and the signed-out
  product landings. It follows the phone app: warm bone paper, deep forest
  green, Source Serif 4 for headings and the device's own sans for reading.
  Page files add layout only; colours, type and components live here.
*/

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-web.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Surfaces */
  --paper: #f9f5ed;
  --paper-raised: #fffefa;
  --kraft: #ede7da;
  --line: #e4ded2;
  --line-strong: #d3cbbb;
  --line-control: #8a8170;
  --forest-deep: #183b31;
  --forest-deep-raised: #1f463a;

  /* Text */
  --ink: #26241f;
  --heading: #1e3a2f;
  --muted: #5f594e;
  --faint: #6b6557;
  --on-dark: #f4efe4;
  --on-dark-muted: #b9c4b6;

  /* Accent and states */
  --accent: #2f5d43;
  --accent-hover: #264d37;
  --on-accent: #faf7f2;
  --accent-wash: #e3eadf;
  --ochre: #8f6a1f;
  --ochre-wash: #f3ead3;
  --ochre-text: #77581a;
  --brick: #a8412f;
  --focus: #2f5d43;
  --focus-on-dark: #f4efe4;

  /* Type */
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-display: clamp(2.75rem, 1.6rem + 4.2vw, 4.75rem);
  --text-h1: clamp(2.375rem, 1.6rem + 2.9vw, 3.75rem);
  --text-h2: clamp(1.875rem, 1.4rem + 1.7vw, 2.75rem);
  --text-h3: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  --text-h4: 1.125rem;
  --text-lede: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --text-body: 1.0625rem;
  --text-small: 0.9375rem;
  --text-caption: 0.875rem;
  --text-eyebrow: 0.8125rem;

  /* Space and shape */
  --gutter: clamp(20px, 5vw, 56px);
  --max: 1200px;
  --max-text: 40rem;
  --section: clamp(72px, 9vw, 128px);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 1px 2px rgba(38, 36, 31, 0.05), 0 12px 32px -18px rgba(38, 36, 31, 0.28);
  --header-height: 68px;

  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-body)/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
video,
svg { display: block; max-width: 100%; }
img,
video { height: auto; }

h1, h2, h3,
.display {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  color: var(--heading);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.display { font-size: var(--text-display); line-height: 1.03; letter-spacing: -0.025em; }
h1 { font-size: var(--text-h1); line-height: 1.06; letter-spacing: -0.022em; }
h2 { font-size: var(--text-h2); line-height: 1.12; }
h3 { font-size: var(--text-h3); line-height: 1.2; letter-spacing: -0.01em; }
h4 {
  margin: 0;
  font: 600 var(--text-h4)/1.35 var(--sans);
  color: var(--ink);
}
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 1em; }

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

strong { font-weight: 620; }

.eyebrow {
  display: block;
  margin: 0 0 16px;
  font: 600 var(--text-eyebrow)/1.3 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede {
  font-size: var(--text-lede);
  line-height: 1.5;
  color: var(--muted);
  max-width: var(--max-text);
}
.small { font-size: var(--text-small); }
.caption {
  font-size: var(--text-caption);
  line-height: 1.5;
  color: var(--faint);
}
.muted { color: var(--muted); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: 12px;
  transform: translateY(calc(-100% - 24px));
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--forest-deep);
  color: var(--on-dark);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { transform: none; color: var(--on-dark); }

/* Layout */
.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap--narrow { max-width: calc(46rem + 2 * var(--gutter)); }
.section { padding: var(--section) 0; }
.section--tight { padding: calc(var(--section) * 0.6) 0; }
.section + .section { padding-top: 0; }
.section--rule { border-top: 1px solid var(--line); }
.section--rule + .section { padding-top: var(--section); }
.section--raised { background: var(--paper-raised); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section--raised + .section,
.section + .section--raised,
.band + .section,
.section + .band { padding-top: var(--section); }
.section-head { max-width: 46rem; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2 + .lede,
.section-head h2 + p { margin-top: 18px; }
.stack > * + * { margin-top: 20px; }

.grid { display: grid; gap: clamp(20px, 3vw, 32px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}
.split--text-wide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
@media (max-width: 900px) {
  .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .split, .split--text-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(249, 245, 237, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: var(--header-height);
}
.site-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 44px;
  color: var(--heading);
}
.site-logo img,
.site-logo svg { width: 132px; height: auto; }
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.site-nav a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { background: var(--kraft); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
.site-nav .site-nav__signin {
  margin-left: 8px;
  border: 1px solid var(--line-control);
  border-radius: 999px;
  padding: 9px 18px;
}
.site-menu { display: none; margin-left: auto; }
.site-menu > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-control);
  border-radius: 999px;
  font-size: var(--text-small);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.site-menu > summary::-webkit-details-marker { display: none; }
.site-menu > summary::after { content: ""; width: 14px; height: 10px; background:
  linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
  linear-gradient(currentColor, currentColor) 0 50% / 100% 1.5px no-repeat,
  linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px no-repeat; }
.site-menu[open] > summary::after { background:
  linear-gradient(45deg, transparent calc(50% - 0.75px), currentColor calc(50% - 0.75px), currentColor calc(50% + 0.75px), transparent calc(50% + 0.75px)),
  linear-gradient(-45deg, transparent calc(50% - 0.75px), currentColor calc(50% - 0.75px), currentColor calc(50% + 0.75px), transparent calc(50% + 0.75px)); height: 14px; }
.site-menu__panel {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  padding: 8px var(--gutter) 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 40px -28px rgba(38, 36, 31, 0.4);
}
.site-menu__panel a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: none;
}
.site-menu__panel a::after { content: "→"; color: var(--faint); }
.site-menu__panel .button { margin-top: 20px; width: 100%; justify-content: center; border-bottom: 1px solid var(--line-control); }
.site-menu__panel .button::after { content: none; }
@media (max-width: 1120px) {
  .site-nav { display: none; }
  .site-menu { display: block; }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button--secondary { background: transparent; color: var(--accent); border-color: var(--line-control); }
.button--secondary:hover { background: var(--paper-raised); color: var(--accent-hover); border-color: var(--accent); }
.button--light { background: var(--on-dark); color: var(--forest-deep); border-color: var(--on-dark); }
.button--light:hover { background: #fff; color: var(--forest-deep); border-color: #fff; }
.button--ghost-light { background: transparent; color: var(--on-dark); border-color: rgba(244, 239, 228, 0.4); }
.button--ghost-light:hover { background: rgba(244, 239, 228, 0.08); color: var(--on-dark); border-color: var(--on-dark); }
.button--small { min-height: 44px; padding: 0 18px; font-size: var(--text-small); }
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 32px;
}
.actions .note,
.actions__note { flex-basis: 100%; margin-top: 4px; padding: 0; border: 0; border-radius: 0; background: none; font-size: var(--text-caption); color: var(--faint); }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.text-link::after { content: "→"; transition: transform 0.15s ease; }
.text-link:hover::after { transform: translateX(3px); }
.text-link--external::after { content: "↗"; }

/* Store badges */
.store-links { display: flex; flex-wrap: wrap; gap: 12px; }
.store-link {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 6px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  line-height: 1.15;
}
.store-link:hover { background: #000; color: #fff; }
.store-link small { font-size: 0.8125rem; opacity: 0.85; }
.store-link span { font-size: 1.0625rem; font-weight: 600; }

/* Status labels: what exists today versus what is being built */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font: 600 0.8125rem/1.2 var(--sans);
  background: var(--accent-wash);
  color: var(--accent);
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--building { background: var(--ochre-wash); color: var(--ochre-text); }
.status--vision { background: var(--kraft); color: var(--muted); }
.status--vision::before { background: transparent; border: 1.5px solid currentColor; width: 6px; height: 6px; }

/* Cards and panels */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
}
.card h3 { font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.625rem); }
.card p { color: var(--muted); }
.card .text-link { margin-top: auto; padding-top: 8px; }
.card--link { text-decoration: none; color: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.card--link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.card--link:hover .text-link::after { transform: translateX(3px); }
.card__audience {
  font: 600 var(--text-eyebrow)/1.3 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.panel {
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--radius-lg);
  background: var(--kraft);
}

/* Lists */
.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li {
  position: relative;
  padding: 14px 0 14px 32px;
  border-top: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: 1px solid var(--line); }
.checklist li::before {
  content: "";
  position: absolute;
  left: 2px; top: 21px;
  width: 14px; height: 8px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.checklist strong { display: block; color: var(--ink); }
.checklist span { color: var(--muted); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: clamp(20px, 3vw, 32px); }
.steps--row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steps li { counter-increment: step; padding-top: 20px; border-top: 1px solid var(--line-strong); }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 14px;
  font: 500 0.9375rem/1 var(--serif);
  color: var(--accent);
}
.steps h3 { font-size: 1.375rem; margin-bottom: 10px; }
.steps p { color: var(--muted); }
@media (max-width: 900px) { .steps--row { grid-template-columns: minmax(0, 1fr); } }

/* Media */
.media {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--kraft);
}
.media img,
.media video { width: 100%; }
.media-caption { margin-top: 12px; font-size: var(--text-caption); color: var(--faint); }

.phone {
  position: relative;
  width: min(100%, 300px);
  margin: 0 auto;
  padding: 10px;
  border-radius: 44px;
  background: #16181a;
  box-shadow: 0 30px 60px -30px rgba(24, 59, 49, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.phone img,
.phone video { width: 100%; border-radius: 34px; }

/* Dark band */
.band {
  background: var(--forest-deep);
  color: var(--on-dark);
  padding: var(--section) 0;
}
.band h2,
.band h3,
.band .display { color: var(--on-dark); }
.band p,
.band .lede { color: var(--on-dark-muted); }
.band .eyebrow { color: var(--on-dark-muted); }
.band a:not(.button) { color: var(--on-dark); }
.band :focus-visible,
.site-footer :focus-visible { outline-color: var(--focus-on-dark); }

/* Quote */
.quote {
  margin: 0;
  padding-left: 24px;
  border-left: 2px solid var(--accent);
}
.quote p { font: 500 var(--text-h3)/1.35 var(--serif); color: var(--heading); }
.quote cite { display: block; margin-top: 14px; font-style: normal; font-size: var(--text-small); color: var(--muted); }

/* Notes: honest limits, stated plainly instead of in fine print */
.note {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-size: var(--text-small);
  color: var(--ink);
}
.note strong { display: block; margin-bottom: 4px; }
.note--limit { background: var(--kraft); border-left-color: var(--line-control); color: var(--muted); }
.note--caution { background: var(--ochre-wash); border-left-color: var(--ochre); }
.note--caution strong { color: var(--ochre-text); }

/* FAQ */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  font: 560 1.25rem/1.35 var(--serif);
  color: var(--heading);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.5rem/1 var(--sans); color: var(--accent); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 0 24px; max-width: var(--max-text); color: var(--muted); }

/* Long-form text: support and legal pages */
.prose { max-width: 44rem; }
.prose h1 { margin-bottom: 12px; }
.prose h2 { margin: 2.2em 0 0.6em; font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem); }
.prose h3 { margin: 1.8em 0 0.5em; font-size: 1.25rem; }
.prose p,
.prose li { color: var(--ink); }
.prose p + p { margin-top: 1em; }
.prose ul,
.prose ol { padding-left: 1.3em; margin: 1em 0; }
.prose li + li { margin-top: 0.5em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: var(--text-small); }
.prose th,
.prose td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.prose .updated { color: var(--faint); font-size: var(--text-small); }
.toc {
  margin: 32px 0 8px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--kraft);
}
.toc strong { display: block; margin-bottom: 8px; font-size: var(--text-small); }
.toc ol { margin: 0; padding-left: 1.2em; columns: 2 16rem; column-gap: 32px; font-size: var(--text-small); }
.toc li { break-inside: avoid; margin: 4px 0; }

/* Page hero */
.hero { padding: clamp(48px, 7vw, 104px) 0 clamp(48px, 6vw, 88px); }
.hero .lede { margin-top: 24px; }
.hero__media { margin-top: clamp(40px, 6vw, 72px); }
.hero__media.media { border-radius: var(--radius-xl); }

/* Footer */
.site-footer {
  margin-top: 0;
  padding: clamp(56px, 7vw, 88px) 0 40px;
  background: var(--forest-deep);
  color: var(--on-dark-muted);
  font-size: var(--text-small);
}
.site-footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(244, 239, 228, 0.14);
}
.site-footer .site-logo { color: var(--on-dark); }
.site-footer__tagline { margin-top: 16px; max-width: 22rem; color: var(--on-dark-muted); }
.site-footer .footer-heading {
  margin: 0 0 14px;
  font: 600 var(--text-eyebrow)/1.3 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark);
}
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li + li { margin-top: 2px; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 32px; }
@media (max-width: 860px) {
  .site-footer li + li { margin-top: 0; }
  .site-footer li a { min-height: 44px; }
}
.site-footer a { color: var(--on-dark-muted); text-decoration: none; }
.site-footer a:hover { color: var(--on-dark); text-decoration: underline; }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 24px;
  font-size: var(--text-caption);
}
@media (max-width: 860px) {
  .site-footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__brand { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; }
}
