/*
 Theme Name:   Esc Theory Child
 Theme URI:    https://esctheory.com
 Description:  Esc Theory child theme for Divi 5. Implements the brand design system
               tokens: colors, type scale, spacing, radius, motion. All custom pages
               and Divi layouts inherit these variables. Do not edit parent theme files.
 Author:       Esc Theory
 Template:     Divi
 Version:      1.0.0
*/

/* ============================================================
   Google Fonts — Nunito (display) + Plus Jakarta Sans (body) + JetBrains Mono
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   DESIGN TOKENS
   Source of truth for every Divi page, module, and custom CSS.
   ============================================================ */
:root {

  /* ── COLOR — Foundation ──────────────────────────────── */
  --color-ink:          #0B0D10;   /* near-black — the wordmark ground */
  --color-ink-2:        #14171B;   /* one step up — cards on dark */
  --color-ink-3:        #1D2026;   /* hover state on dark surfaces */
  --color-paper:        #FFFFFF;   /* clean white — default light ground */
  --color-paper-2:      #F7F7F6;   /* faint off-white — secondary surfaces */
  --color-paper-3:      #EDEDEB;   /* deeper off-white — cards/hover */

  /* ── COLOR — Brand ───────────────────────────────────── */
  --color-primary:      #E77638;   /* marquee orange */
  --color-primary-deep: #0B3756;   /* midnight navy */

  /* ── COLOR — Neutral scale ───────────────────────────── */
  --neutral-50:   #FFFFFF;
  --neutral-100:  #F7F7F6;
  --neutral-200:  #EDEDEB;
  --neutral-300:  #D8D8D5;
  --neutral-400:  #A8A8A4;
  --neutral-500:  #76766F;
  --neutral-600:  #4E4E48;
  --neutral-700:  #2F2F2B;
  --neutral-800:  #1F1F1C;
  --neutral-900:  #14171B;
  --neutral-950:  #0B0D10;

  /* ── COLOR — World palette (one per room surface, never mixed) ── */
  --world-marquee:   #E77638;   /* Jetsteam orange — brand accent */
  --world-gold:      #E5B530;   /* Echo Unit / Curio & Co. / DEFCON */
  --world-vermilion: #B33A22;   /* Stage 7 / Solaris / Sugarworks */
  --world-folia:     #5BA050;   /* Folia Labs */
  --world-atlas:     #2293B8;   /* Outpost Zero / Ark DNA */
  --world-midnight:  #0B3756;   /* Nebula Lounge / Aetherworks */
  --world-plum:      #3D3577;   /* Enchanted Workshop */
  --world-magenta:   #C13D88;   /* Shroud Kata */

  /* ── COLOR — Status ──────────────────────────────────── */
  --status-open:  #2F7A4A;
  --status-full:  #7A2A2A;
  --status-warn:  #C66B1F;
  --status-info:  #2F6FA8;

  /* ── COLOR — Semantic (light default) ───────────────── */
  --color-bg:               var(--color-paper);
  --color-bg-secondary:     var(--color-paper-2);
  --color-bg-tertiary:      var(--color-paper-3);
  --color-fg:               var(--color-ink);
  --color-fg-secondary:     var(--neutral-600);
  --color-fg-tertiary:      var(--neutral-500);
  --color-fg-on-dark:       var(--color-paper);
  --color-accent:           var(--color-ink);
  --color-accent-world:     var(--world-marquee);
  --color-border-primary:   var(--neutral-700);
  --color-border-secondary: var(--neutral-400);
  --color-border-tertiary:  var(--neutral-300);

  /* ── TYPE — Families ─────────────────────────────────── */
  --font-display: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans:    'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SFMono-Regular', 'Menlo', monospace;

  /* ── TYPE — Scale ────────────────────────────────────── */
  --text-2xs:  11px;
  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-md:   18px;
  --text-lg:   22px;
  --text-xl:   28px;
  --text-2xl:  36px;
  --text-3xl:  48px;
  --text-4xl:  64px;
  --text-5xl:  88px;
  --text-6xl:  120px;

  /* ── TYPE — Weights ──────────────────────────────────── */
  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;
  --weight-extrabold: 800;
  --weight-black:     900;

  /* ── TYPE — Leading ──────────────────────────────────── */
  --leading-tight:   1.0;
  --leading-snug:    1.15;
  --leading-normal:  1.5;
  --leading-relaxed: 1.6;

  /* ── TYPE — Tracking ─────────────────────────────────── */
  --tracking-tighter: -0.03em;
  --tracking-tight:   -0.015em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-badge:   0.14em;
  --tracking-widest:  0.18em;

  /* ── SPACING — 8pt base ──────────────────────────────── */
  --space-1:    4px;
  --space-2:    8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   24px;
  --space-6:   32px;
  --space-7:   48px;
  --space-8:   64px;
  --space-9:   96px;
  --space-10: 128px;
  --space-11: 192px;

  /* ── RADIUS ───────────────────────────────────────────── */
  --radius-none: 0;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-key:  18px;   /* Esc keycap */
  --radius-full: 9999px;

  /* ── BORDERS ─────────────────────────────────────────── */
  --border-hairline: 1px solid var(--color-border-tertiary);
  --border-thin:     1.5px solid var(--color-border-secondary);
  --border-strong:   2px solid var(--color-border-primary);
  --border-keycap:   3px solid var(--color-ink);

  /* ── SHADOWS ─────────────────────────────────────────── */
  --shadow-keycap: 0 2px 0 var(--color-ink);
  --shadow-soft:   0 4px 24px -8px rgba(11, 13, 16, 0.18);
  --shadow-focus:  0 0 0 3px var(--color-bg), 0 0 0 6px var(--world-marquee);

  /* ── MOTION ──────────────────────────────────────────── */
  --ease-key:     cubic-bezier(0.34, 1.2, 0.64, 1);
  --ease-curtain: cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --dur-instant:  0ms;
  --dur-fast:     140ms;
  --dur-base:     260ms;
  --dur-slow:     520ms;
}

