/*
  Leafday - the one look every page on leafday.ca shares.

  It is the app's own look, carried to the web:
    - Fraunces, the logotype's face and the app's default, self-hosted (assets/fonts). Nothing here asks
      another server for anything: the privacy policy promises no tracking, and a font request is one.
      Body text is cut lighter than 400 and the corners softened (SOFT 45, baked into the file), exactly as
      the app sets it; only the wordmark turns WONK on, because the leaning letters belong to the mark.
    - The Matcha palette: paper #F3F6EC and the icon's own green #77985E (the app's `matcha` palette,
      lib/core/theme/palettes.dart). #77985E is a FILL colour; green as text is the deeper `--leaf-ink`,
      as the app's `accentInk` is. Dark mode follows the phone, as the app's does.
    - Paper, not cards: hairlines, ruled lines, generous space.

  home.css adds what only the landing page uses. Tokens are defined once, here.
*/

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #f3f6ec;       /* the app's Matcha background */
  --page: #fbfcf7;        /* a brighter sheet laid on the paper */
  --sunk: #e6edd9;        /* a band set into the paper */
  --line: #cbd6ba;        /* hairlines and ruled lines */
  --line-soft: #dce4cd;

  --ink: #232a1e;
  --ink-2: #46513d;
  --ink-3: #59654e;       /* the quietest text: still 5.1:1 on every ground */

  --leaf: #77985e;        /* the icon's green: fills (and the leaf marks) */
  --leaf-mark: #729259;   /* the wordmark's green: a hair deeper than --leaf so that the large wordmark reaches 3:1 on the paper (3.22:1; --leaf is 2.98:1) */
  --leaf-ink: #4b6839;    /* the same hue as text and links, 5.2:1 or better */
  --leaf-wash: #c5d3ae;   /* the second frame tone in the page sketches */
  --on-leaf: #1f241c;     /* text on --leaf, 4.85:1, as the app's textOnAccent */

  --deep: #31442a;        /* the closing band */
  --on-deep: #f3f6ec;
  --on-deep-2: #c8d6b6;
  --leaf-on-deep: #8fb176;

  --bezel: #1b2017;
  --shadow: 31 36 28;     /* rgb triplet, used with alpha */

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1.25rem, 5.5vw, 3rem);
  --measure: 36rem;

  /* The app icon's leaf (lib/core/widgets/leaf_shape.dart, measured from the icon), with its rib cut out, used
     as a bullet and as a mark. One drawing everywhere: the app's, the favicon's and this one. */
  --leaf-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-2 -2 104 104'%3E%3Cpath fill-rule='evenodd' d='M99.8 0.2L97.5 -1.2L90.9 -1.2L85.3 -0.2L79.8 0.9L74.5 2.2L69.7 4.0L64.7 5.5L60.3 7.6L55.7 9.7L51.5 12.0L47.3 14.4L43.5 17.2L39.7 20.0L36.0 22.9L32.6 26.0L29.3 29.3L26.0 32.6L22.9 36.0L20.0 39.7L17.2 43.5L14.4 47.3L12.0 51.5L9.7 55.7L7.6 60.3L5.5 64.7L4.0 69.7L2.2 74.5L0.9 79.8L-0.2 85.3L-1.2 90.9L-1.2 97.5L0.2 99.8L2.5 101.2L9.1 101.2L14.7 100.2L20.2 99.1L25.5 97.8L30.3 96.0L35.3 94.5L39.7 92.4L44.3 90.3L48.5 88.0L52.7 85.6L56.5 82.8L60.3 80.0L64.0 77.1L67.4 74.0L70.7 70.7L74.0 67.4L77.1 64.0L80.0 60.3L82.8 56.5L85.6 52.7L88.0 48.5L90.3 44.3L92.4 39.7L94.5 35.3L96.0 30.3L97.8 25.5L99.1 20.2L100.2 14.7L101.2 9.1L101.2 2.5L99.8 0.2ZM93.7 2.1L2.1 93.7L6.3 97.9L97.9 6.3Z'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11150e;
    --page: #171c13;
    --sunk: #1e2519;
    --line: #34402c;
    --line-soft: #283121;

    --ink: #e8eedd;
    --ink-2: #bdc8ad;
    --ink-3: #a0ac90;

    --leaf: #77985e;
    --leaf-ink: #a8c78c;
    --leaf-wash: #3b4d30;
    --on-leaf: #1f241c;

    --deep: #1b2815;
    --on-deep: #eaf0df;
    --on-deep-2: #b7c6a3;
    --leaf-on-deep: #8fb176;

    --bezel: #2a3123;
    --shadow: 0 0 0;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
  accent-color: var(--leaf);
  scrollbar-color: var(--line) var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;           /* 17px */
  font-weight: 340;
  line-height: 1.62;
  font-optical-sizing: auto;
  font-variation-settings: "WONK" 0;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

@media (min-width: 48rem) {
  body { font-size: 1.125rem; }  /* 18px */
}

::selection { background: var(--leaf); color: var(--on-leaf); }
:focus-visible { outline: 2px solid var(--leaf-ink); outline-offset: 3px; border-radius: 3px; }
input, textarea { caret-color: var(--leaf-ink); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }

