/* ============================================================
   Thought Pattern AI - Design Tokens
   Dark editorial brand: aubergine #2C0A2C ground, acid yellow
   #E4E527 accent, three-voice type (Fitzgerald · Cormorant
   Garamond · Space Mono). Deco ornament vocabulary.
   ============================================================ */

/* Cormorant Garamond + Space Mono - self-hosted (latin subset, woff2). Both are
   SIL Open Font License 1.1; the license texts ship alongside the files in
   assets/fonts/ (OFL-*.txt). Kept local so the site loads no third-party origin. */
/* Cormorant Garamond ships from Google as one variable file per style, covering
   the full weight axis; one range @font-face each for roman and italic. */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("assets/fonts/space-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("assets/fonts/space-mono-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("assets/fonts/space-mono-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Fitzgerald - primary display face (local, ships Regular + Black) */
@font-face {
  font-family: "Fitzgerald";
  src: url("assets/fonts/fitzgerald.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fitzgerald";
  src: url("assets/fonts/fitzblack.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* -------- Brand ------------------------------------------ */
  --tp-yellow: #e4e527; /* accent · the voice of rule   */
  --tp-yellow-hi: #f2f36b; /* hover / lift                 */
  --tp-yellow-lo: #bdbe1c; /* pressed / dim                */
  --tp-yellow-deep: #9c9d17; /* reading-weight yellow on dark */
  --tp-yellow-glow: rgba(228, 229, 39, 0.22);

  --tp-aubergine: #160716; /* default ground - Ink         */
  --tp-aubergine-1: #0d040d; /* deeper surface / recessed    */
  --tp-aubergine-2: #2a0f2c; /* elevated surface / card      */
  --tp-aubergine-3: #3d1940; /* raised / hover fill          */

  /* -------- Neutrals on dark ------------------------------- */
  --tp-ink-0: #f7f3f7; /* primary text on aubergine - Vellum */
  --tp-ink-1: #ded5de; /* body                          */
  --tp-ink-2: #b9adb9; /* muted, subtitles, meta        */
  --tp-ink-3: #91808f; /* subtle, placeholder           */
  --tp-ink-4: #4a3a4c; /* hairlines, disabled           */

  --tp-line: rgba(247, 243, 247, 0.12); /* 1px borders */
  --tp-line-strong: rgba(247, 243, 247, 0.22);
  --tp-line-yellow: rgba(228, 229, 39, 0.55);
  --tp-rule: rgba(228, 229, 39, 0.35); /* deco brass rule */

  /* -------- Semantic (tuned for aubergine ground) ---------- */
  --tp-success: #4ade80;
  --tp-success-bg: rgba(74, 222, 128, 0.12);
  --tp-running: #7dd3fc;
  --tp-running-bg: rgba(125, 211, 252, 0.14);
  --tp-warning: #fbbf24;
  --tp-warning-bg: rgba(251, 191, 36, 0.14);
  --tp-danger: #f87171;
  --tp-danger-bg: rgba(248, 113, 113, 0.15);
  --tp-pending: var(--tp-ink-3);

  /* -------- Semantic tokens -------------------------------- */
  --tp-bg: var(--tp-aubergine);
  --tp-bg-surface: var(--tp-aubergine-2);
  --tp-bg-recessed: var(--tp-aubergine-1);
  --tp-bg-raised: var(--tp-aubergine-3);
  --tp-bg-inverse: var(--tp-ink-0);

  --tp-fg: var(--tp-ink-0);
  --tp-fg-body: var(--tp-ink-1);
  --tp-fg-muted: var(--tp-ink-2);
  --tp-fg-subtle: var(--tp-ink-3);
  --tp-fg-display: var(--tp-yellow); /* section eyebrows */

  --tp-border: var(--tp-line);
  --tp-border-strong: var(--tp-line-strong);
  --tp-border-active: var(--tp-yellow);

  --tp-action: var(--tp-yellow);
  --tp-action-hover: var(--tp-yellow-hi);
  --tp-action-pressed: var(--tp-yellow-lo);
  --tp-action-fg: var(--tp-aubergine); /* yellow needs dark text */

  /* -------- Typography - three voices --------------------- */
  --tp-font-display: "Fitzgerald", "Didot", "Bodoni 72", "Century Gothic", sans-serif;
  --tp-font-serif: "Cormorant Garamond", "EB Garamond", "Garamond", Georgia, serif;
  --tp-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tp-font-mono: "Space Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  /* Reading sizes scale slightly larger - serifs need room */
  --tp-fs-xs: 0.78rem;
  --tp-fs-sm: 0.85rem;
  --tp-fs-base: 1rem;
  --tp-fs-md: 1.0625rem; /* 17px  - body serif          */
  --tp-fs-lg: 1.25rem; /* 20px  - section intros       */
  --tp-fs-xl: 1.5rem; /* 24px  - h3 / pull            */
  --tp-fs-2xl: 2rem; /* 32px  - h2 display           */
  --tp-fs-3xl: 3.25rem; /* 52px  - h1 deco display      */

  --tp-fw-light: 300;
  --tp-fw-regular: 400;
  --tp-fw-medium: 500;
  --tp-fw-semi: 600;
  --tp-fw-bold: 700;

  --tp-lh-tight: 1.1;
  --tp-lh-snug: 1.3;
  --tp-lh-body: 1.55; /* serifs breathe                   */

  --tp-ls-display: 0.08em; /* display tracking             */
  --tp-ls-caps: 0.25em; /* small-caps eyebrows          */
  --tp-ls-mono: 0.14em; /* mono meta labels             */

  /* -------- Spacing (4-pt base) ---------------------------- */
  --tp-space-0: 0;
  --tp-space-1: 4px;
  --tp-space-2: 8px;
  --tp-space-3: 12px;
  --tp-space-4: 16px;
  --tp-space-5: 20px;
  --tp-space-6: 24px;
  --tp-space-8: 32px;
  --tp-space-9: 36px;
  --tp-space-10: 40px;
  --tp-space-12: 48px;
  --tp-space-16: 64px;
  --tp-space-20: 80px;

  /* -------- Radii - deco is rectilinear -------------------- */
  --tp-radius-none: 0;
  --tp-radius-xs: 2px;
  --tp-radius-sm: 4px;
  --tp-radius-md: 6px;
  --tp-radius-lg: 8px;
  --tp-radius-pill: 999px;

  /* -------- Elevation ------------------------------------- */
  --tp-shadow-none: none;
  --tp-shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.55);
  --tp-shadow-focus: 0 0 0 3px var(--tp-yellow-glow);
  --tp-shadow-glow: 0 0 0 1px var(--tp-line-yellow), 0 0 24px rgba(228, 229, 39, 0.18);

  /* -------- Motion ---------------------------------------- */
  --tp-duration-fast: 120ms;
  --tp-duration-base: 180ms;
  --tp-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* -------- Gradients - ground only ----------------------- */
  /* Near-black plum ground with magenta glows, matching the Figma comps. */
  --tp-gradient-ground:
    radial-gradient(1200px 600px at 20% -10%, rgba(196, 92, 206, 0.1), transparent 60%),
    radial-gradient(900px 500px at 85% 110%, rgba(196, 92, 206, 0.12), transparent 50%),
    linear-gradient(180deg, #160716 0%, #0d040d 100%);
  --tp-gradient-yellow: linear-gradient(135deg, #f2f36b 0%, #e4e527 55%, #bdbe1c 100%);
}

/* ============================================================
   Element defaults - editorial register
   ============================================================ */

html,
body {
  font-family: var(--tp-font-serif);
  font-size: var(--tp-fs-md);
  font-weight: var(--tp-fw-regular);
  line-height: var(--tp-lh-body);
  color: var(--tp-fg-body);
  background: var(--tp-bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* H1 / H2 - Fitzgerald display, airy tracking */
h1,
h2 {
  font-family: var(--tp-font-display);
  color: var(--tp-fg);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-display);
  margin: 0 0 var(--tp-space-5);
}
h1 {
  font-size: var(--tp-fs-3xl);
  line-height: var(--tp-lh-tight);
}
h2 {
  font-size: var(--tp-fs-2xl);
  line-height: var(--tp-lh-snug);
}

/* H3 - Cormorant, serif with italic tendencies kept optional */
h3 {
  font-family: var(--tp-font-serif);
  color: var(--tp-fg);
  font-size: var(--tp-fs-xl);
  font-weight: var(--tp-fw-semi);
  line-height: var(--tp-lh-snug);
  letter-spacing: 0;
  margin: 0 0 var(--tp-space-3);
}

p {
  color: var(--tp-fg-body);
  line-height: var(--tp-lh-body);
  margin: 0 0 var(--tp-space-4);
}

em,
i {
  font-style: italic;
  color: var(--tp-fg);
}
strong,
b {
  font-weight: var(--tp-fw-semi);
  color: var(--tp-fg);
}

/* ---- Editorial utility classes ---- */

/* Eyebrow / section label - "I · Positioning" */
.tp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--tp-space-4);
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-caps);
  text-transform: uppercase;
  color: var(--tp-yellow-deep);
}

/* Section intro - italic serif, editorial */
.tp-intro {
  font-family: var(--tp-font-serif);
  font-style: italic;
  font-size: var(--tp-fs-lg);
  line-height: 1.45;
  color: var(--tp-ink-1);
  max-width: 640px;
  margin: 0 0 var(--tp-space-12);
}

/* Mono meta - specs, coordinates, timestamps */
.tp-meta {
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-mono);
  text-transform: uppercase;
  color: var(--tp-fg-muted);
}

/* Subtitle - serif italic or muted serif */
.tp-subtitle {
  font-family: var(--tp-font-serif);
  font-style: italic;
  font-size: var(--tp-fs-lg);
  color: var(--tp-fg-muted);
}

code,
pre,
kbd,
samp {
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-sm);
  color: var(--tp-ink-1);
}
pre {
  background: var(--tp-bg-recessed);
  color: var(--tp-ink-0);
  padding: var(--tp-space-4);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  overflow-x: auto;
  line-height: 1.6;
}

/* ============================================================
   Ornament vocabulary - deco structural elements
   ============================================================ */

/* Double rule - brass/yellow, for mastheads and section breaks */
.tp-rule-double {
  border-top: 1px solid var(--tp-yellow-deep);
  border-bottom: 1px solid var(--tp-yellow-deep);
  height: 4px;
  margin: var(--tp-space-8) 0;
}

/* Section-label rule - matches eyebrow; line leads + trails */
.tp-section-label {
  display: flex;
  align-items: center;
  gap: var(--tp-space-5);
  margin-bottom: var(--tp-space-12);
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-caps);
  text-transform: uppercase;
  color: var(--tp-yellow-deep);
}
.tp-section-label::before {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--tp-yellow);
  flex: none;
}
.tp-section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--tp-rule);
}

