/* Blackcrest Club: shared styles for every page.
   Page layouts come from the approved designs (inline styles plus the
   generated home.css / takes.css / crest-club.css for mobile). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; color-scheme: dark; }
body { margin: 0; background: #000000; }
a { color: #E6E9EE; text-decoration: none; }
a:hover { color: #FFFFFF; }
img { max-width: 100%; }
button { font: inherit; }
:focus-visible { outline: 1px solid #E6E9EE; outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nw { white-space: nowrap; }

@keyframes bc-btn-sheen { 0% { transform: translateX(-120%) skewX(-18deg) } 60% { transform: translateX(420%) skewX(-18deg) } 100% { transform: translateX(420%) skewX(-18deg) } }
@keyframes bc-sheen { 0% { transform: translateX(-120%) skewX(-18deg) } 55% { transform: translateX(220%) skewX(-18deg) } 100% { transform: translateX(220%) skewX(-18deg) } }
@keyframes bc-float { 0%, 100% { transform: rotateX(12deg) rotateY(-14deg) translateY(0) } 50% { transform: rotateX(10deg) rotateY(-10deg) translateY(-10px) } }
@keyframes hm-float { 0%, 100% { transform: rotateX(8deg) rotateY(-12deg) translateY(0) } 50% { transform: rotateX(6deg) rotateY(-8deg) translateY(-10px) } }
@keyframes hm-run { 0% { width: 0% } 100% { width: 100% } }
@keyframes hm-runv { 0% { height: 0% } 100% { height: 100% } }
@keyframes hm-shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
@keyframes bc-spin { to { transform: rotate(360deg) } }
@keyframes bc-pop { 0% { transform: scale(1) } 40% { transform: scale(1.35) } 100% { transform: scale(1) } }
@keyframes bc-fade { from { opacity: 0 } }

/* Desktop / mobile switches (breakpoint 768px, same as the designs) */
@media (min-width: 768px) { .mb-only { display: none !important; } }
@media (max-width: 767px) { .dt-only { display: none !important; } }

/* Live counters fade in once the Google Sheet answers */
[data-text] { transition: opacity .4s ease; }
html.counts-loading [data-text] { opacity: 0; }

