/* ==========================================================================
   Hesychia Studios — the legal pages (/privacy, /terms)
   The workbench's desk, with the document lying on it: a long stapled sheet
   of paper, the nameplate above it, the wooden ruler below. Reading comes
   first: a ~68ch measure, dark ink, no physics, nothing behind the body text.
   Tokens + textures are copied from /bench/style.css (keep them in step).
   ========================================================================== */

:root {
  color-scheme: light;
  --wood: #c99f73;
  --paper: #fbf7ef;
  --sheet: #fffdf7;
  --ink: #2b231d;
  --ink-body: #41362d;     /* body copy: a touch darker than the bench's --ink-2 for long reading */
  --ink-2: #5d5046;
  --ink-3: #7c6c5e;
  --lav: #6a5ac4;          /* studio lavender, deepened for paper */
  --lav-deep: #4b3fa6;     /* the envelope's stamp ink */
  --margin-red: rgba(210, 84, 84, .34);
  --rule-blue: rgba(90, 130, 180, .20);
  --display: "Fraunces", Georgia, serif;
  --sans: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --measure: 36rem;        /* ~68ch of Nunito at 17px */
  --sheet-pad: clamp(22px, 7vw, 84px);
  --gutter: clamp(12px, 3vw, 28px);
  --shadow-sm: 0 1px 1px rgba(60, 38, 18, .10), 0 2px 4px rgba(60, 38, 18, .10);
  --shadow-md: 0 1px 2px rgba(60, 38, 18, .12), 0 6px 14px rgba(60, 38, 18, .16), 0 18px 34px -12px rgba(60, 38, 18, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink-body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-color: var(--wood);
  /* warm oak desk (same recipe as the workbench) */
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 238, 204, .55), rgba(255, 238, 204, 0) 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1800' height='520'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0018 0.075' numOctaves='4' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36  0 0 0 0 0.21  0 0 0 0 0.09  0.95 0 0 0 -0.32'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3  0 0 0 0 0.18  0 0 0 0 0.08  0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #d4ab7f, #c79c6f 40%, #bf9265);
  background-size: 100% 1400px, 1800px 520px, 240px 240px, 100% 100%;
  background-repeat: no-repeat, repeat, repeat, no-repeat;
}

a { color: inherit; }
::selection { background: rgba(180, 167, 234, .45); }
:focus-visible { outline: 2.5px dashed var(--lav); outline-offset: 4px; border-radius: 6px; }

