/* ============================================================================
   site.css — Konsensus brand stylesheet (SHARED SITE STYLING)
   ----------------------------------------------------------------------------
   Single source of truth for the Konsensus visual identity: theme tokens,
   fonts, typography, nav, footer, backdrop, buttons, inputs, cards.

   STATUS: created 2026-06-19, NOT WIRED to any page yet (no <link> references
   it). Two intended uses:
     1. BTCPay Server checkout/store theme customization (the immediate reason
        this file exists). Font URLs are ABSOLUTE to https://konsensus.net so
        the file is portable to any origin (BTCPay, etc.). Brand tokens live in
        the ":root / [data-theme]" block — map those onto BTCPay's own theme
        variables, or load this whole file as a custom theme and override.
     2. The planned site-wide CSS de-duplication refactor (see CLAUDE.md
        "Shared style across pages" + TODO "site.css extraction"). When wiring
        on-site, you may switch the @font-face URLs below to relative
        /assets/fonts/... (or just @import '/assets/fonts.css').

   Brand: orange #F7931A · purple #9B6ED0 · warm dark bg #110E0C · light #FAFAF8.
   Headings: Playfair Display (Le Monde Journal Std on-site via Adobe kit).
   Body: Inter.
   ========================================================================== */

/* ═══ FONTS (self-hosted; absolute URLs for cross-origin portability) ═══ */
/* Inter is a variable font here — one file covers weights 300–900. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/nuFiD-vYSZviVYUb_rj3ij__anPXDTzYgA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/nuFiD-vYSZviVYUb_rj3ij__anPXDTLYgFE_.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/nuFRD-vYSZviVYUb_rj3ij__anPXDTnCjmHKM4nYO7KN_qiTXtHA-Q.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(https://konsensus.net/assets/fonts/nuFRD-vYSZviVYUb_rj3ij__anPXDTnCjmHKM4nYO7KN_qiTXt_A-W2r.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

/* ═══ MOTION TOKENS ═══ */
:root {
  --transition-duration: 0.3s;
  --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

@media (prefers-reduced-motion: reduce) {
  :root { --transition-duration: 0.01ms; }
  html { scroll-behavior: auto; }
  .starfish-bg { animation: none !important; }
}

/* ═══ THEME TOKENS — the Konsensus palette (map these onto BTCPay) ═══ */
/* Light theme (default) */
[data-theme="light"] {
  --bg: #FAFAF8;
  --bg-elevated: #FFFFFF;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666;
  --text-dim: #999;
  /* Legible dim for TEXT (placeholders, captions, meta) — clears WCAG AA 4.5:1
     on the #FAFAF8 light bg (~4.9:1). Keep #999 for purely decorative dim. */
  --text-dim-legible: #6E6E6E;
  --orange: #F7931A;
  /* Accessible orange for TEXT/LINKS on the light bg (~4.8:1, passes AA).
     Bright --orange stays for headings, icons, borders, backgrounds. */
  --orange-text: #B45309;
  --purple: #7C4DBA;
  --border: #E8E6E2;
  --radius: 20px;
  --bg-nav: rgba(250, 250, 248, 0.85);
  --bg-card-hover: #F8F8F6;
  --border-hover: rgba(247,147,26,0.4);
  --img-brightness: 1;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 12px 40px rgba(0,0,0,0.1);
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #110E0C;
  --bg-elevated: #1A1614;
  --bg-card: #1C1815;
  --text: #F0F0F0;
  --text-secondary: #999;
  --text-dim: #555;
  /* Legible dim for TEXT on the #110E0C dark bg (~5.6:1, clears WCAG AA). */
  --text-dim-legible: #8C8C8C;
  --orange: #F7931A;
  /* On the dark bg bright orange already clears AA, so text keeps it. */
  --orange-text: #F7931A;
  --purple: #9B6ED0;
  --border: #2A2520;
  --radius: 20px;
  --bg-nav: rgba(17, 14, 12, 0.85);
  --bg-card-hover: #241F1B;
  --border-hover: rgba(247,147,26,0.3);
  --img-brightness: 0.92;
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-card-hover: 0 20px 60px rgba(0,0,0,0.6);
}

/* Fallback when no data-theme attribute is set (e.g. a bare BTCPay page):
   default to the light palette so this file is usable standalone. */
:root:not([data-theme]) {
  --bg: #FAFAF8;
  --bg-elevated: #FFFFFF;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666;
  --text-dim: #999;
  /* Legible dim for TEXT (placeholders, captions, meta) — clears WCAG AA 4.5:1
     on the #FAFAF8 light bg (~4.9:1). Keep #999 for purely decorative dim. */
  --text-dim-legible: #6E6E6E;
  --orange: #F7931A;
  --orange-text: #B45309;
  --purple: #7C4DBA;
  --border: #E8E6E2;
  --radius: 20px;
  --bg-nav: rgba(250, 250, 248, 0.85);
  --bg-card-hover: #F8F8F6;
  --border-hover: rgba(247,147,26,0.4);
  --img-brightness: 1;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 12px 40px rgba(0,0,0,0.1);
}

/* ═══ BASE ═══ */
/* Force a permanent scrollbar track (overflow-y:scroll) + reserve its gutter, so
   locking body scroll (drawers + the book-detail sideloader use position:fixed)
   never removes the scrollbar and shifts the page/nav ~15px ("jumps then
   settles"). overflow-y:scroll is the reliable, widely-supported base;
   scrollbar-gutter refines it on modern browsers. All site pages scroll. */
html { scroll-behavior: smooth; overflow-y: scroll; scrollbar-gutter: stable; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-duration) var(--transition-timing),
              color var(--transition-duration) var(--transition-timing);
  overflow-x: hidden;
}