/* ============================================================
   Dark theme
   ============================================================ */
[data-theme="dark"], .et-dark, .theme-dark {
  --color-bg:               var(--color-ink);
  --color-bg-secondary:     var(--color-ink-2);
  --color-bg-tertiary:      var(--color-ink-3);
  --color-fg:               var(--color-paper);
  --color-fg-secondary:     var(--neutral-300);
  --color-fg-tertiary:      var(--neutral-400);
  --color-border-primary:   var(--neutral-300);
  --color-border-secondary: var(--neutral-500);
  --color-border-tertiary:  var(--neutral-700);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}

/* ============================================================
   Element defaults — override Divi's base
   ============================================================ */
body, #page-container {
  font-family: var(--font-sans) !important;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-fg);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--world-marquee);
  color: var(--color-paper);
}

/* ── Headings ─────────────────────────────────────────────── */
h1, .et-display-xl {
  font-family: var(--font-display) !important;
  font-weight: var(--weight-black);
  font-size: clamp(56px, 9vw, var(--text-6xl));
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
  text-transform: lowercase;
}

h2, .et-headline {
  font-family: var(--font-display) !important;
  font-weight: var(--weight-extrabold);
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

h3, .et-subhead {
  font-family: var(--font-sans) !important;
  font-weight: var(--weight-semibold);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

h4, .et-eyebrow {
  font-family: var(--font-sans) !important;
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-badge);
  text-transform: uppercase;
  color: var(--color-fg-tertiary);
}

p, .et-prose {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  max-width: 62ch;
  text-wrap: pretty;
}

a, .et-link {
  color: inherit;
  text-decoration: none;
  font-weight: var(--weight-semibold);
  transition: color var(--dur-fast) var(--ease-curtain);
}

a:hover, .et-link:hover { color: var(--world-marquee); }

/* ============================================================
   The Esc keycap — inline signature element
   ============================================================ */
.et-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  text-transform: lowercase;
  letter-spacing: var(--tracking-tighter);
  background: transparent;
  color: var(--color-fg);
  border: 3px solid currentColor;
  border-radius: var(--radius-key);
  padding: 0.2em 0.6em 0.25em;
  line-height: 1;
}

.et-keycap--filled {
  background: var(--color-fg);
  color: var(--color-bg);
  border-color: var(--color-fg);
}

/* ============================================================
   Buttons — override Divi's defaults site-wide
   ============================================================ */

/* Primary — marquee orange */
.et_pb_button,
.et-btn,
a.et_pb_button {
  font-family: var(--font-sans) !important;
  font-size: var(--text-sm) !important;
  font-weight: var(--weight-bold) !important;
  letter-spacing: var(--tracking-wide) !important;
  border-radius: var(--radius-md) !important;
  padding: 14px 22px !important;
  background: var(--color-primary) !important;
  color: var(--color-ink) !important;
  border: none !important;
  box-shadow: none !important;
  text-transform: none !important;
  transition: background var(--dur-fast) var(--ease-curtain) !important;
  min-height: 44px;
  cursor: pointer;
}

.et_pb_button:hover,
a.et_pb_button:hover {
  background: #D26227 !important;
  color: var(--color-ink) !important;
}

/* Ink variant */
.et-btn--ink {
  background: var(--color-ink) !important;
  color: var(--color-paper) !important;
}

.et-btn--ink:hover {
  background: var(--neutral-800) !important;
  color: var(--color-paper) !important;
}