/* Deco divider - line · diamond · line */
.tp-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--tp-space-4);
  margin: var(--tp-space-12) 0;
}
.tp-divider::before,
.tp-divider::after {
  content: "";
  width: 120px;
  height: 1px;
  background: var(--tp-yellow-deep);
}
.tp-divider-diamond {
  width: 8px;
  height: 8px;
  background: var(--tp-yellow);
  transform: rotate(45deg);
}

/* Corner brackets - for hero / plate cards. Apply to a positioned
   parent with .tp-brackets, and it paints four hairline L's. */
.tp-brackets {
  position: relative;
}
.tp-brackets::before,
.tp-brackets::after,
.tp-brackets > .tp-brackets-bl,
.tp-brackets > .tp-brackets-br {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 0 solid var(--tp-yellow);
  pointer-events: none;
}
.tp-brackets::before {
  top: 10px;
  left: 10px;
  border-top-width: 1px;
  border-left-width: 1px;
}
.tp-brackets::after {
  top: 10px;
  right: 10px;
  border-top-width: 1px;
  border-right-width: 1px;
}
.tp-brackets > .tp-brackets-bl {
  bottom: 10px;
  left: 10px;
  border-bottom-width: 1px;
  border-left-width: 1px;
}
.tp-brackets > .tp-brackets-br {
  bottom: 10px;
  right: 10px;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

/* Paper grain - faint radial wash on the body, editorial depth */
.tp-grain::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(228, 229, 39, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(228, 229, 39, 0.025) 0%, transparent 55%);
}

