/* Furrow legal site. Tokens mirror DESIGN.md ("Linen & Madder"). No external requests. */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader_400Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F3ECE0;
  --paper-raised: #F8F2E8;
  --ink: #221C17;
  --ink-soft: #6B5E52;
  --hairline: #DCD2C3;
  --accent: #9C3B28;
  --mark: #E5D1B5;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Type scale: one step per role */
  --t-display: clamp(2.625rem, 1.55rem + 4.1vw, 4.5rem);
  --t-h2: clamp(2.125rem, 1.6rem + 2vw, 3rem);
  --t-h3: clamp(1.5rem, 1.3rem + 0.7vw, 1.75rem);
  --t-lede: clamp(1.3125rem, 1.2rem + 0.4vw, 1.5rem);
  --t-body: 1.125rem;
  --t-small: 0.9375rem;

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  --side: clamp(1.25rem, 0.6rem + 3vw, 3rem);
  --bar-h: 3.75rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2A2019;
    --paper-raised: #33281F;
    --ink: #EFE6D8;
    --ink-soft: #B3A595;
    --hairline: #46382E;
    --accent: #D6735A;
    --mark: #4A3628;
  }
}

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

html {
  background: var(--paper);
  color: var(--ink);
  scroll-padding-top: calc(var(--bar-h) + 3rem); /* room for the bar when large text wraps it onto two lines */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 18%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word; /* long links and the support address wrap on small phones */
}

/* 4% paper grain over everything, both themes (as in the app) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: url("img/grain.png") repeat;
  background-size: 256px 256px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 50;
}

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

::selection { background: var(--mark); color: var(--ink); }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 160ms ease-out;
}
a:hover { text-decoration-thickness: 3px; }
a:focus-visible,
.skip:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: var(--side);
  top: 0;
  transform: translateY(-120%); /* hidden by its own height, so it stays hidden however large the text is */
  z-index: 60;
  background: var(--paper-raised);
  padding: 0.6rem 1rem;
  border-radius: 14px;
}
.skip:focus { transform: translateY(0.75rem); }

/* ---------- Top bar, with the furrow line that draws as you read ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--bar-h);
  flex-wrap: wrap; /* with very large text the links drop under the name instead of running off the screen */
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  padding: 0.375rem var(--side);
  background: var(--paper);
}
/* The track the furrow draws along: the app's own furrow component is a 1pt track plus the hand-drawn
   stroke (mobile/src/onboarding/Furrow.tsx), so this line is the motif, not a divider. */
.bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px; /* taste-skill-ignore: the furrow line's track (DESIGN.md "Furrow line") */
  background: var(--hairline);
}
.furrow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px; /* inside the bar, just above its track, so it never crosses the text scrolling under it */
  height: 9px;
  overflow: hidden;
  pointer-events: none;
  display: none;
}
.furrow-in {
  position: absolute;
  inset: 0;
  background: var(--accent);
  -webkit-mask: url("img/furrow.png") center / 100% 100% no-repeat;
  mask: url("img/furrow.png") center / 100% 100% no-repeat;
}
@supports (animation-timeline: scroll()) {
  .furrow { display: block; animation: furrow-out linear both; animation-timeline: scroll(root block); }
  .furrow-in { animation: furrow-in linear both; animation-timeline: scroll(root block); }
}
@keyframes furrow-out { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes furrow-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

.wordmark {
  font-family: var(--serif);
  font-size: var(--t-h3);
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.bar nav { display: flex; gap: 0.25rem; margin: 0 -0.75rem; }
.bar nav a {
  font-size: var(--t-small);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 14px;
}
.bar nav a:hover { color: var(--accent); }
.bar nav a:active, .foot-links a:active { transform: translateY(1px); }
.bar nav a, .foot-links a { transition: color 160ms ease-out, transform 120ms ease-out; }
@media (max-width: 359px) {
  .bar nav a { padding: 0 0.5rem; }
  .bar nav { margin: 0 -0.5rem; }
  .bar { column-gap: 0.5rem; }
}
/* With very large text (or the page zoomed) the three links no longer fit on one row: they wrap,
   and the bar scrolls away with the page instead of covering a third of the screen.
   Measured: the links need about 15rem of width, so the query is in rem and follows the text size. */
body { container: page / inline-size; }
@container page (max-width: 15.5rem) {
  .bar { position: relative; } /* not sticky, but still the frame the furrow line and its track sit in */
  .bar nav { flex-wrap: wrap; }
}
/* The largest text on the smallest phone (under about 12rem of width) left words like "subscription"
   wider than the line. Narrower side margins there give them room, so no word splits. */
@container page (max-width: 12rem) {
  body > * { --side: 0.75rem; }
}
/* A phone on its side has little height: let the bar scroll away instead of taking a sixth of it */
@media (orientation: landscape) and (max-height: 500px) {
  .bar { position: relative; } /* not sticky, but still the frame the furrow line and its track sit in */
  html { scroll-padding-top: 1.5rem; }
}

/* ---------- Intro ---------- */

main { display: block; }

.intro {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 1.5rem + 4vw, 5.5rem) var(--side) clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
  display: grid;
  gap: 2rem;
  align-items: center;
}
.intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: min(var(--t-display), 21vw); /* the cap only bites at very large text on a small phone, where "Privacy," would run off the screen */
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0 0 1.25rem;
  max-width: 11ch;
  text-wrap: balance;
}
.lede {
  font-size: var(--t-lede);
  line-height: 1.45;
  margin: 0 0 1.25rem;
  max-width: 30ch;
  text-wrap: pretty;
}
.meta {
  font-size: var(--t-small);
  color: var(--ink-soft);
  margin: 0;
  max-width: 44ch;
}
.intro-art { margin: 0; justify-self: center; width: min(100%, 26rem); }
/* The torn paper edge only reads on light paper (DESIGN.md, the read-along finish block): in dark mode
   the painting is cropped inside its frame. This picture's torn edge runs about 11% deep on each side
   (measured from its alpha), so it takes 130% here, against the app's 112% for its own vignette. */