/* Outline variant */
.et-btn--outline {
  background: transparent !important;
  color: var(--color-ink) !important;
  border: 2px solid var(--color-ink) !important;
  padding: 12px 20px !important;
}

.et-btn--outline:hover {
  background: var(--color-ink) !important;
  color: var(--color-paper) !important;
}

/* Keycap CTA — module_class="et-btn-keycap" lands directly on the <a> in Divi 5 */
a.et-btn-keycap,
a.et-btn--keycap {
  font-family: var(--font-display) !important;
  font-weight: var(--weight-black) !important;
  font-size: 14px !important;
  text-transform: lowercase !important;
  letter-spacing: var(--tracking-tighter) !important;
  border: 3px solid currentColor !important;
  border-radius: var(--radius-key) !important;
  padding: 12px 28px 16px !important;
  box-shadow: 0 4px 0 currentColor !important;
  transition: transform var(--dur-fast) var(--ease-key),
              box-shadow var(--dur-fast) var(--ease-key),
              background var(--dur-fast) var(--ease-curtain) !important;
}

a.et-btn-keycap:active,
a.et-btn--keycap:active {
  transform: translateY(4px) !important;
  box-shadow: none !important;
}

/* Remove Divi's default button arrow */
a.et-btn-keycap::after,
a.et-btn--keycap::after {
  display: none !important;
}

/* ============================================================
   Form inputs — override Divi defaults
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select,
.et_pb_contact_field input,
.et_pb_contact_field textarea {
  font-family: var(--font-sans) !important;
  font-size: 16px !important;
  font-weight: var(--weight-medium) !important;
  background: var(--color-bg) !important;
  color: var(--color-fg) !important;
  border: 1.5px solid var(--color-border-secondary) !important;
  border-radius: var(--radius-md) !important;
  padding: 12px 14px !important;
  outline: none !important;
  transition: border-color var(--dur-fast) var(--ease-curtain),
              box-shadow var(--dur-fast) var(--ease-curtain) !important;
  min-height: 44px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-fg) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* ============================================================
   Divi section/row/module utility overrides
   ============================================================ */

/* Dark section helper — add class "et-section-dark" to section */
.et-section-dark {
  background: var(--color-ink) !important;
  color: var(--color-paper) !important;
}

.et-section-dark .et_pb_text * {
  color: var(--color-paper) !important;
}

/* Ink-2 section (slightly lighter dark) */
.et-section-ink-2 {
  background: var(--color-ink-2) !important;
}

/* Paper section */
.et-section-paper {
  background: var(--color-paper) !important;
}

/* ============================================================
   Tags / status / keycap inline utilities
   ============================================================ */
.et-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  line-height: 1.1;
}

.et-tag--marquee { background: var(--color-primary); color: var(--color-ink); }
.et-tag--ink     { background: var(--color-ink); color: var(--color-paper); }
.et-tag--outline { background: transparent; color: var(--color-fg); border: 1.5px solid var(--color-fg); }
.et-tag--quiet   { background: transparent; color: var(--color-fg-secondary); border: 1.5px solid var(--color-border-secondary); }

/* ============================================================
   Navigation — Divi header overrides
   ============================================================ */
#main-header,
#main-header .et_pb_row {
  font-family: var(--font-sans) !important;
}

#et-secondary-nav ul li a,
#et-secondary-menu ul li a,
#top-header,
#et-top-navigation,
#et-top-navigation nav ul li a {
  font-family: var(--font-sans) !important;
  font-size: var(--text-sm) !important;
  font-weight: var(--weight-semibold) !important;
  text-transform: lowercase !important;
  letter-spacing: 0 !important;
}

/* ============================================================
   Marquee strip — horizontal scrolling ink band
   ============================================================ */
@keyframes et-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.et-marquee {
  background: var(--color-ink);
  color: var(--color-paper);
  padding: 20px 0;
  overflow: hidden;
}

.et-marquee__track {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: et-marquee 28s linear infinite;
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: 28px;
  line-height: 1;
  letter-spacing: var(--tracking-tighter);
  text-transform: lowercase;
}

/* ============================================================
   Patch spinner — brand loading indicator
   ============================================================ */
@keyframes et-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.et-spinner {
  position: relative;
  width: 96px;
  height: 96px;
  display: inline-block;
}

.et-spinner__arc {
  position: absolute;
  inset: 0;
  border: 3px solid var(--color-border-tertiary);
  border-top-color: var(--color-fg);
  border-right-color: var(--color-fg);
  border-radius: 50%;
  animation: et-spin 1.4s linear infinite;
}

.et-spinner__core {
  position: absolute;
  inset: 12px;
  background: var(--color-fg);
  color: var(--color-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: 22px;
  text-transform: lowercase;
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}