a { color: var(--orange); text-decoration: none; transition: color 0.2s, opacity 0.2s; }
/* Structural / image / icon / card links all carry a class — keep the subtle fade. */
a:hover { opacity: 0.85; }
/* Real inline text links (classless <a>) get a proper, legible hover. */
a:not([class]):hover { color: var(--orange-text); text-decoration: underline; opacity: 1; }

/* ═══ TYPOGRAPHY ═══ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--text);
}
h1 { font-size: clamp(28px, 4.5vw, 48px); font-weight: 400; font-style: italic; letter-spacing: -1px; }
.text-secondary { color: var(--text-secondary); }
.text-dim { color: var(--text-dim-legible); }
.accent { color: var(--orange); }

/* ═══ FOCUS ═══ */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ═══ BUTTONS ═══ */
/* Primary = brand orange fill, near-black label (the site's canonical CTA). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  border: 1px solid transparent; border-radius: 12px;
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.2s, border-color 0.2s, background-color 0.2s, color 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--orange); color: #000; }
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--bg-elevated); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--orange); }

.btn-ghost { background: transparent; color: var(--orange); }
.btn-ghost:hover { background: rgba(247,147,26,0.08); }

/* ═══ FORM INPUTS ═══ */
/* Base styling for UNstyled inputs. Wrapped in :where() so the whole selector
   carries ZERO specificity — any page-level rule (class OR element) always wins,
   so this can never again silently clobber .search-input / .blog-search etc.
   (:where keeps the type-list so checkboxes/radios/file/submit stay untouched.) */
:where(input[type="text"], input[type="email"], input[type="search"],
       input[type="password"], input[type="number"], textarea, select) {
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.3s;
}
input:focus, textarea:focus, select:focus { border-color: var(--orange); }
::placeholder { color: var(--text-dim-legible); }

/* Keyboard focus ring for form controls, buttons and links (WCAG 2.4.7) —
   restores a visible outline over the base `outline: none`, in both themes. */
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ═══ CARDS ═══ */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 2.5vw, 28px);
  color: inherit;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.3s, border-color 0.3s;
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--orange);
}