@media (prefers-color-scheme: dark) {
  .intro-art {
    position: relative;
    overflow: hidden;
    /* the crop's edges fade into the dark paper instead of stopping on a line */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent), linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent); /* taste-skill-ignore */
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent), linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent); /* taste-skill-ignore */
    mask-composite: intersect;
  }
  .intro-art img { scale: 1.3; }
  /* DESIGN.md: dark mode lays 12% of the dark paper over the art, multiplied */
  .intro-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #2A2019;
    opacity: 0.12;
    mix-blend-mode: multiply;
    pointer-events: none;
  }
}

@media (min-width: 760px) {
  .intro { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2rem, 4vw, 5rem); }
  .intro-art { justify-self: end; width: 100%; max-width: 32rem; }
}

/* ---------- Page layout: contents + reading column ---------- */

.layout {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--side) 4rem;
}
.toc { display: none; }

@media (min-width: 1024px) {
  .layout {
    display: grid;
    grid-template-columns: 14rem minmax(0, 42rem);
    gap: clamp(3rem, 6vw, 7rem);
  }
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--bar-h) + 2.5rem);
    align-self: start;
    font-size: var(--t-small);
    line-height: 1.4;
    padding-top: 0.5rem;
  }
  .toc-head { margin: 0 0 0.25rem; font-weight: 600; }
  .toc-head a { text-decoration: none; display: flex; align-items: center; min-height: 44px; }
  .toc ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
  .toc li { padding-left: 0; }
  .toc li a {
    color: var(--ink-soft);
    text-decoration: none;
    display: flex;
    align-items: center;
    min-height: 44px;
  }
  .toc a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
}

.doc { max-width: 42rem; min-width: 0; }

/* ---------- Text ---------- */

section + section { margin-top: clamp(4.5rem, 3rem + 5vw, 7.5rem); }

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin: 0 0 1.75rem;
}
/* A short hand-drawn furrow above each part, the way the app marks progress */
h2::before {
  content: "";
  display: block;
  width: 7.5rem;
  height: 14px;
  margin-bottom: 1.25rem;
  background: var(--accent);
  -webkit-mask: url("img/furrow.png") left center / 100% 100% no-repeat;
  mask: url("img/furrow.png") left center / 100% 100% no-repeat;
}

h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h3);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 3rem 0 0.875rem;
}
h4 {
  font-size: var(--t-body);
  font-weight: 600;
  line-height: 1.4;
  margin: 2rem 0 0.5rem;
}
h3 + h4 { margin-top: 1.25rem; }

p, ul { margin: 0 0 1rem; }
ul { padding-left: 1.25rem; }
li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
li::marker { color: var(--ink-soft); }
strong { font-weight: 600; }