/* the desk's column: the sheet plus a little room for its edges */
.desk, .legal, .ruler-foot { width: 100%; max-width: calc(var(--measure) + 2 * 84px + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ==========================================================================
   Nameplate + nav tags
   ========================================================================== */
.desk-top { padding-top: clamp(20px, 4vw, 44px); }
.desk { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plate {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 26px 14px 16px;
  text-decoration: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.4  0 0 0 0 0.3  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(170deg, #fffdf8, #f7f0e2);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .8),
    0 1px 1px rgba(60, 38, 18, .10),
    0 3px 6px rgba(60, 38, 18, .10),
    0 16px 30px -8px rgba(60, 38, 18, .28);
  transform: rotate(-1.2deg);
  transition: transform .2s ease, box-shadow .2s ease;
}
.plate:hover { transform: rotate(-.4deg) translateY(-2px); }
.plate-pin {
  position: absolute; top: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff5dc, #caa35d 45%, #7d5c26 100%);
  box-shadow: 0 1px 1.5px rgba(40, 24, 8, .5), inset 0 0 0 .5px rgba(90, 60, 20, .5);
}
.plate-pin--tl { left: 7px; }
.plate-pin--tr { right: 7px; }
.tile {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto;
  background: #0E0E11;
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 1px rgba(0, 0, 0, .3), 0 4px 10px rgba(30, 20, 10, .25);
}
.tile svg { width: 31px; height: 31px; }
.wordmark {
  font-family: var(--display); font-weight: 500; font-size: 1.3rem; letter-spacing: -.005em; line-height: 1.1;
  color: #3a3029; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(60, 38, 18, .18);
}

/* nav: little paper tags, like the bench's buttons */
.tags { display: flex; gap: 8px; }
.tags a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 13px;
  border-radius: 6px; text-decoration: none;
  font-size: .86rem; font-weight: 700; color: var(--ink-2);
  background: linear-gradient(180deg, #fffdf7, #f3ebdb);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(128, 94, 56, .16);
  transition: transform .15s ease, box-shadow .15s ease, color .15s;
}
.tags a:hover { transform: translateY(-1px); color: var(--ink); box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(128, 94, 56, .16); }

/* ==========================================================================
   The sheet
   ========================================================================== */
.legal { padding-top: clamp(26px, 4vw, 44px); padding-bottom: clamp(40px, 6vw, 64px); }
.sheet {
  position: relative;
  padding: clamp(46px, 7vw, 76px) var(--sheet-pad) clamp(44px, 7vw, 80px);
  background:
    /* the red margin rule, down the left-hand margin (never behind text) */
    linear-gradient(90deg, transparent calc(var(--sheet-pad) / 2 - .75px), var(--margin-red) calc(var(--sheet-pad) / 2 - .75px), var(--margin-red) calc(var(--sheet-pad) / 2 + .75px), transparent calc(var(--sheet-pad) / 2 + .75px)),
    /* paper tooth */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.33  0 0 0 0 0.2  0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--sheet);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), var(--shadow-md);
}
/* the page stapled underneath, peeking out */
.sheet::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: #f6efe1;
  border-radius: 2px;
  box-shadow: var(--shadow-sm);
  /* offset, not rotated: on a sheet this tall any rotation would drift far off at the bottom */
  transform: translate(7px, 6px);
}
.legal { position: relative; isolation: isolate; }
/* a staple through the top-left corner */
.staple {
  position: absolute; top: 20px; left: 10px; width: 34px; height: 4px; border-radius: 2px;
  background: linear-gradient(180deg, #e7e9ec, #9da2a8 60%, #7d8288);
  box-shadow: 0 1px 1px rgba(40, 30, 20, .35);
  transform: rotate(-38deg);
}
.staple::before, .staple::after { /* the legs showing through the punctures */
  content: ""; position: absolute; top: 0; width: 3px; height: 4px; border-radius: 1px; background: rgba(60, 50, 40, .35);
}
.staple::before { left: -1px; }
.staple::after { right: -1px; }

/* the sheet's text box is exactly one readable column */
.sheet { max-width: calc(var(--measure) + 2 * var(--sheet-pad)); margin: 0 auto; }

/* ---------- title block ---------- */
.eyebrow {
  display: block;
  margin-top: 0; margin-bottom: 14px;
  font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3);
}
.legal h1 {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(2.2rem, 5.2vw, 3.2rem); line-height: 1.06; letter-spacing: -.015em;
  margin-top: 0; margin-bottom: 0;
  color: var(--ink);
}
/* the date, as a rubber stamp (same ink as the envelope's) — crisp, no texture */
.updated {
  display: table; /* shrink-wraps to the date */
  margin-top: 20px; margin-bottom: 0;
  padding: 4px 12px 5px;
  font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--lav-deep);
  border: 3px double rgba(75, 63, 166, .8);
  border-radius: 6px;
  transform: rotate(-1.5deg);
}
.lede {
  position: relative;
  margin-top: 30px; margin-bottom: 0;
  padding-top: 28px;
  font-size: 1.08rem; line-height: 1.75; color: var(--ink);
}
/* a red rule under the title block, across the whole sheet, like the bench's cards */
.lede::before {
  content: ""; position: absolute; top: 0; height: 1.5px; background: var(--margin-red);
  left: calc(-1 * var(--sheet-pad)); right: calc(-1 * var(--sheet-pad));
}

/* ---------- the short version: a lined note taped onto the sheet ---------- */
.tldr {
  --line: 30px;
  position: relative;
  margin-top: 40px; margin-bottom: 8px;
  padding: var(--line) 22px var(--line) 44px;
  background:
    linear-gradient(90deg, transparent 28px, var(--margin-red) 28px, var(--margin-red) 29.5px, transparent 29.5px),
    /* blue rules on the bottom edge of each line box: every line is exactly --line tall,
       and the rules start where the text starts, so they sit under the words, never through them */
    repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), var(--rule-blue) calc(var(--line) - 1px) var(--line)),
    #fffef9;
  background-position: 0 0, 0 var(--line), 0 0;
  background-size: 100% 100%, 100% var(--line), 100% 100%;
  background-repeat: no-repeat, repeat, no-repeat;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(128, 94, 56, .08), var(--shadow-md);
}
.tldr::before { /* masking tape */
  content: ""; position: absolute; top: -13px; left: 50%; width: 118px; height: 28px; margin-left: -59px;
  background: rgba(236, 222, 186, .82);
  box-shadow: 0 1px 2px rgba(60, 38, 18, .15);
  clip-path: polygon(3% 0, 97% 6%, 100% 55%, 96% 100%, 2% 94%, 0 40%);
  transform: rotate(-2deg);
}
.tldr .k {
  display: block;
  font-family: var(--hand); font-weight: 700; font-size: 1.6rem; line-height: var(--line);
  color: #6a4a2c;
  height: var(--line); overflow: visible;
}
.legal .tldr ul { margin: 0; padding: 0 0 0 20px; }
.legal .tldr li { margin: 0; font-size: 1rem; line-height: var(--line); color: var(--ink); }
.tldr li::marker { color: var(--ink-3); }