/* ---------- Tabs and toggles (lens tabs, take type) ---------- */
.pill-tab {
  min-height: 48px; padding: 0 24px; border-radius: 999px; cursor: pointer;
  font-family: 'Geist Mono', monospace; font-size: 11px; letter-spacing: 0.25em;
  color: #C7CCD4; background: rgba(255,255,255,0.03); border: 1px solid rgba(199,204,212,0.35);
  transition: background .2s ease, color .2s ease;
}
.pill-tab:hover { border-color: rgba(226,230,235,0.6); color: #FFFFFF; }
.pill-tab[aria-selected="true"], .pill-tab[aria-checked="true"] {
  color: #000000; border: 0; background: linear-gradient(180deg, #F4F6F8, #C9CED6); box-shadow: 0 0 30px rgba(226,230,235,0.25);
}
.pill-tab--sm { min-height: 42px; padding: 0 20px; font-size: 10px; background: transparent; }
.pill-tab--sm[aria-checked="true"] { box-shadow: none; }
@media (max-width: 767px) { .pill-tab { padding: 0 12px; letter-spacing: 0.2em; } }

/* ---------- Forms ---------- */
.f-input::placeholder { color: rgba(174,180,190,0.45); }
.f-input:focus { outline: none; border-color: #E6E9EE !important; }
.f-field.is-invalid .f-input { border-color: #E8A0A0 !important; }
.f-error { margin: 6px 0 0; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.15em; color: #E8A0A0; text-transform: none; }
.f-error:empty { display: none; }
.f-status { margin: 14px 0 0; font-size: 15px; color: #F1C6C6; }
.f-status:empty { display: none; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.is-loading .btn-label::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 12px; vertical-align: -1px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,0.25); border-top-color: #000; animation: bc-spin .8s linear infinite; }
button[disabled] { cursor: progress; opacity: .85; }

/* ---------- The Crest Take ---------- */
.take-chart-name { color: #E6E9EE; }
.take-thanks { animation: bc-fade .3s ease both; }
.featured-chart { display: block; margin-top: 20px; max-height: 220px; width: auto; border-radius: 4px; box-shadow: 0 0 0 1px rgba(199,204,212,0.25); }

/* ---------- Crest up (the peak) ---------- */
.crest-btn { cursor: pointer; color: #8A919C; transition: color .2s ease, border-color .2s ease; }
.crest-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; transition: filter .2s ease; }
.crest-btn[aria-pressed="true"] { color: #F4F6F8; border-color: rgba(244,246,248,0.6) !important; }
.crest-btn[aria-pressed="true"] svg { fill: #F4F6F8; stroke: #F4F6F8; filter: drop-shadow(0 0 6px rgba(244,246,248,0.6)); }
.crest-btn.is-popping svg { animation: bc-pop .35s ease; }
.crest-btn[aria-pressed="true"] .crest-count { color: #FFFFFF; }

/* ---------- Edition pop-up viewer ---------- */
html.viewer-open, html.viewer-open body { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(0,0,0,0.94); color: #E6E9EE; font-family: 'Geist', system-ui, sans-serif; animation: bc-fade .2s ease both; }
.viewer__bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; padding-top: calc(14px + env(safe-area-inset-top)); border-bottom: 1px solid rgba(255,255,255,0.12); background: #050607; }
.viewer__head { min-width: 0; }
.viewer__meta { margin: 0; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.3em; color: #8A919C; }
.viewer__title { margin: 4px 0 0; font-family: 'Instrument Serif', serif; font-size: 22px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.viewer__btn { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); color: #FFFFFF; cursor: pointer; background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03)); font-family: 'Geist Mono', monospace; font-size: 14px; line-height: 1; }
.viewer__btn:hover { color: #FFFFFF; border-color: rgba(255,255,255,0.5); }
.viewer__btn[disabled] { opacity: 0.3; cursor: default; }
.viewer__btn--text { font-size: 11px; letter-spacing: 0.2em; }
.viewer__close { margin-left: 8px; }
.viewer__count { min-width: 44px; text-align: center; font-family: 'Geist Mono', monospace; font-size: 11px; letter-spacing: 0.2em; color: #AEB4BE; }
.viewer__body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 28px 16px 48px; outline: none; }
.viewer__page { position: relative; max-width: 760px; min-height: 60vh; margin: 0 auto; }
.viewer__page img, .viewer__page iframe { display: block; width: 100%; height: auto; border: 0; border-radius: 6px; box-shadow: 0 0 0 1px rgba(199,204,212,0.2), 0 40px 100px rgba(0,0,0,0.8); background: #0A0B0D; }
.viewer__page iframe { height: 85vh; }
.viewer__loading { position: absolute; inset: 0; display: grid; place-content: center; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.4em; color: #8A919C; }
.viewer__page.is-loaded .viewer__loading { display: none; }
@media (max-width: 767px) {
  .viewer__bar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 10px; flex-wrap: wrap; }
  .viewer__head { flex: 1 1 calc(100% - 60px); order: 1; }
  .viewer__close { order: 2; margin-left: 0; }
  .viewer__actions { display: contents; }
  .viewer__btn:not(.viewer__close), .viewer__count { order: 3; }
  .viewer__title { font-size: 18px; }
  .viewer__body { padding: 16px 8px 40px; }
}

/* ---------- Image lightbox (charts on The Takes) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,0.92); cursor: zoom-out; animation: bc-fade .2s ease both; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 0 0 1px rgba(199,204,212,0.25); }

/* ---------- Sticky mobile bars ---------- */
.applybar { transition: transform .3s ease, opacity .3s ease; }
.applybar.is-hidden { transform: translateY(100%); opacity: 0; pointer-events: none; }

/* ---------- Simple pages (archive, thank you, privacy, terms) ---------- */
.legal { max-width: 760px; margin: 0 auto; }
.legal h1 { margin: 24px 0 0; font-family: 'Instrument Serif', serif; font-weight: 400; font-size: 64px; line-height: 1.02; }
.legal .eyebrow { margin: 0; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.5em; color: #8A919C; }
.legal .legal__meta { margin: 16px 0 0; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.3em; color: #8A919C; }
.legal .legal__intro { margin: 32px 0 0; font-size: 18px; color: #B4BAC4; }
.legal h2 { margin: 56px 0 0; padding-top: 28px; border-top: 1px solid rgba(199,204,212,0.25); font-family: 'Instrument Serif', serif; font-weight: 400; font-size: 32px; line-height: 1.15; }
.legal h3 { margin: 28px 0 0; font-family: 'Geist Mono', monospace; font-weight: 400; font-size: 11px; letter-spacing: 0.3em; color: #AEB4BE; }
.legal p, .legal li { color: #9AA1AC; font-size: 16px; }
.legal p { margin: 16px 0 0; }
.legal ul { margin: 16px 0 0; padding-left: 20px; }
.legal li + li { margin-top: 8px; }
.legal a { color: #E6E9EE; text-decoration: underline; text-underline-offset: 3px; }
.legal strong { color: #E6E9EE; font-weight: 600; }
.legal table { width: 100%; margin-top: 20px; border-collapse: collapse; font-size: 15px; }
.legal th, .legal td { padding: 14px 12px 14px 0; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(199,204,212,0.2); color: #9AA1AC; }
.legal th { font-family: 'Geist Mono', monospace; font-weight: 400; font-size: 10px; letter-spacing: 0.25em; color: #8A919C; }
.legal__table { overflow-x: auto; }
@media (max-width: 767px) { .legal h1 { font-size: 40px; } .legal h2 { font-size: 26px; } }

/* ---------- Reduced motion: no float, sheen, fan, timeline or shimmer ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-anim="sheen"] { display: none !important; }
  [data-anim="run"] { width: 100% !important; height: 100% !important; }
}

/* ---------- The Takes: filter chips and sidebar ---------- */
.chip { flex: 0 0 auto; min-height: 38px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.2em; white-space: nowrap; color: #C7CCD4; background: transparent; border: 1px solid rgba(199,204,212,0.3); }
.chip:hover { color: #FFFFFF; border-color: rgba(226,230,235,0.6); }
.chip[aria-pressed="true"] { color: #000000; border: 0; background: linear-gradient(180deg, #F4F6F8, #C9CED6); }
.takes-side { position: sticky; top: 24px; }
@media (max-width: 767px) { .takes-side { position: static; } }
[data-take].is-new { animation: bc-fade .4s ease both; }

/* ---------- Archive, thank you and legal pages ---------- */
.pg-archive { padding: 72px 40px 140px; }
.pg-simple { padding: 96px 40px 140px; }
.pg-h1 { font-size: 72px; }
.archive-grid { margin-top: 56px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
@media (max-width: 767px) {
  .pg-archive { padding: 32px 20px 96px; }
  .pg-simple { padding: 48px 20px 96px; }
  .pg-h1 { font-size: 44px; }
  .archive-grid { margin-top: 36px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .archive-grid > a { min-height: 240px !important; padding: 20px 16px !important; }
  .pg-btn { width: 100%; padding: 0 18px !important; font-size: 11px !important; letter-spacing: 0.22em !important; }
}

/* ---------- Tablets (768 to 1099px): tidy header and numbers row ---------- */
@media (min-width: 768px) and (max-width: 1099px) {
  header { flex-wrap: wrap !important; row-gap: 18px !important; }
  header > nav[aria-label="Main"] { order: 3; width: 100%; justify-content: space-between; gap: 12px !important; letter-spacing: 0.24em !important; }
  [aria-label="Proof in numbers"] > div > div { padding-left: 20px !important; }
  [aria-label="Proof in numbers"] > div > div:first-child { padding-left: 0 !important; }
  [aria-label="Proof in numbers"] > div > div > p:first-child { font-size: 46px !important; white-space: nowrap; }
}
.viewer__in { margin-left: 0.4em; }
@media (max-width: 767px) { .viewer__in { display: none; } .viewer__btn--text { padding: 0 10px; font-size: 10px; letter-spacing: 0.12em; } .viewer__actions { gap: 6px; } }
#viewer-share, #viewer-image { white-space: nowrap; }
.hero-share a:hover { border-color: rgba(226,230,235,0.7) !important; color: #FFFFFF !important; }
@media (max-width: 767px) { .hero-share a { flex: 1 1 100%; justify-content: center; } }

/* ---------- Cleaner type ---------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-kerning: normal; }
h1, h2, h3, blockquote, .viewer__title { text-wrap: balance; }
p, li, dd, figcaption, summary { text-wrap: pretty; }
@media (max-width: 767px) {
  /* small monospaced labels: tighter tracking reads cleaner on phones */
  [style*="'Geist Mono'"]:not([data-text="CARD_NUMBER"]) { letter-spacing: 0.16em !important; }
  [role="note"] { letter-spacing: 0.14em !important; }
}
@media (max-width: 767px) {
  .viewer__count { display: none !important; }
  .viewer__meta { letter-spacing: 0.14em; }
  .viewer__btn { min-width: 40px; height: 40px; }
  .viewer__btn:not(.viewer__close):not(.viewer__btn--text) { padding: 0 10px; }
}
@media (max-width: 767px) {
  .viewer__bar { position: relative; padding-right: 64px; }
  .viewer__head { flex: 1 1 100%; }
  .viewer__actions { display: flex !important; order: 3; flex: 1 1 100%; gap: 8px; flex-wrap: nowrap; }
  .viewer__close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; }
  .viewer__btn--text { padding: 0 9px !important; font-size: 9px !important; letter-spacing: 0.1em !important; }
  #viewer-image { margin-left: auto; }
}
.viewer__btn--text { white-space: nowrap; gap: 6px; }

/* ---------- Share today's headline (home) ---------- */
.share-sec { position: relative; padding: 120px 40px; border-bottom: 1px solid rgba(199,204,212,0.22); background: radial-gradient(ellipse 45% 60% at 78% 50%, rgba(190,198,212,0.12), rgba(0,0,0,0) 70%); }
.share-grid { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 475px; grid-template-areas: "text card" "actions card"; column-gap: 72px; align-items: center; }
.share-text { grid-area: text; align-self: end; min-width: 0; }
.share-actions { grid-area: actions; align-self: start; margin-top: 30px; }
.share-preview { grid-area: card; position: relative; width: 475px; max-width: 100%; height: 594px; justify-self: end; }
.share-eyebrow { letter-spacing: 0.5em; }
.share-h2 { font-size: 64px; }
.share-lede { font-size: 17px; }
#share-download[disabled] { opacity: .8; }
@media (max-width: 1099px) { .share-grid { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 40px; } .share-preview { width: 360px; height: 450px; } .share-h2 { font-size: 52px; } }
@media (max-width: 767px) {
  .share-sec { padding: 72px 20px; background: radial-gradient(ellipse 45% 60% at 50% 80%, rgba(190,198,212,0.12), rgba(0,0,0,0) 70%); }
  .share-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "card" "actions"; row-gap: 0; }
  .share-preview { width: 350px; height: 437px; justify-self: center; margin-top: 28px; }
  .share-eyebrow { letter-spacing: 0.32em; }
  .share-h2 { font-size: 38px; }
  .share-lede { font-size: 16px; }
  #share-download { width: 100%; }
}