/* ============================================================
   Controls - deco rectilinear, serif-body mixed with mono labels
   ============================================================ */

.tp-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--tp-space-2);
  padding: 10px 20px;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-caps);
  text-transform: uppercase;
  border: 1px solid var(--tp-line-yellow);
  border-radius: var(--tp-radius-none);
  background: transparent;
  color: var(--tp-fg);
  cursor: pointer;
  transition:
    background var(--tp-duration-fast) var(--tp-ease-out),
    border-color var(--tp-duration-fast) var(--tp-ease-out),
    color var(--tp-duration-fast) var(--tp-ease-out);
}
.tp-btn:hover {
  background: var(--tp-bg-raised);
  border-color: var(--tp-yellow);
  color: var(--tp-yellow);
}
.tp-btn:focus-visible {
  outline: none;
  box-shadow: var(--tp-shadow-focus);
}

.tp-btn--primary {
  background: var(--tp-action);
  color: var(--tp-action-fg);
  border-color: var(--tp-action);
}
.tp-btn--primary:hover {
  background: var(--tp-action-hover);
  border-color: var(--tp-action-hover);
  color: var(--tp-action-fg);
}
.tp-btn--primary:active {
  background: var(--tp-action-pressed);
  border-color: var(--tp-action-pressed);
}

