/* ════════════════════════════════════════════════════════════════════
   DESIGN SYSTEM — "OFFICINA DEL TEMPO"
   Single source of truth for the BookOracle dark aesthetic.
   Pages ADOPT this file; they do not redefine the skin.
   Change a token here once → it changes everywhere.

   Scope rule (zero-regression): every visual rule is scoped under
   `.ot-page` (set on <body>) or under an `.ot-*` component class.
   Merely LINKING this file changes nothing — a page only adopts the
   look when it opts in with `body.ot-page` / `.ot-*` classes.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Colour tokens ── */
  --ot-bg-deep:      #0b0b0d;
  --ot-bg-raise:     #141417;          /* slightly lifted surface          */
  --ot-ivory:        #f4f1ea;
  --ot-ivory-dim:    rgba(244, 241, 234, 0.74);
  --ot-ivory-faint:  rgba(244, 241, 234, 0.46);
  --ot-gold:         #b89a5e;
  --ot-gold-bright:  #e8c878;
  --ot-green:        #6fbf9a;           /* positive data                    */
  --ot-coral:        #c97b6f;           /* negative data                    */

  /* ── Glass surfaces (opacity variants) ── */
  --ot-glass:        rgba(244, 241, 234, 0.035);
  --ot-glass-strong: rgba(244, 241, 234, 0.06);
  --ot-border:       rgba(184, 154, 94, 0.24);   /* gold-tinted hairline    */
  --ot-border-soft:  rgba(244, 241, 234, 0.10);

  /* ── Radius / elevation ── */
  --ot-radius:    14px;
  --ot-radius-sm: 9px;
  --ot-shadow:    0 18px 48px rgba(0, 0, 0, 0.45);
  --ot-glow-gold: 0 0 0 1px rgba(184,154,94,0.35), 0 0 28px rgba(184,154,94,0.22);

  /* ── Typography tokens ── */
  --ot-font-serif: 'Cormorant Garamond', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --ot-font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ot-font-mono:  ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* ── Motion ── */
  --ot-ease:  cubic-bezier(0.22, 0.61, 0.36, 1);
  --ot-dur:   0.6s;
}

/* ════════════════════════════════════════════════════════════════════
   PAGE THEME — applies only when <body class="ot-page">
   Re-skins the shared _layout chrome (topbar / footer / links) to dark.
   Other templates never set this class → completely unaffected.
   ════════════════════════════════════════════════════════════════════ */
body.ot-page {
  background: var(--ot-bg-deep);
  color: var(--ot-ivory);
}
body.ot-page::before {                 /* soft vignette depth, decorative   */
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1100px 680px at 50% -8%, rgba(184,154,94,0.10), transparent 60%),
    radial-gradient(900px 700px at 90% 110%, rgba(111,191,154,0.06), transparent 60%);
  pointer-events: none; z-index: 0;
}
/* keep real content above the neural canvas + vignette */
body.ot-page .topbar,
body.ot-page main,
body.ot-page footer { position: relative; z-index: 2; }