h1, h2, h3 { font-weight: 430; text-wrap: balance; letter-spacing: -0.012em; }
strong, b { font-weight: 577; }
em { font-style: normal; font-weight: 560; }   /* the font has no italic; names of things in the app read as bold */
p, li, dd { text-wrap: pretty; }

a {
  color: var(--leaf-ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--leaf-ink) 45%, transparent);
  transition: text-decoration-color 0.2s;
}
a:hover { text-decoration-color: currentColor; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--sunk);
  padding: 0.12em 0.4em;
  border-radius: 5px;
}

.wrap { width: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: 8px; z-index: 10;
}
.skip:focus { top: 0.75rem; }

/* ---- the bar: the wordmark and a few ways on ---------------------------------------------------- */

.bar { padding-block: 1.1rem; }
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* The logotype: Fraunces 600, SOFT 45 (baked into the file), WONK on, in the icon's green and nothing else,
   `opsz` following the size (font-optical-sizing). It is a logotype, so it is exempt from the text contrast rule. */
.wordmark {
  font-weight: 600;
  font-variation-settings: "WONK" 1;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0;
  color: var(--leaf-mark);
  text-decoration: none;
}
.wordmark:hover { color: var(--leaf-mark); }

.bar nav { display: none; }
.bar nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 450;
  font-size: 0.98rem;
  padding: 0.5rem 0.2rem;
  margin-inline: 0.55rem;
  border-radius: 4px;
}
.bar nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: 1px; }

.bar-links { display: flex; gap: 1.4rem; }
.bar-links a { color: var(--ink-2); text-decoration: none; font-weight: 450; font-size: 0.98rem; padding: 0.5rem 0; }
.bar-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

@media (min-width: 62rem) {
  .bar nav { display: block; }
}

/* ---- buttons ------------------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem;
  padding: 0.7rem 1.45rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 577;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.3s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--leaf); color: var(--on-leaf); }
.btn-primary:hover { background: #86a76d; color: var(--on-leaf); }
.btn-quiet { background: transparent; color: var(--leaf-ink); border-color: var(--leaf-ink); }
.btn-quiet:hover { background: color-mix(in srgb, var(--leaf-ink) 10%, transparent); color: var(--leaf-ink); }
.btn-small { min-height: 2.5rem; padding: 0.5rem 1.1rem; font-size: 0.95rem; }

/* ---- reading pages: privacy, terms, delete-account and the pages Stripe sends people back to ------- */

.doc main {
  width: min(100% - 2 * var(--gutter), 40rem);
  margin: clamp(2rem, 6vw, 4.5rem) auto clamp(3.5rem, 9vw, 7rem);
}
.doc.narrow main { width: min(100% - 2 * var(--gutter), 34rem); }

.doc h1 {
  font-size: clamp(2.2rem, 1.2rem + 4.2vw, 3.4rem);
  line-height: 1.08;
  margin-bottom: 0.9rem;
}
.doc .lede { color: var(--ink-2); font-size: 1.1rem; margin-bottom: 2rem; }

.doc h2 {
  font-size: 1.45rem;
  font-weight: 520;
  line-height: 1.25;
  margin: 3rem 0 0.7rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.doc h2:first-of-type { margin-top: 2.4rem; }
.doc p, .doc li { color: var(--ink-2); }
.doc p + p, .doc ul + p, .doc ol + p, .doc p + ul, .doc p + ol, .doc .box + p { margin-top: 1rem; }
.doc p strong, .doc li strong, .doc td strong { color: var(--ink); }
.doc ul, .doc ol { padding-left: 1.3rem; margin-top: 0.8rem; }
.doc li { margin-top: 0.55rem; padding-left: 0.2rem; }
.doc li::marker { color: var(--leaf); }
.doc ol li::marker { font-weight: 577; color: var(--leaf-ink); }

.doc .box {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
}
.doc .box p, .doc .box li { color: var(--ink); }

.doc main > footer {
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-3);
}
.doc main > footer a { color: var(--ink-2); }

.doc table { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-size: 0.97rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.75rem 0.9rem 0.75rem 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.doc th { color: var(--ink-3); font-weight: 560; font-size: 0.88rem; border-bottom-color: var(--ink-3); }
.doc td:first-child { color: var(--ink); width: 48%; padding-right: 1.4rem; }

/* A two-column table has no room at phone width: each row becomes the thing and, under it, the reason. */
@media (max-width: 40rem) {
  .doc table, .doc tbody, .doc tr, .doc td, .doc th { display: block; width: auto; }
  .doc tr:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .doc tr { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .doc td, .doc th { border: 0; padding: 0; }
  .doc td:first-child { width: auto; color: var(--ink); font-weight: 520; padding: 0 0 0.3rem; }
}

/* On the short pages the leaf stands over the title, as the leaf stands under the day in the app's week strip. */
.doc.narrow main > h1::before {
  content: "";
  display: block;
  width: 1.9rem; height: 1.9rem;
  margin-bottom: 1.1rem;
  background: var(--leaf);
  -webkit-mask: var(--leaf-mask) center / contain no-repeat;
  mask: var(--leaf-mask) center / contain no-repeat;
}

@media print {
  .bar, .skip { display: none; }
  html, body { background: #fff; color: #000; }
  .doc main { width: auto; margin: 0; }
  .doc p, .doc li, .doc td { color: #000; }
  a { color: #000; text-decoration: underline; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; }
}
