/* legal.css - Legal notice, privacy policy, terms and the 404 page, on top of landing.css and guide.css.
   The text itself stays calm and readable; the Memphis fun sits around it: floating shapes, a sticker,
   tilted cards, number badges, letters that are pads, and the page bird. */

/* ---------- Hero ---------- */
.legal-hero { position: relative; isolation: isolate; display: grid; gap: 20px; padding-top: 48px !important; }
.legal-title {
    margin: 0; display: flex; flex-wrap: wrap; gap: 0 .32em;
    font-family: var(--display); font-weight: 400; font-size: clamp(42px, 9vw, 86px); line-height: 1; letter-spacing: .5px;
    user-select: none; -webkit-user-select: none;
}
.legal-title .w { display: inline-flex; white-space: nowrap; }
/* Until legal.js has made the letters, the title waits (at most 1.2 s, then it shows anyway) */
.legal-title[data-letters]:not(.split) { opacity: 0; animation: lt-show 0s 1.2s forwards; }
@keyframes lt-show { to { opacity: 1; } }
.legal-title .pl.drop { animation: lt-drop .55s cubic-bezier(.3, 1.6, .5, 1) calc(var(--i) * 45ms) backwards; }
@keyframes lt-drop { from { transform: translateY(-70%) rotate(-14deg); opacity: 0; } }
.legal-intro { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.legal-intro .lead { flex: 1 1 320px; }

/* "Last updated" as a sticker: tap it */
.sticker {
    display: inline-grid; justify-items: center; gap: 2px; padding: 10px 18px;
    font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; line-height: 1.3;
    color: var(--ground); background: var(--c, var(--c0)); border: 3px solid var(--ink); border-radius: 12px;
    box-shadow: 4px 4px 0 var(--ink); transform: rotate(-4deg); cursor: pointer;
}
.sticker b { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .5px; text-transform: none; }
.sticker.hit { animation: sticker .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes sticker { 30% { transform: rotate(5deg) scale(1.1); } 65% { transform: rotate(-8deg) scale(.95); } 100% { transform: rotate(-4deg); } }

/* Memphis shapes drifting behind the hero (legal.js moves the group a little with the scroll) */
.legal-shapes { position: absolute; top: 0; right: -8px; width: min(44%, 420px); height: 100%; z-index: -1; pointer-events: none; }
.ls { position: absolute; display: block; }
.ls-tri { top: 16%; right: 10%; width: 0; height: 0; border-left: 26px solid transparent; border-right: 26px solid transparent; border-bottom: 46px solid var(--c0); opacity: .8; animation: ls-float 7s ease-in-out infinite; }
.ls-circ { top: 62%; right: 38%; width: 38px; height: 38px; border-radius: 50%; background: var(--c1); opacity: .75; animation: ls-float 6s ease-in-out -2s infinite reverse; }
.ls-ring { top: 6%; right: 52%; width: 34px; height: 34px; border-radius: 50%; border: 5px solid var(--c2); animation: ls-spin 14s linear infinite; }
.ls-bar { top: 80%; right: 6%; width: 66px; height: 14px; border-radius: 3px; background: var(--c3); transform: rotate(-24deg); animation: ls-tilt 5s ease-in-out infinite; }
.ls-squig {
    top: 38%; right: 20%; width: 96px; height: 40px; animation: ls-float 8s ease-in-out -4s infinite;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 40'%3E%3Cpath d='M4 26 q11 -22 22 0 t22 0 t22 0 t22 0' fill='none' stroke='%23c9197d' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
@keyframes ls-float { 50% { transform: translateY(-14px) rotate(8deg); } }
@keyframes ls-spin { to { transform: rotate(360deg); } }
@keyframes ls-tilt { 50% { transform: rotate(-10deg) translateY(8px); } }
@media (max-width: 760px) { .legal-shapes { width: 70%; opacity: .45; } }

/* The three pages as keys */
.legal-switch { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.legal-switch .key { min-height: 44px; padding: 8px 16px; font-size: 12px; box-shadow: 4px 4px 0 var(--c1); }
.legal-switch .key[aria-current="page"] { background: var(--on); box-shadow: 4px 4px 0 var(--c0); }
.top nav a[aria-current="page"] { color: var(--ink); border-bottom: 3px solid var(--on); }

/* A draft that still needs the real legal text (the release build refuses TODO-LEGAL) */
.legal-draft {
    max-width: 72ch; margin-top: 8px; padding: 16px 18px; border-radius: 14px;
    border: 3px dashed var(--on-text); background: rgba(201, 25, 125, .1); font-size: 14px; line-height: 1.6;
}
.legal-draft b { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--on-text); }

/* ---------- Sections ---------- */
.legal-main > section { padding: 44px 0; }
.legal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.legal-head .wf-num { grid-row: auto; flex-shrink: 0; width: 52px; height: 52px; font-size: 22px; border-radius: 14px; cursor: pointer; }
.legal-head .wf-num.spin { animation: badge-spin .6s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes badge-spin { from { transform: rotate(-364deg) scale(.7); } }
.legal-head h2 { font-size: clamp(24px, 4vw, 36px); min-width: 0; overflow-wrap: anywhere; }
.legal-head [data-perch], .final [data-perch] { white-space: normal; } /* whole headings are perches here */
.guide-main.legal-main { min-width: 0; }
.legal-body { display: grid; gap: 14px; max-width: 72ch; font-size: 17px; line-height: 1.7; color: #ddd7e6; }
.legal-body strong { color: var(--ink); }
.legal-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.legal-body ul li { position: relative; padding-left: 28px; }
.legal-body ul li::before {
    content: ''; position: absolute; left: 3px; top: .55em; width: 10px; height: 10px;
    background: var(--tc, var(--c0)); border: 2px solid var(--ink); border-radius: 2px; transform: rotate(45deg);
}
.legal-body a, .legal-hero a, .legal-card a { color: var(--c0); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.legal-body a:hover, .legal-card a:hover { text-decoration-style: wavy; }

/* "In short": three tilted cards */
.short-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.short-cards li {
    display: grid; gap: 12px; align-content: start; padding: 22px 20px;
    background: var(--panel); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--c);
    transform: rotate(var(--r, -1deg)); transition: transform .18s ease-out, box-shadow .18s ease-out;
}
.short-cards li:nth-child(even) { --r: 1.2deg; }
.short-cards li:hover { transform: rotate(0deg) translate(-3px, -3px); box-shadow: 9px 9px 0 var(--c); }
.short-cards .tick {
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    background: var(--c); color: var(--ground); border: 3px solid var(--ink); font-family: var(--display); font-size: 20px;
}
.short-cards p { font-size: 15px; line-height: 1.55; }

/* The address as a card with a stamp */
.legal-card {
    position: relative; justify-self: start; width: min(100%, 380px); padding: 26px 28px;
    font-style: normal; font-size: 19px; line-height: 1.6;
    background: var(--panel); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--c1);
    transform: rotate(-.8deg);
}
.legal-card .stamp {
    position: absolute; right: -14px; top: -20px; display: grid; place-items: center; width: 66px; height: 66px;
    background: var(--c0); border: 3px dashed var(--ground); outline: 3px solid var(--ink); border-radius: 8px;
    transform: rotate(9deg); box-shadow: 4px 4px 0 var(--ink);
}
.legal-card .stamp canvas { width: 44px; height: 44px; image-rendering: pixelated; }
@media (max-width: 600px) { .legal-card .stamp { right: -4px; top: -26px; width: 56px; height: 56px; } .legal-card .stamp canvas { width: 36px; height: 36px; } }
.legal-kv { display: grid; gap: 6px; }
.legal-kv b { font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-right: 8px; }

/* ---------- Coming in as you scroll (legal.js adds .reveal, then .in once it is seen) ---------- */
.reveal { opacity: 0; transform: translateY(28px) rotate(-.8deg); transition: opacity .5s ease-out, transform .65s cubic-bezier(.2, .9, .3, 1.25); }
.reveal.in { opacity: 1; transform: none; }
.short-cards li.reveal { transform: translateY(34px) rotate(calc(var(--r, -1deg) * 4)); transition-delay: calc(var(--i, 0) * 90ms); }
.short-cards li.reveal.in { transform: rotate(var(--r, -1deg)); }
.short-cards li.reveal.in:hover { transform: rotate(0deg) translate(-3px, -3px); transition-delay: 0s; }
.legal-sec.reveal .wf-num { transform: rotate(-120deg) scale(.3); transition: transform .55s cubic-bezier(.3, 1.6, .5, 1) .15s; }
.legal-sec.reveal.in .wf-num { transform: rotate(-4deg); }

/* =====================================================================================
   404: the lost bird, the 404 beat and "catch the bird"
   ===================================================================================== */
.lost-main { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }
.lost-hero { position: relative; isolation: isolate; display: grid; gap: 22px; justify-items: center; text-align: center; padding: 40px 0 24px; }
.lost-hero .legal-title { justify-content: center; }
.lost-hero .lead { max-width: 48ch; }

/* The sky the bird flutters around in */
.lost-sky { position: relative; width: 100%; height: clamp(190px, 34vh, 280px); }
.lost-bird {
    position: absolute; left: 0; top: 0; z-index: 3; width: 72px; height: 72px; padding: 0; margin: 0;
    background: none; border: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    transition: transform .9s cubic-bezier(.45, .05, .35, 1);
}
.lost-bird canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.lost-bird.flip canvas { transform: scaleX(-1); }
.lost-bird.fast { transition-duration: .45s; }
.lost-bird:focus-visible { outline-offset: 6px; border-radius: 12px; }
.lost-q { position: absolute; font-family: var(--display); font-size: 22px; color: var(--c0); pointer-events: none; animation: q-rise 1.6s ease-out forwards; }
@keyframes q-rise { from { transform: translateY(0) rotate(-10deg); opacity: 1; } to { transform: translateY(-46px) rotate(14deg); opacity: 0; } }
.lost-says {
    position: absolute; z-index: 4; max-width: 220px; padding: 8px 12px; pointer-events: none;
    font-family: var(--mono); font-size: 12px; font-weight: 700; line-height: 1.4; text-align: left;
    color: var(--ground); background: var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--on);
    transition: opacity .25s;
}
.lost-says[hidden] { display: block; opacity: 0; }

/* Score: three feathers */
.lost-score { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.lost-score i { width: 14px; height: 26px; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; border: 2px solid var(--line); transform: rotate(18deg); transition: background .2s, border-color .2s; }
.lost-score i.got { background: var(--c); border-color: var(--ink); animation: feather .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes feather { from { transform: rotate(18deg) scale(1.8); } }

/* The 404 beat: the digits drawn with pads on an LCD, a playhead plays the lit ones */
.lost-lcd {
    display: grid; gap: 14px; justify-items: center; width: min(100%, 640px); padding: 18px 16px 16px;
    background: var(--lcd); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--on);
}
.lost-grid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 5px; width: 100%; }
.lost-grid i { aspect-ratio: 1; border-radius: 4px; background: #1a1622; }
.lost-grid i.lit { background: color-mix(in srgb, var(--c) 35%, #1a1622); }
.lost-grid i.lit.found { background: var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); }
.lost-grid i.head { outline: 2px solid var(--ink); outline-offset: 1px; }
.lost-grid i.hit { animation: cell-hit .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cell-hit { 40% { transform: scale(1.35); } }
.lost-lcd-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: center; }
.lost-lcd-row .key { min-height: 46px; }
.lost-note { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.lost-ways { display: flex; flex-wrap: wrap; gap: 16px 18px; justify-content: center; }
.lost-ways .key.home.pulse { animation: home-pulse 1s ease-in-out 3; }
@keyframes home-pulse { 50% { transform: translate(-2px, -2px) scale(1.06); box-shadow: 9px 9px 0 var(--c0); } }

/* ---------- Contact form (contact.js writes the email in the visitor's mail app) ---------- */
.contact-form, .contact-after { display: grid; gap: 22px; max-width: 640px; }
.contact-form[hidden], .contact-after[hidden] { display: none; }
.cf-topics { display: flex; flex-wrap: wrap; gap: 12px 14px; margin: 0; padding: 0; border: 0; }
.cf-topics legend, .cf-field > span, .cf-field label > span {
    display: block; margin-bottom: 10px; padding: 0;
    font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
}
.cf-field em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.cf-topics label { position: relative; }
.cf-topics input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cf-topics span {
    display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
    font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    background: var(--panel); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--c1);
    transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.cf-topics input:checked + span { background: var(--on); box-shadow: 4px 4px 0 var(--c0); }
.cf-topics input:focus-visible + span { outline: 3px solid var(--c0); outline-offset: 3px; }
.cf-topics label:active span { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--c1); }
.cf-field { display: grid; }
.cf-field textarea, .cf-field input {
    width: 100%; min-width: 0; padding: 14px 16px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--ink);
    background: var(--lcd); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 6px 6px 0 var(--c2);
}
.cf-field textarea { resize: vertical; min-height: 170px; }
.cf-field textarea::placeholder, .cf-field input::placeholder { color: #6f6880; }
.cf-field textarea:focus, .cf-field input:focus { outline: none; border-color: var(--c0); }
.cf-hint { justify-self: end; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cf-row { display: flex; gap: 14px; align-items: stretch; }
.cf-row input { flex: 1; }
.cf-row .key { flex-shrink: 0; }
.cf-app { margin: 0; padding: 12px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.cf-app[hidden] { display: none; }
.cf-note { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 60ch; }
.cf-note a { color: var(--c0); }
.contact-after { padding: 24px 22px; background: var(--panel); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--c1); }
.contact-after:focus { outline: none; }
.cf-after-head { margin: 0; font-family: var(--display); font-size: 22px; line-height: 1.2; }
.contact-after p { margin: 0; }

/* ---------- Less motion: all content there, nothing moving ---------- */
@media (prefers-reduced-motion: reduce) {
    .reveal, .short-cards li.reveal { opacity: 1 !important; transform: none !important; }
    .legal-title[data-letters] { opacity: 1 !important; }
    .legal-sec .wf-num, .short-cards li, .legal-card, .sticker { transform: none !important; }
    .legal-shapes { display: none; }
    .lost-bird { transition: none; }
}

/* The legal notice has no table of contents: one column */
@media (min-width: 1040px) { .guide-layout.legal-solo { grid-template-columns: minmax(0, 1fr); max-width: 960px; } }