/* Topbar */
body.ot-page .topbar {
  background: rgba(11, 11, 13, 0.72);
  border-bottom: 1px solid var(--ot-border-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body.ot-page .logo { color: var(--ot-ivory); font-family: var(--ot-font-serif); }
body.ot-page .logo span { color: var(--ot-gold); }
body.ot-page .nav-login { color: var(--ot-ivory-dim) !important; }
body.ot-page .nav-login:hover { color: var(--ot-gold-bright) !important; }
body.ot-page .nav-cta {
  background: linear-gradient(180deg, var(--ot-gold-bright), var(--ot-gold));
  color: #1a1408 !important; font-weight: 700;
}
body.ot-page .nav-cta:hover { filter: brightness(1.06); }
body.ot-page .lang-picker summary { color: var(--ot-ivory-dim); }
body.ot-page .lang-picker summary:hover,
body.ot-page .lang-picker[open] summary { background: var(--ot-glass-strong); color: var(--ot-ivory); }
body.ot-page .lang-picker .menu {
  background: #16161a; border: 1px solid var(--ot-border-soft);
  box-shadow: var(--ot-shadow);
}
body.ot-page .lang-picker .menu a { color: var(--ot-ivory) !important; }
body.ot-page .lang-picker .menu a:hover,
body.ot-page .lang-picker .menu a.active { background: var(--ot-glass-strong); color: var(--ot-gold-bright) !important; }

/* Body copy + headings */
body.ot-page main { color: var(--ot-ivory-dim); font-family: var(--ot-font-sans); line-height: 1.75; }
body.ot-page a { color: var(--ot-gold-bright); }
body.ot-page a:hover { color: var(--ot-ivory); }
body.ot-page article header h1 {
  font-family: var(--ot-font-serif); color: var(--ot-ivory);
  font-weight: 600; letter-spacing: -0.01em;
}
body.ot-page article header .subhead {
  font-family: var(--ot-font-serif); color: var(--ot-gold);
  font-style: italic;
}
body.ot-page h2 {
  font-family: var(--ot-font-serif); color: var(--ot-ivory); font-style: italic;
}
body.ot-page h2::before { background: var(--ot-gold); }
body.ot-page h3 { font-family: var(--ot-font-serif); color: var(--ot-ivory); }
body.ot-page p { color: var(--ot-ivory-dim); }

/* Re-skin the shared CTA block to dark/gold (markup unchanged) */
body.ot-page .cta-block {
  background: var(--ot-glass);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius);
  box-shadow: var(--ot-shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.ot-page .cta-block h3 { color: var(--ot-gold-bright); font-family: var(--ot-font-serif); }
body.ot-page .cta-block p { color: var(--ot-ivory-dim); }
body.ot-page .cta-button {
  background: linear-gradient(180deg, var(--ot-gold-bright), var(--ot-gold));
  color: #1a1408 !important; font-weight: 700;
  box-shadow: var(--ot-glow-gold);
}
body.ot-page .cta-button:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* Footer */
body.ot-page footer {
  border-top: 1px solid var(--ot-border-soft);
  color: var(--ot-ivory-faint);
}
body.ot-page footer a { color: var(--ot-gold); }
body.ot-page footer a:hover { color: var(--ot-gold-bright); }

/* ════════════════════════════════════════════════════════════════════
   REUSABLE COMPONENTS  (.ot-*) — usable on any page, any framework
   ════════════════════════════════════════════════════════════════════ */

/* Section title (serif) */
.ot-section-title {
  font-family: var(--ot-font-serif);
  color: var(--ot-ivory);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* Glass card */
.ot-card {
  background: var(--ot-glass);
  border: 1px solid var(--ot-border-soft);
  border-radius: var(--ot-radius);
  padding: 20px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .18s var(--ot-ease), transform .18s var(--ot-ease), box-shadow .18s var(--ot-ease);
}
.ot-card:hover {
  border-color: var(--ot-border);
  transform: translateY(-2px);
  box-shadow: var(--ot-shadow);
}

/* Buttons */
.ot-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ot-font-sans); font-weight: 700; font-size: 15px;
  padding: 12px 24px; border-radius: var(--ot-radius-sm);
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; line-height: 1;
  transition: transform .15s var(--ot-ease), filter .15s var(--ot-ease), background .15s var(--ot-ease);
}
.ot-btn--primary {
  background: linear-gradient(180deg, var(--ot-gold-bright), var(--ot-gold));
  color: #1a1408; box-shadow: var(--ot-glow-gold);
}
.ot-btn--primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.ot-btn--ghost {
  background: transparent; color: var(--ot-ivory);
  border-color: var(--ot-border);
}
.ot-btn--ghost:hover { background: var(--ot-glass-strong); border-color: var(--ot-gold); }

/* Badge / tag */
.ot-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ot-font-mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--ot-border); color: var(--ot-gold-bright);
  background: var(--ot-glass);
}
.ot-badge--up   { color: var(--ot-green); border-color: rgba(111,191,154,0.4); }
.ot-badge--down { color: var(--ot-coral); border-color: rgba(201,123,111,0.4); }

/* Data number (mono) with up/down variants */
.ot-data {
  font-family: var(--ot-font-mono); font-variant-numeric: tabular-nums;
  color: var(--ot-ivory); font-weight: 600;
}
.ot-data--up   { color: var(--ot-green); }
.ot-data--down { color: var(--ot-coral); }

/* Scrolling ticker */
.ot-ticker {
  overflow: hidden; white-space: nowrap; width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ot-ticker__track {
  display: inline-block; padding-left: 100%;
  font-family: var(--ot-font-mono); font-size: 13px; color: var(--ot-ivory-dim);
  animation: ot-ticker 28s linear infinite;
}
.ot-ticker__track > span { margin: 0 1.6em; }

/* ════════════════════════════════════════════════════════════════════
   SIGNATURE ANIMATIONS
   ════════════════════════════════════════════════════════════════════ */
@keyframes ot-fade-up   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ot-pulse     { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ot-glow      { 0%,100% { box-shadow: 0 0 0 0 rgba(184,154,94,0.0); } 50% { box-shadow: 0 0 22px 2px rgba(184,154,94,0.30); } }
@keyframes ot-ticker    { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

.ot-pulse { animation: ot-pulse 2.4s var(--ot-ease) infinite; }
.ot-glow  { animation: ot-glow 3s var(--ot-ease) infinite; }

/* Staggered entrance for direct children of an .ot-reveal container */
.ot-reveal > * { opacity: 0; animation: ot-fade-up var(--ot-dur) var(--ot-ease) forwards; }
.ot-reveal > *:nth-child(1) { animation-delay: .05s; }
.ot-reveal > *:nth-child(2) { animation-delay: .15s; }
.ot-reveal > *:nth-child(3) { animation-delay: .25s; }
.ot-reveal > *:nth-child(4) { animation-delay: .35s; }
.ot-reveal > *:nth-child(5) { animation-delay: .45s; }
.ot-reveal > *:nth-child(6) { animation-delay: .55s; }
.ot-reveal > *:nth-child(n+7) { animation-delay: .6s; }

/* ════════════════════════════════════════════════════════════════════
   REUSABLE NEURAL BACKGROUND  (always decorative, behind content)
   The <canvas data-ot-neural> is positioned by officina.js; this just
   guarantees it never captures clicks and never sits above content.
   ════════════════════════════════════════════════════════════════════ */
.ot-neural {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;                 /* below content (which is z-index:2) */
  pointer-events: none;
  display: block;
}

/* ════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — respect reduced motion everywhere
   ════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ot-reveal > *,
  .ot-pulse, .ot-glow,
  .ot-ticker__track,
  .ot-card { animation: none !important; transition: none !important; }
  .ot-reveal > * { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════════════════════════════════
   MOBILE-FIRST — components stay safe at 375px (no overlaps)
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .ot-card { padding: 16px; }
  .ot-btn { padding: 11px 18px; font-size: 14px; }
  .ot-section-title { letter-spacing: 0; }
}
