/* Official Rare Sense Guide: brand tokens from the V2 kit + Rare red */
:root {
  --gunmetal: #435666;
  --gunmetal-dark: #364653;
  --gunmetal-tint: #F1F3F5;
  --ochre: #F6B52D;
  --ochre-tint: #FFF5DF;
  --red: #D7262E;
  --red-dark: #B51E25;
  --white: #FFFFFF;
  --ink: #17191B;
  --muted: #5B6670;
  --line: #DDE2E7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23,25,27,.06), 0 6px 20px rgba(23,25,27,.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "DejaVu Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--gunmetal-tint); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--gunmetal); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); margin: 0 0 1rem; }
code { background: var(--gunmetal-tint); padding: 0 .3em; border-radius: 4px; font-size: .9em; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--gunmetal); color: var(--white); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: block; background: var(--white); border-radius: 14px; padding: 18px 22px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.brand-logo { display: block; width: 100%; max-width: 172px; margin: 0 auto; height: auto; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #E6EBEF; text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.on { background: var(--ochre); color: var(--ink); }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.lock-status { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.slogan { margin: 0; color: var(--ochre); font-weight: 700; font-style: italic; font-size: .9rem; text-align: center; }
.topbar { display: none; }
.main { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 980px; width: 100%; outline: none; }

/* ---------- Buttons ---------- */
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 12px 20px; cursor: pointer; line-height: 1.2; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-ochre { background: var(--ochre); color: var(--ink); }
.btn-ochre:hover { background: #E9A71C; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-big { font-size: 1.15rem; padding: 16px 24px; width: 100%; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: .85rem; }
.link-btn { font: inherit; background: none; border: 0; color: var(--gunmetal); font-weight: 700; cursor: pointer; padding: 6px 4px; display: inline-flex; align-items: center; gap: 8px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-btn.small { font-size: .85rem; font-weight: 600; justify-content: center; }
.link-btn.light, .sidebar .link-btn { color: #E6EBEF; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; text-align: center; }
.badge.ok { background: #E3F4E8; color: #1D6B36; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

/* ---------- Search ---------- */
.ask-hero { background: var(--gunmetal); color: var(--white); border-radius: 18px; padding: 28px clamp(18px, 3vw, 32px); box-shadow: var(--shadow); margin-bottom: 24px; }
.ask-hero h1 { color: var(--white); }
.ask-form { display: flex; gap: 10px; }
.ask-form input { flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--white); color: var(--ink); }
.ask-form input:focus { border-color: var(--ochre); outline: none; }
.ask-form .btn { padding: 0 26px; font-size: 1.05rem; }
.ask-meta { margin: 12px 0 0; font-size: .85rem; color: #C9D2DA; }
.result-count { color: var(--muted); font-size: .9rem; margin: 14px 0 6px; min-height: 1em; }
.more-h { font-size: 1rem; color: var(--muted); margin: 26px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.empty { color: var(--muted); padding: 18px 0; }

/* ---------- Title lists ---------- */
.title-list { list-style: none; margin: 0; padding: 0; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.title-list li + li { border-top: 1px solid var(--line); }
.title-list a { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; color: var(--ink); }
.title-list a:hover { background: var(--ochre-tint); }
.tl-title { font-weight: 600; overflow-wrap: anywhere; }
.tl-topic { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.tl-go { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.ico-lock { width: 18px; height: 18px; fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; }

/* ---------- Answer card ---------- */
.answer { background: var(--white); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 30px); border-top: 5px solid var(--ochre); }
.answer-head > div { min-width: 0; }
.answer-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.answer-head h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); margin: 6px 0 0; }
.topic-tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gunmetal); background: var(--gunmetal-tint); padding: 3px 9px; border-radius: 99px; }
.fav-btn { background: none; border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; flex: none; display: grid; place-items: center; }
.ico-star { width: 20px; height: 20px; fill: none; stroke: var(--gunmetal); stroke-width: 2; stroke-linejoin: round; }
.ico-star.on { fill: var(--ochre); stroke: var(--ochre); }
.beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.beat { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: baseline; padding: 12px 14px; border-radius: 12px; background: var(--gunmetal-tint); }
.beat p { margin: 0; font-size: 1.05rem; }
.beat-label { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--gunmetal); overflow-wrap: anywhere; }
.beat-fact { background: var(--ochre-tint); }
.beat-fact .beat-label { color: #8A5B00; }
.beat-theatre { background: #FDECEC; }
.beat-theatre .beat-label { color: var(--red-dark); text-decoration: line-through; text-decoration-thickness: 2px; }
.beat-gauge { background: var(--gunmetal); color: var(--white); }
.beat-gauge .beat-label { color: var(--ochre); }
.beat-gauge p { font-weight: 700; }
.plain-body { white-space: pre-line; font-size: 1.05rem; background: var(--gunmetal-tint); padding: 14px 16px; border-radius: 12px; }
.single .back { display: inline-block; margin-bottom: 12px; font-weight: 700; text-decoration: none; }

/* ---------- Gate ---------- */
.gate-card { background: var(--white); border-radius: 20px; box-shadow: var(--shadow); padding: clamp(20px, 3.5vw, 36px); display: grid; grid-template-columns: 220px 1fr; gap: clamp(20px, 4vw, 40px); align-items: center; border-top: 6px solid var(--red); }
.gate-logo { width: 100%; height: auto; display: block; padding: 0 6px; }
.gate-copy h1 { margin-bottom: .3em; }
.pitch { font-size: 1.08rem; margin: 0 0 18px; color: #2C3338; }
.video-slot { position: relative; aspect-ratio: 16 / 9; max-height: 230px; width: 100%; border: 2px dashed #9AA7B2; border-radius: 14px; background: repeating-linear-gradient(135deg, #F6F8F9 0 14px, #EEF1F4 14px 28px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin-bottom: 18px; text-align: center; padding: 10px; }
.video-slot.has-video { aspect-ratio: auto; max-height: none; border: 0; background: none; padding: 0; gap: 8px; }
.video-slot video { display: block; height: 400px; max-height: 62vh; aspect-ratio: 9 / 16; width: auto; max-width: 100%; border-radius: 16px; background: var(--gunmetal); box-shadow: 0 6px 22px rgba(23,25,27,.22); object-fit: contain; }
.play { width: 56px; height: 56px; border-radius: 50%; background: var(--gunmetal); display: grid; place-items: center; margin-bottom: 6px; }
.play svg { width: 26px; height: 26px; fill: var(--white); margin-left: 3px; }
.video-label { font-weight: 800; letter-spacing: .12em; font-size: .8rem; color: var(--gunmetal); }
.video-sub { font-size: .85rem; color: var(--muted); }
.fine { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.fine.center { text-align: center; }
.gate-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; }
.peek { margin-top: 28px; }
.peek h2 { font-size: 1.3rem; margin-bottom: .2em; }
.peek .ask-form input { border-color: #C7CFD6; }

/* ---------- Topics ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 24px; }
.pill { text-decoration: none; background: var(--white); color: var(--gunmetal); border: 1.5px solid var(--line); border-radius: 99px; padding: 8px 14px; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.pill span { color: var(--muted); font-weight: 600; margin-left: 4px; font-size: .82rem; }
.pill:hover { border-color: var(--gunmetal); }
.pill.on { background: var(--gunmetal); color: var(--white); border-color: var(--gunmetal); }
.pill.on span { color: var(--ochre); }
.topic-h { font-size: 1.25rem; }
.topic-h span { color: var(--muted); font-weight: 600; font-size: 1rem; }

/* ---------- Modal + toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(23,25,27,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--white); border-radius: 18px; max-width: 440px; width: 100%; padding: 26px 24px 22px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: calc(100vh - 32px); overflow: auto; }
.modal-card h2 { font-size: 1.3rem; padding-right: 28px; }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack label { font-weight: 600; font-size: .9rem; margin-top: 6px; }
.stack input, .stack textarea { font: inherit; padding: 11px 12px; border: 1.5px solid #C7CFD6; border-radius: 10px; }
.stack .btn { margin-top: 12px; }
.form-err { color: var(--red-dark); font-size: .88rem; margin: 2px 0 0; min-height: 1.2em; }
.placeholder-note { background: var(--ochre-tint); border: 1px dashed #D99A12; padding: 8px 10px; border-radius: 8px; font-size: .85rem; font-weight: 700; color: #7A5000; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: var(--white); padding: 10px 18px; border-radius: 99px; font-weight: 600; transition: .25s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar-brand { font-size: .88rem !important; line-height: 1.25; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 40; flex-direction: row; box-shadow: 0 -2px 12px rgba(0,0,0,.15); }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav a { flex-direction: column; gap: 2px; font-size: .72rem; padding: 6px 4px; flex: 1; text-align: center; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--white); padding: 8px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--gunmetal); font-size: .95rem; min-width: 0; }
  .topbar-brand img { width: 24px; height: auto; }
  .topbar-brand s { text-decoration-color: var(--red); text-decoration-thickness: 2px; color: #7C8B97; font-weight: 600; }
  .topbar-brand em { color: var(--red); font-style: normal; }
  .main { padding: 18px 14px 96px; }
  .gate-card { grid-template-columns: 1fr; text-align: left; gap: 14px; }
  .gate-logo { max-width: 172px; margin: 0 auto; }
  .gate-copy h1 { text-align: center; }
  .gate-links { justify-content: center; }
  .ask-form .btn { padding: 0 18px; }
  .beat { grid-template-columns: 1fr; gap: 4px; }
  .tl-topic { display: none; }
  .title-list a { grid-template-columns: 1fr auto; }
}
@media (max-width: 380px) { .topbar-brand span { font-size: .85rem; } }

/* gate copy (Darren 1 Nov) */
.gate-copy h1{line-height:1.15}
.big-pitch{font-size:1.35em;font-weight:700;margin:.2em 0 .6em}
.rare{color:#D7262E}
.sample{background:#fff;border:1px solid #e3e6ea;border-left:5px solid #F6B52D;border-radius:12px;padding:14px 18px;margin:16px 0;text-align:left}
.sample h3{margin:.1em 0 .5em;font-size:1.15em;color:#17191B}
.sample p{margin:.3em 0;line-height:1.45;color:#17191B}
.sample-label{font-size:.75em;text-transform:uppercase;letter-spacing:.08em;color:#435666;font-weight:700}

/* gate animation (1 Nov) */
.sample .q{font-size:1.3em;margin:0 0 .6em}
.anim{opacity:0;transform:translateY(14px);animation:rsIn .7s ease forwards}
.a1{animation-delay:.2s}.a2{animation-delay:1.4s}.a3{animation-delay:2.6s}.a4{animation-delay:3.8s}
@keyframes rsIn{to{opacity:1;transform:none}}
.cs{position:relative;white-space:nowrap}
.cs::after{content:"";position:absolute;left:-2px;right:-2px;top:55%;height:4px;background:#D7262E;border-radius:3px;transform:scaleX(0);transform-origin:left;animation:rsStrike .5s ease 1.1s forwards}
@keyframes rsStrike{to{transform:scaleX(1)}}
.pop{display:inline-block;animation:rsPop .5s cubic-bezier(.3,1.6,.5,1) 1.9s both}
@keyframes rsPop{from{transform:scale(.3) rotate(-8deg);opacity:0}to{transform:none;opacity:1}}
.sample .beat{opacity:0;transition:opacity .3s}
.sample .beat.on{opacity:1}
.beat .tw{white-space:pre-wrap}
.beat.theatre .tw{text-decoration:line-through;text-decoration-color:#D7262E;text-decoration-thickness:2px}
.beat.gauge{background:#435666;color:#fff;border-radius:8px;padding:8px 10px;margin-top:8px}
.beat.gauge b{color:#F6B52D}
@media (prefers-reduced-motion:reduce){.anim,.pop{animation:none;opacity:1;transform:none}.cs::after{animation:none;transform:scaleX(1)}.sample .beat{opacity:1}}

/* Real unlock: restore link note + unlocking state */
.restore-note { background: var(--ochre-tint); border: 1px solid #EBC877; border-radius: 12px; padding: 12px 14px; margin: 12px 0 16px; display: grid; gap: 10px; }
.restore-note p { margin: 0; font-size: .92rem; }
.restore-note input { font: inherit; font-size: .8rem; padding: 9px 10px; border: 1.5px solid #C7CFD6; border-radius: 10px; width: 100%; box-sizing: border-box; background: var(--white); color: var(--ink); }
.unlocking { padding: 48px 8px; text-align: center; }

/* gate ads (2 Nov): the four ads rotate where the big logo sat */
.gate-card{grid-template-columns:260px 1fr}
.gate-ad{position:relative;width:100%;aspect-ratio:4/5;border-radius:14px;overflow:hidden;background:#fff;box-shadow:0 2px 10px rgba(23,25,27,.12)}
.ad-video{display:block;width:100%;height:100%;object-fit:contain;background:#fff;cursor:pointer}
.ad-sound{position:absolute;right:8px;bottom:8px;border:0;border-radius:999px;padding:6px 11px;font:inherit;font-size:.78rem;font-weight:700;color:#fff;background:rgba(23,25,27,.72);cursor:pointer}
.ad-sound:focus-visible,.ad-play:focus-visible{outline:3px solid #F6B52D;outline-offset:2px}
.ad-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:64px;height:64px;border:0;border-radius:50%;background:rgba(215,38,46,.92);cursor:pointer;display:grid;place-items:center}
.ad-play[hidden]{display:none}
.ad-play svg{width:30px;height:30px;fill:#fff}
@media (max-width:760px){.gate-card{grid-template-columns:1fr}.gate-ad{max-width:240px;margin:0 auto}}

/* disclaimer (2 Nov) */
.disclaimer{font-size:.75rem;line-height:1.45;color:#6b7680;margin:0}
.page-foot{margin-top:40px;padding-top:14px;border-top:1px solid #e3e6ea}
.card-disclaimer{margin-top:14px;padding-top:10px;border-top:1px dashed #e3e6ea}
.modal-disclaimer{margin-top:16px}

/* "Bought it already? Unlock this device": smaller and quieter than the Unlock button. */
.link-btn.subtle { font-size: .78rem; font-weight: 500; color: var(--muted); text-decoration-thickness: 1px; padding: 4px 2px; }
.sidebar .link-btn.subtle, .link-btn.light.subtle { color: rgba(230, 235, 239, .72); }
.gate-links .link-btn.subtle { align-self: center; }

/* Keep clear of the "Powered by Netlify" badge: a fixed 192x64 frame at the bottom right
   (measured live). Nothing interactive sits in that corner on any screen size. */
:root { --nl-badge-w: 200px; --nl-badge-h: 72px; }
.main { padding-bottom: calc(var(--nl-badge-h) + 24px); }
.modal { padding-bottom: var(--nl-badge-h); }
.modal-card { max-height: calc(100vh - 16px - var(--nl-badge-h)); }
.toast { bottom: calc(var(--nl-badge-h) + 12px); }
@media (max-width: 760px) {
  /* Bottom bar keeps full width; the badge docks in its right end and Ask is centred in the space to its left. */
  .sidebar { padding-right: var(--nl-badge-w); min-height: 64px; align-items: center; }
  .nav { justify-content: center; }
  .nav a { flex: 0 1 auto; flex-direction: row; gap: 8px; font-size: .95rem; font-weight: 700; padding: 10px 22px; border-radius: 99px; }
  .main { padding-bottom: calc(64px + 40px); }
  .toast { bottom: calc(64px + 16px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
  .modal { padding-bottom: calc(64px + 12px); }
  .modal-card { max-height: calc(100vh - 16px - 76px); }
}

/* "common sense" -> struck "common" + hand-lettered red "Rare" (logo paths, assets/rare.svg) */
.rs-v{white-space:nowrap}
.rs-c{position:relative;display:inline-block;margin-top:.6em;line-height:1}
.rs-c::after{content:"";position:absolute;left:-.06em;right:-.06em;top:54%;height:max(2px,.085em);background:#D7262E;border-radius:.05em;transform:scaleX(0);transform-origin:left;animation:rsStrike .45s ease .9s forwards}
.rs-rare{position:absolute;left:50%;bottom:72%;height:.82em;width:auto;max-width:none;transform:translateX(-50%);pointer-events:none;opacity:0;animation:rsRareIn .35s ease 1.25s forwards}
@keyframes rsRareIn{from{opacity:0;transform:translateX(-50%) translateY(.12em)}to{opacity:1;transform:translateX(-50%)}}
@media (prefers-reduced-motion:reduce){.rs-c::after{animation:none;transform:scaleX(1)}.rs-rare{animation:none;opacity:1}}
/* header: struck "Common" (capital C) with Rare above, compact, no animation delay */
.topbar-brand .rs-hdr{margin-top:.8em;color:#7C8B97;font-weight:600}
.topbar-brand .rs-hdr::after{height:2px;top:52%;animation:none;transform:scaleX(1)}
.topbar-brand .rs-hdr .rs-rare{bottom:calc(84% + 2px);height:.9em;animation:none;opacity:1}

/* Sources under an answer: small, quiet, still tappable. */
.answer .sources { margin: 14px 0 4px; padding-top: 10px; border-top: 1px solid rgba(127,127,127,.25); font-size: 12px; line-height: 1.45; opacity: .78; }
.answer .sources h3 { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.answer .sources ul { margin: 0; padding-left: 16px; }
.answer .sources li { margin: 2px 0; }
.answer .sources a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