/* The short version: one raised block on top of each part */
.short {
  background: var(--paper-raised);
  border-radius: 20px;
  padding: clamp(1.375rem, 1rem + 1.4vw, 2rem);
  margin: 0 0 2.5rem;
}
.short-head,
.contact-head {
  font-family: var(--serif);
  font-size: var(--t-lede);
  line-height: 1.25;
  margin: 0 0 1rem;
}
.short ul { list-style: none; padding: 0; margin: 0; }
.short li {
  position: relative;
  padding: 0 0 0 1.75rem;
  margin: 0 0 0.875rem;
}
.short li:last-child { margin-bottom: 0; }
.short li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 0.875rem;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

/* Plans table */
.plans {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 1.75rem;
  font-variant-numeric: tabular-nums;
}
.plans caption {
  text-align: left;
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink-soft);
  padding-bottom: 0.5rem;
}
.plans th, .plans td {
  text-align: left;
  vertical-align: top;
  padding: 0.875rem 1rem 0.875rem 0;
  border-bottom: 1px solid var(--hairline);
}
.plans thead th {
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink-soft);
  padding-top: 0;
}
.plans tbody th { font-weight: 600; }
.plans td:last-child, .plans th:last-child { padding-right: 0; }
@media (max-width: 420px) {
  .plans th, .plans td { padding-right: 0.625rem; }
}
/* When the column is narrow for the text size (a small phone with large text), each plan becomes
   its own short block instead of three squeezed columns. The em is the column's own text size. */
.doc { container-type: inline-size; }
@container (max-width: 15em) {
  .plans thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .plans, .plans caption, .plans tbody, .plans tr, .plans th, .plans td { display: block; } /* the caption too, or it shrinks to one word a line */
  .plans tr { padding: 0.875rem 0; border-bottom: 1px solid var(--hairline); }
  .plans th, .plans td { border: 0; padding: 0; }
  .plans td:last-child::before { content: "Free trial: "; color: var(--ink-soft); }
  /* The boxed short version would leave a few letters a line: the box runs edge to edge and the dash
     indent shrinks, so its text is as wide as the rest of the page and words stay whole. */
  .short { margin-inline: calc(-1 * var(--side)); border-radius: 0; padding-inline: var(--side); }
  .short li { padding-left: 1.125rem; }
  .short li::before { width: 0.5rem; }
}

/* Placeholders only Dev can fill: a pencil mark, easy to find */
.todo {
  background: var(--mark);
  color: var(--ink);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
a.todo-link { text-decoration: none; }

/* Support */
.contact {
  background: var(--paper-raised);
  border-radius: 20px;
  padding: clamp(1.375rem, 1rem + 1.4vw, 2rem);
  margin: 0 0 1rem;
}
.contact-line {
  font-family: var(--serif);
  font-size: var(--t-h3);
  line-height: 1.25;
  margin: 0 0 1rem;
}
.contact-line .todo { font-family: var(--sans); font-size: 1.125rem; }
.contact p:last-child { margin-bottom: 0; }

.qa { padding: 0; margin: 0 0 2rem; }
.qa:last-child { margin-bottom: 0; }
.qa h4 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-lede);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.qa p { margin: 0; }
#support-questions { margin-top: 3.5rem; margin-bottom: 1.25rem; }

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

.foot {
  margin: 0;
  /* a full-width field of the raised paper; the text keeps the page's column */
  background: var(--paper-raised);
  padding: 3rem max(var(--side), calc((100% - 76rem) / 2 + var(--side))) 4rem;
  color: var(--ink-soft);
  font-size: var(--t-small);
  display: grid;
  gap: 0.375rem;
}
.foot p { margin: 0; }
.foot-name {
  font-family: var(--serif);
  font-size: var(--t-h3);
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0.25rem !important;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0.5rem 0 !important; }
.foot-links a { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Motion: transform and opacity only, none at all with Reduce Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  /* The intro arrives in order: headline, line, date, then the painting */
  .intro h1 { animation: rise 720ms var(--ease-out) both; }
  .lede { animation: rise 720ms var(--ease-out) 80ms both; }
  .meta { animation: rise 720ms var(--ease-out) 160ms both; }
  .intro-art img { animation: settle 1100ms var(--ease-out) 120ms both; }

  /* Each part's pieces rise as they come into view (only where the browser can tie it to scrolling;
     elsewhere everything is simply there) */
  @supports (animation-timeline: view()) {
    .doc h2, .doc h3, .short, .plans, .contact, .qa {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}

@media print {
  .bar, .toc, .intro-art, body::after { display: none; }
  html, body { background: #fff; color: #000; }
}