/* ---------- body ---------- */
.legal h2 {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 1.7rem); line-height: 1.2; letter-spacing: -.005em;
  margin-top: 2.1em; margin-bottom: 0;
  color: var(--ink);
  scroll-margin-top: 24px;
}
.legal h2 + p, .legal h2 + ul { margin-top: 12px; }
.legal p { margin-top: 16px; margin-bottom: 0; }
.sheet > ul { margin-top: 14px; margin-bottom: 0; padding-left: 22px; }
.legal li { margin: 8px 0; }
.legal strong { color: var(--ink); font-weight: 700; }
.legal a.inline {
  color: var(--lav);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  text-decoration-color: rgba(106, 90, 196, .4);
  transition: color .15s, text-decoration-color .15s;
}
.legal a.inline:hover { color: var(--lav-deep); text-decoration-color: currentColor; }
.legal .sheet > :last-child { margin-bottom: 0; }

/* ==========================================================================
   Footer — the wooden ruler (as on the workbench)
   ========================================================================== */
.ruler-foot { padding-bottom: clamp(20px, 4vw, 36px); }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  padding: 26px clamp(14px, 3vw, 24px) 14px;
  font-size: .82rem; color: #3f2f20; font-weight: 600;
  background:
    linear-gradient(90deg, rgba(60, 38, 18, .55) 1px, transparent 1px) 0 0 / 40px 14px repeat-x,
    linear-gradient(90deg, rgba(60, 38, 18, .35) 1px, transparent 1px) 0 0 / 8px 7px repeat-x,
    linear-gradient(180deg, #f0d9ae, #e4c792);
  border-radius: 4px;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.foot-brand { display: inline-flex; align-items: center; gap: 8px; }
.foot-brand svg { width: 22px; height: 22px; background: #0E0E11; border-radius: 6px; padding: 2px; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Back-to-top: a small paper tag
   ========================================================================== */
.to-top {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  width: 42px; height: 42px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px;
  background: linear-gradient(180deg, #fffdf7, #f3ebdb);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(128, 94, 56, .16);
  color: var(--ink-2);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease, color .15s, transform .15s;
}
.to-top::before {
  content: ""; display: block;
  width: 10px; height: 10px;
  border-left: 2.2px solid currentColor; border-top: 2.2px solid currentColor;
  transform: rotate(45deg) translate(2px, 2px); border-radius: 1px;
}
.to-top.is-visible { opacity: .92; pointer-events: auto; }
.to-top:focus-visible { opacity: 1; }
@media (hover: hover) {
  .to-top:hover { color: var(--lav); opacity: 1; transform: translateY(-2px); }
}

/* ==========================================================================
   Narrow
   ========================================================================== */
@media (max-width: 620px) {
  body { font-size: 16.5px; }
  .desk { justify-content: center; }
  .tags { display: none; }
  .plate { padding: 12px 22px 12px 14px; }
  .wordmark { font-size: 1.2rem; }
  .tile { width: 38px; height: 38px; border-radius: 10px; }
  .tile svg { width: 28px; height: 28px; }
  .sheet { --sheet-pad: 22px; padding-left: 26px; padding-right: 20px; }
  .sheet::before { transform: translate(4px, 4px); }
  .staple { width: 26px; top: 14px; left: 6px; }
  .tldr { padding-left: 34px; padding-right: 16px; }
  .tldr { background-image:
      linear-gradient(90deg, transparent 20px, var(--margin-red) 20px, var(--margin-red) 21.5px, transparent 21.5px),
      repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), var(--rule-blue) calc(var(--line) - 1px) var(--line)); }
  .lede::before { left: -26px; right: -20px; }
  .foot { justify-content: center; text-align: center; }
  .to-top { bottom: 14px; right: 14px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ==========================================================================
   Print: plain black on white
   ========================================================================== */
@media print {
  @page { margin: 18mm 16mm; }
  html, body { background: #fff !important; color: #000; font-size: 11pt; line-height: 1.5; }
  .desk-top, .tags, .to-top, .staple, .ruler-foot { display: none !important; }
  .legal { padding: 0; max-width: none; }
  .sheet, .tldr { background: none !important; box-shadow: none !important; transform: none !important; padding: 0 !important; }
  .sheet::before, .tldr::before, .lede::before { display: none !important; }
  .sheet { max-width: none; }
  .legal h1, .legal h2, .legal strong, .lede, .tldr li, .tldr .k, .eyebrow { color: #000 !important; text-shadow: none !important; }
  .updated { color: #000; border: 1px solid #000; transform: none; }
  .legal p, .legal li, .legal li::marker { color: #000 !important; }
  .lede { padding-top: 0; }
  .tldr { border: 1px solid #000 !important; padding: 10pt 12pt !important; margin-top: 16pt; }
  .tldr .k { font-family: var(--sans); font-size: 9pt; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; height: auto; line-height: 1.4; }
  .legal .tldr li { line-height: 1.5; }
  .legal h2 { break-after: avoid; page-break-after: avoid; margin-top: 18pt; }
  .legal p, .legal li { orphans: 3; widows: 3; }
  .legal a.inline { color: #000; text-decoration: underline; }
  .legal a.inline[href^="http"]::after { content: " (" attr(href) ")"; font-size: .9em; word-break: break-all; }
}