/* ═══ NAV ═══ */
nav {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: var(--bg-nav);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  transition: background-color var(--transition-duration) var(--transition-timing);
}
.nav-left { display: flex; align-items: center; gap: 10px; }
.nav-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.nav-brand img { width: 28px; height: 28px; }
.nav-brand-text {
  font-family: 'Fraunces', var(--font-display);
  font-size: 1.15rem; font-weight: 400; font-style: normal;
  font-variation-settings: 'opsz' 40;
  text-transform: lowercase;
  letter-spacing: -0.5px;
}
.nav-links { display: flex; gap: 2px; margin-left: 8px; list-style: none; }
.nav-links a {
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.82rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  transition: all 0.25s; white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: rgba(247,147,26,0.08); }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elevated);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.theme-toggle:hover { border-color: var(--orange); }
.icon-sun, .icon-moon { position: absolute; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
[data-theme="dark"] .icon-sun { transform: rotate(90deg) scale(0); opacity: 0; }
[data-theme="dark"] .icon-moon { transform: rotate(0) scale(1); opacity: 1; }
[data-theme="light"] .icon-sun { transform: rotate(0) scale(1); opacity: 1; }
[data-theme="light"] .icon-moon { transform: rotate(-90deg) scale(0); opacity: 0; }

/* Mobile burger nav */
.nav-burger {
  display: none; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  cursor: pointer; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 0; flex: 0 0 auto;
}
.nav-burger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .2s; }
.nav-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 768px) and (orientation: portrait) {
  .nav-burger { display: flex; }
  nav .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px !important; align-items: stretch;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 8px 14px; margin: 0 !important; display: none !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.22); z-index: 60;
  }
  nav .nav-links.open { display: flex !important; }
  nav .nav-links a { font-size: .98rem !important; padding: 12px 12px !important; white-space: nowrap; }
}

/* ═══ STARFISH BACKDROP ═══ */
.starfish-bg {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.starfish-geo {
  position: absolute;
  top: 50%; left: 50%;
  width: min(90vw, 90vh); height: min(90vw, 90vh);
  margin-top: calc(-0.5 * min(90vw, 90vh));
  margin-left: calc(-0.5 * min(90vw, 90vh));
  opacity: 0.30;
  animation: starfish-drift 25s ease-in-out infinite;
}
[data-theme="dark"] .starfish-geo { opacity: 0.25; }
@keyframes starfish-drift {
  0%, 100% { transform: rotate(0deg) scale(1) translate(0, 0); }
  25%      { transform: rotate(15deg) scale(1.08) translate(25px, -15px); }
  50%      { transform: rotate(-12deg) scale(0.94) translate(-20px, 20px); }
  75%      { transform: rotate(8deg) scale(1.03) translate(12px, 8px); }
}

/* ═══ FOOTER ═══ */
footer {
  width: 100%;
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--text-dim-legible);
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

/* ═══ LANGUAGE SWITCH ═══ */
.lang-switch { position: relative; display: inline-flex; }
.lang-btn {
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  border-radius: 50px; padding: 4px 8px 4px 10px; display: inline-flex;
  align-items: center; gap: 4px; color: var(--text); font-family: inherit;
  font-size: 0.85rem; line-height: 1;
}
.lang-btn:hover { border-color: var(--orange); }
.lang-btn .lang-flag { font-size: 1.05rem; line-height: 1; }
.lang-btn .lang-chev { font-size: 0.7rem; opacity: 0.6; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18); z-index: 1000;
  display: flex; flex-direction: column; gap: 2px;
}
.lang-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; color: var(--text); text-decoration: none; font-size: 0.85rem;
}
.lang-item:hover { background: rgba(247,147,26,0.1); color: var(--orange); }
.lang-item.active { background: rgba(247,147,26,0.16); color: var(--orange); font-weight: 600; }
.lang-item .lang-flag { font-size: 1.1rem; }
.lang-menu[hidden] { display: none; }

/* ═══ SOCIAL LINKS ═══ */
.social-links { display: flex; justify-content: center; gap: clamp(16px, 3vw, 32px); }
.social-link {
  color: var(--text-dim-legible);
  transition: color 0.25s, transform 0.25s;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: 0.78rem; font-weight: 500;
}
.social-link:hover { color: var(--orange); transform: translateY(-1px); }
.social-link svg { width: 20px; height: 20px; }

/* ============================================================================
   BTCPay note
   ----------------------------------------------------------------------------
   Do NOT load this whole file into BTCPay — its reset (`*`), `body`, `nav`,
   `.card` rules collide with BTCPay's own Bootstrap layout. For BTCPay use the
   sibling file `btcpay-theme.css`, which maps the Konsensus palette above onto
   BTCPay v2.3.8's real `--btcpay-*` theme variables (verified against the
   v2.3.8 source) and is upload-ready for Server Settings → Branding → Custom
   Theme. This file (site.css) is the on-site brand source for the eventual
   page de-duplication refactor.
   ========================================================================== */
