/*
 * Styling for the permanent legal pages (/legal/*), rendered by server/legal/render.js.
 *
 * The pages carry the same furniture as the rest of the site — shared header, hero, sticky
 * contents, cream footer — and one addition: the version chip. Every legal page states which
 * version of the document it is and when it took effect, because acceptance records point at
 * a version and a reader has to be able to find the wording that applied to them.
 */

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

:root {
  --brand: #8B4513; --brand-d: #6b3410; --brand-l: #A0522D;
  --green: #2c4c3b; --green-l: #3d6b52;
  --paper: #FBF7F0; --cream: #F5EEE2; --cream-d: #EBE0CE;
  --ink: #211c17; --mid: #4b443c; --muted: #857b6e;
  --line: #e7ddcd; --line-s: #d9ccb6;
  --r: 16px; --r-sm: 10px; --r-f: 9999px;
  --sh: 0 14px 40px -14px rgba(74, 45, 12, .25);
  --sh-sm: 0 4px 16px -6px rgba(74, 45, 12, .18);
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: 'Fraunces', serif; line-height: 1.14; font-optical-sizing: auto; font-weight: 600; }
a { color: inherit; text-decoration: none; }
img { display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--brand); }

/* ── hero ───────────────────────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; background: linear-gradient(160deg, #6b3410 0%, #2c4c3b 100%); color: #fff; }
.hero::after { content: ''; position: absolute; inset: 0; background-image: url('/images/Farm-image.jpeg'); background-size: cover; background-position: center; opacity: .16; mix-blend-mode: luminosity; }
.hero-in { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 58px 28px 64px; text-align: center; }
.hero h1 { font-size: clamp(30px, 4.6vw, 48px); margin: 14px auto 0; letter-spacing: -.5px; }
.hero .lede { font-size: 16px; margin: 16px auto 0; max-width: 62ch; color: rgba(255, 255, 255, .82); line-height: 1.6; }
.stamp { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 20px; padding: 9px 18px; border-radius: var(--r-f); background: rgba(255, 255, 255, .12); font-size: 13px; color: rgba(255, 255, 255, .92); }
.stamp b { font-weight: 600; color: #fff; }

/* ── document ───────────────────────────────────────────────────────────── */
section { padding: 60px 0; }
.legal { max-width: 1000px; margin: 0 auto; }
.legal-grid { display: grid; grid-template-columns: 240px 1fr; gap: 50px; align-items: start; }
.toc { position: sticky; top: 98px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; box-shadow: var(--sh-sm); max-height: calc(100vh - 130px); overflow-y: auto; }
.toc h3 { font-size: 12px; font-family: 'Inter'; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; }
.toc a { display: flex; gap: 9px; font-size: 13.5px; color: var(--mid); padding: 6px 0; line-height: 1.4; }
.toc a::before { content: attr(data-n); color: var(--brand); font-weight: 700; flex-shrink: 0; min-width: 14px; }
.toc a:hover { color: var(--brand); }

.doc-section { margin-bottom: 36px; scroll-margin-top: 98px; }
.doc-section .sh { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.doc-section .num { width: 34px; height: 34px; border-radius: 9px; background: rgba(139, 69, 19, .1); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; font-family: 'Inter'; }
.doc-section h2 { font-size: 21px; }
.doc-section.annex { margin-top: 52px; padding-top: 30px; border-top: 2px solid var(--line-s); }
.doc-section.annex .num { background: rgba(44, 76, 59, .1); color: var(--green); font-size: 13px; }

.doc p { color: var(--mid); font-size: 15px; line-height: 1.8; margin-bottom: 12px; }
.doc p:last-child { margin-bottom: 0; }
.doc h3 { font-size: 16.5px; color: var(--ink); margin: 22px 0 10px; }
.doc ul { padding-left: 20px; margin-bottom: 12px; }
.doc ul ul { margin: 8px 0 0; }
.doc li { font-size: 15px; color: var(--mid); line-height: 1.7; margin-bottom: 8px; }
.doc a { color: var(--brand); font-weight: 600; }
.doc a:hover { text-decoration: underline; }
.doc strong { color: var(--ink); font-weight: 600; }

.doc-table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 14px; }
.doc-table th { text-align: left; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 14px 10px 0; border-bottom: 1.5px solid var(--line-s); }
.doc-table td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--mid); line-height: 1.6; }
.doc-table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.notice { background: var(--cream); border-left: 4px solid var(--brand); border-radius: var(--r-sm); padding: 16px 20px; margin-bottom: 20px; }
.notice p { margin: 0; color: var(--ink); }

.doc-foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.doc-foot a { color: var(--brand); font-weight: 600; }

/* ── index of all documents ─────────────────────────────────────────────── */
.doc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.doc-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px 26px; box-shadow: var(--sh-sm); transition: .15s; }
.doc-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.doc-card h2 { font-size: 19px; margin-bottom: 8px; }
.doc-card p { font-size: 14.5px; color: var(--mid); line-height: 1.65; margin-bottom: 14px; }
.doc-card .meta { font-size: 12.5px; color: var(--muted); }
.doc-card .meta .pending { color: var(--brand); font-weight: 600; }

/* ── footer ─────────────────────────────────────────────────────────────── */
footer { background: #1c160f; color: rgba(255, 255, 255, .7); padding: 56px 0 28px; }
.fgrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 34px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
footer img { height: 66px; margin-bottom: 16px; }
.foot-tag { font-family: 'Fraunces', serif; font-style: italic; font-size: 15px; color: #f4d9a8; margin: 0 0 12px; line-height: 1.45; max-width: 280px; }
.fgrid h4 { color: #fff; font-family: 'Inter'; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.fgrid a { display: block; font-size: 13.5px; color: rgba(255, 255, 255, .65); padding: 5px 0; }
.fgrid a:hover { color: #fff; }
.fgrid a.flogo { padding: 0; line-height: 0; }
.socials { display: flex; gap: 10px; margin-top: 8px; }
.socials a { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; padding: 0; }
.socials a:hover { background: var(--brand); }
.fbottom { padding-top: 22px; font-size: 13px; color: rgba(255, 255, 255, .5); text-align: center; }

/* Before launch the footer has only the brand and Legal columns; Legal keeps its place at the right. */
@media (min-width: 1025px) { .fgrid.gated > div:last-child { grid-column: -2; } }
@media (max-width: 1024px) { .fgrid { grid-template-columns: 1fr 1fr; } .fgrid > div:first-child, .fgrid > div:last-child { grid-column: 1/-1; } }
@media (max-width: 768px) {
  .legal-grid { grid-template-columns: 1fr; gap: 30px; }
  .toc { position: static; max-height: none; }
  .wrap { padding: 0 16px; }
  .hero-in { padding: 42px 16px 48px; }
}

@keyframes dUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero .eyebrow { animation: dUp .5s cubic-bezier(.16, 1, .3, 1) .05s both; }
.hero h1 { animation: dUp .55s cubic-bezier(.16, 1, .3, 1) .12s both; }
.hero .lede, .hero .stamp { animation: dUp .55s cubic-bezier(.16, 1, .3, 1) .2s both; }
@media (prefers-reduced-motion: reduce) { .hero .eyebrow, .hero h1, .hero .lede, .hero .stamp { animation: none !important; } }