.tp-btn--danger {
  background: transparent;
  color: var(--tp-danger);
  border-color: var(--tp-danger);
}

/* Inputs - recessed, hairline, yellow focus */
.tp-input,
.tp-select,
.tp-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--tp-font-serif);
  font-size: var(--tp-fs-md);
  color: var(--tp-fg);
  background: var(--tp-bg-recessed);
  border: 1px solid var(--tp-border-strong);
  border-radius: var(--tp-radius-none);
}
.tp-input::placeholder,
.tp-textarea::placeholder {
  color: var(--tp-fg-subtle);
  font-style: italic;
}
.tp-input:focus,
.tp-select:focus,
.tp-textarea:focus {
  outline: none;
  border-color: var(--tp-yellow);
  box-shadow: var(--tp-shadow-focus);
}
.tp-label {
  display: block;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: var(--tp-ls-caps);
  text-transform: uppercase;
  color: var(--tp-fg-muted);
  margin-bottom: var(--tp-space-2);
}

/* Pills */
.tp-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--tp-radius-pill);
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  font-weight: var(--tp-fw-regular);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(247, 243, 247, 0.08);
  color: var(--tp-ink-1);
  border: 1px solid var(--tp-border);
}
.tp-pill--active {
  background: var(--tp-success-bg);
  color: var(--tp-success);
  border-color: rgba(74, 222, 128, 0.35);
}
.tp-pill--running {
  background: var(--tp-running-bg);
  color: var(--tp-running);
  border-color: rgba(125, 211, 252, 0.35);
}
.tp-pill--warning {
  background: var(--tp-warning-bg);
  color: var(--tp-warning);
  border-color: rgba(251, 191, 36, 0.35);
}
.tp-pill--danger {
  background: var(--tp-danger-bg);
  color: var(--tp-danger);
  border-color: rgba(248, 113, 113, 0.35);
}
.tp-pill--highlight {
  background: var(--tp-yellow);
  color: var(--tp-action-fg);
  border-color: var(--tp-yellow);
}

/* Cards - hairline-ruled, rectilinear, no rounded-everything */
.tp-card {
  background: var(--tp-bg-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  padding: var(--tp-space-6);
  color: var(--tp-fg-body);
}
.tp-card--plate {
  /* Heavy editorial plate: rectilinear, bracket-ready */
  background: var(--tp-bg-surface);
  border: 1px solid var(--tp-rule);
  border-radius: 0;
  padding: var(--tp-space-12) var(--tp-space-8);
  position: relative;
}
.tp-card--active {
  border-color: var(--tp-yellow);
  box-shadow: var(--tp-shadow-glow);
}

/* Plate caption - "Fig. 01 - Primary Mark · Aubergine" */
.tp-plate-caption {
  position: absolute;
  bottom: -28px;
  left: 0;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-fs-xs);
  letter-spacing: var(--tp-ls-caps);
  text-transform: uppercase;
  color: var(--tp-yellow-deep);
}
