/* ==========================================================================
   403 Finance — Redesign layer (2026-07)
   Transmute-site layout language in the FF black/crimson identity.
   Loaded LAST (after main/glass/blog/pricing/cards.min) — everything here
   deliberately overrides the ported Ghost-theme look. Post BODIES are never
   edited; this file restyles them from the outside.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Fraunces — display serif (variable, self-hosted; matches build-doc brand)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/Fraunces-var-italic-latin-ext.woff2') format('woff2-variations');
  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: 'Fraunces';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/Fraunces-var-italic-latin.woff2') format('woff2-variations');
  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: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/Fraunces-var-normal-latin-ext.woff2') format('woff2-variations');
  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: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/Fraunces-var-normal-latin.woff2') format('woff2-variations');
  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;
}

/* --------------------------------------------------------------------------
   1. Token overrides — FF palette, calmer surfaces, editorial type scale
   -------------------------------------------------------------------------- */
:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  /* looser, larger display scale than the Ghost theme */
  --font-display-lg-size: clamp(38px, 5vw, 56px);
  --font-display-md-size: clamp(30px, 4vw, 40px);
  --font-display-sm-size: clamp(24px, 3vw, 30px);
  --radius-md: 14px;
  --radius-lg: 18px;
}

/* Tell the browser which UA palette to use for form controls (select popups,
   scrollbars). Without this, dark theme gets light option lists with
   inherited light text = invisible dropdowns. */
[data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

[data-theme="dark"] {
  --color-bg: #0A0A0B;
  --color-surface: #101013;
  --color-surface-variant: #17171B;
  --color-elevated: #1D1D22;
  /* transmute-style hairlines instead of glassmorphism glow */
  --color-line: rgba(255, 255, 255, 0.09);
  --color-line-accent: rgba(200, 16, 46, 0.35);
  --color-glass-fill: rgba(255, 255, 255, 0.025);
  --color-glass-border: var(--color-line);
  --crimson-glow: rgba(165, 0, 33, 0.16);
  --gold-glow: rgba(255, 215, 0, 0.05);
}
[data-theme="light"] {
  --color-bg: #FAF7F4;            /* paper, transmute-style */
  --color-surface: #FFFFFF;
  --color-surface-variant: #F1EDE8;
  --color-elevated: #FFFFFF;
  --color-line: rgba(26, 26, 26, 0.12);
  --color-line-accent: rgba(165, 0, 33, 0.3);
  --color-glass-fill: rgba(26, 26, 26, 0.02);
  --color-glass-border: var(--color-line);
  --crimson-glow: rgba(165, 0, 33, 0.07);
  --gold-glow: rgba(198, 152, 47, 0.06);
}

/* Display serif for all heading surfaces */
h1, h2, h3,
.display-large, .display-medium, .display-small,
.headline-large, .headline-medium,
.post-header__title,
.blog-card__title, .featured-card__title,
.error-page__code {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 60;
  letter-spacing: -0.01em;
}
.display-large { font-weight: 560; line-height: 1.12; }
.display-medium, .display-small { font-weight: 540; }

/* Eyebrow labels (transmute language) — used via existing .label-large chips */
.label-large, .archive-header__label, .corp-product__kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary-light);
}

/* --------------------------------------------------------------------------
   2. Surfaces — bordered cards, hairlines, radial hero glows
   -------------------------------------------------------------------------- */
body {
  background:
    radial-gradient(1100px 420px at 82% -8%, var(--crimson-glow), transparent 62%),
    radial-gradient(900px 480px at -12% 12%, var(--gold-glow), transparent 55%),
    var(--color-bg);
}
/* the animated Ghost-era canvas fights the new calm surfaces — retire it */
#gradient-mesh { display: none; }

/* Ciphertext background — the encrypted-ledger motif (replaced the chain
   fence 2026-07-07). Faint rows of cipher fragments, tinted per surface:
   faded crimson on corporate + FF, gold on Transmute. The cursor spotlight
   layer "decrypts" it locally — the per-household-encryption story as a
   visual. Disable by deleting the two divs in Base.astro. */
#chain-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--chain-tint, rgba(200, 16, 46, 0.14));
  /* tile ∩ edge vignette: ciphertext lives in the page margins and fades to
     nothing where content sits — the spotlight still reveals it anywhere */
  -webkit-mask-image:
    radial-gradient(120% 95% at 50% 42%, transparent 34%, rgba(0, 0, 0, 0.5) 62%, #000 92%),
    url('/assets/images/cipher.svg');
  mask-image:
    radial-gradient(120% 95% at 50% 42%, transparent 34%, rgba(0, 0, 0, 0.5) 62%, #000 92%),
    url('/assets/images/cipher.svg');
  -webkit-mask-repeat: no-repeat, repeat;
  mask-repeat: no-repeat, repeat;
  -webkit-mask-size: 100% 100%, 320px 240px;
  mask-size: 100% 100%, 320px 240px;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  transition: background-color var(--transition-slow);
}
/* Cursor spotlight: a brighter copy of the ciphertext revealed only inside a
   radial window at the pointer (two mask layers intersected). --mx/--my are
   set by /js/chain-parallax.js; parked off-screen when the pointer leaves. */
#chain-bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--chain-glow-tint, rgba(220, 40, 60, 0.42));
  -webkit-mask-image:
    radial-gradient(circle 190px at var(--mx, -999px) var(--my, -999px), #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 72%),
    url('/assets/images/cipher.svg');
  mask-image:
    radial-gradient(circle 190px at var(--mx, -999px) var(--my, -999px), #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 72%),
    url('/assets/images/cipher.svg');
  -webkit-mask-repeat: no-repeat, repeat;
  mask-repeat: no-repeat, repeat;
  -webkit-mask-size: auto, 320px 240px;
  mask-size: auto, 320px 240px;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  opacity: 0;
  transition: opacity 0.35s ease;
}
body.chain-glow-on #chain-bg-glow { opacity: 1; }
/* content sits above the fence; header highest so its dropdowns clear the page */
.site-main, .site-footer, .construction-banner {
  position: relative;
  z-index: 1;
}
.site-header { position: relative; z-index: 120; }
.nav-toggle, .site-nav-overlay { z-index: 130; }
body.ff-section { --chain-tint: rgba(200, 16, 46, 0.13); }
body.transmute-section {
  --chain-tint: rgba(198, 152, 47, 0.08);
  --chain-glow-tint: rgba(198, 152, 47, 0.32);
}
[data-theme="light"] #chain-bg { opacity: 0.6; }

.glass-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition-fast), transform var(--transition-normal);
}
.glass-card:hover {
  border-color: var(--color-line-accent);
}

.site-header {
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.site-footer {
  border-top: 1px solid var(--color-line);
  margin-top: var(--space-xxxl);
}
.construction-banner {
  background: linear-gradient(90deg, rgba(165, 0, 33, 0.25), rgba(122, 0, 25, 0.18));
  border-bottom: 1px solid var(--color-line-accent);
}

/* Section rhythm — tightened 2026-07-06 after review: the first pass stacked
   with the ported pages' own block padding and produced 200-300px voids. */
.section { padding-block: clamp(36px, 5vw, 64px); }
.section--sm { padding-block: clamp(24px, 3.5vw, 40px); }
.section--lg { padding-block: clamp(48px, 6.5vw, 88px); }
/* Blocks that carry their own padding must not ALSO get full section padding */
.section.feature-detail { padding-block: clamp(20px, 3vw, 40px); }
.feature-detail { padding-block: 0; }
/* consecutive sections share one gap, not two */
.section + .section,
.section--sm + .section,
.section + .section--sm { padding-top: clamp(16px, 2.5vw, 32px); }

/* --------------------------------------------------------------------------
   3. Article layout — breakout grid (fixes the "scrunched" posts)
      Text measure ~720px; media/tables break out to ~1080px ("wide");
      kg-width-full goes edge-to-edge of the page container.
      Post HTML is untouched — placement is all CSS.
   -------------------------------------------------------------------------- */
.post-content {
  display: grid;
  grid-template-columns:
    [full-start] minmax(0, 1fr)
    [wide-start] minmax(0, 220px)
    [content-start] min(100%, 760px) [content-end]
    minmax(0, 220px) [wide-end]
    minmax(0, 1fr) [full-end];
  max-width: 1280px;
  margin-inline: auto;
  column-gap: 0;
}
.post-content > * { grid-column: content; min-width: 0; }
.post-content > .kg-width-wide { grid-column: wide; }
.post-content > .kg-width-full { grid-column: full; }
/* images + tables breathe by default on wide screens */
.post-content > .kg-image-card,
.post-content > .kg-gallery-card,
.post-content > table {
  grid-column: wide;
}

.post-content .kg-image-card { margin-block: var(--space-xl); }
.post-content .kg-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-line);
}
.post-content figcaption {
  margin-top: var(--space-sm);
  font-size: var(--font-body-sm-size);
  color: var(--color-text-tertiary);
  text-align: center;
}

/* Callouts (Ghost cards.min gives layout; tune colors for the dark theme) */
.post-content .kg-callout-card {
  border: 1px solid var(--color-line-accent);
  border-radius: var(--radius-md);
  margin-block: var(--space-lg);
}
[data-theme="dark"] .post-content .kg-callout-card-red {
  background: rgba(165, 0, 33, 0.12);
}
.post-content .kg-callout-text { color: var(--color-text-secondary); }

/* Blockquotes — editorial serif pull style */
.post-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: var(--space-sm) var(--space-lg);
  margin-block: var(--space-lg);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-glass-fill);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Tables — responsive without touching post HTML: the table itself becomes
   the horizontal scroll container on small screens. */
.post-content table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin-block: var(--space-xl);
  font-size: var(--font-body-md-size);
  line-height: 1.5;
}
.post-content table th,
.post-content table td {
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  text-align: left;
  vertical-align: top;
  min-width: 120px;
  color: var(--color-text-secondary);
}
.post-content table th {
  background: var(--color-surface-variant);
  color: var(--color-text-primary);
  font-weight: 700;
  white-space: nowrap;
}
.post-content table tr:nth-child(even) td {
  background: var(--color-glass-fill);
}

/* Post header — roomier, serif title, hairline under meta */
.post-header__title {
  max-width: 900px;
  margin-inline: auto;
}
.post-header__meta {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-line);
  margin-bottom: var(--space-xl);
}
.post-header__image img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-line);
}

/* Reading rhythm */
.post-content p, .post-content li {
  font-size: 18px;
  line-height: 1.75;
}
.post-content h2 { margin-top: var(--space-xxxl); }
.post-content hr {
  grid-column: content;
  border: 0;
  border-top: 1px solid var(--color-line);
  margin-block: var(--space-xl);
  width: 100%;
}

@media (max-width: 767px) {
  .post-content {
    grid-template-columns:
      [full-start] 0
      [wide-start] 0
      [content-start] 100% [content-end]
      0 [wide-end]
      0 [full-end];
  }
  .post-content p, .post-content li { font-size: 17px; }
  .post-content table th, .post-content table td { min-width: 96px; padding: 8px 10px; }
}

/* --------------------------------------------------------------------------
   4. Product scoping — each product carries its accent inside the unified
      shell. Corporate default stays the calm black/crimson; FF sections get
      their richer crimson character back; Transmute gets crimson/gold.
      Applied via wrapper classes: .product-scope--{product} (blog posts),
      .ff-section (FF marketing pages), .transmute-section (TM pages).
   -------------------------------------------------------------------------- */
.ff-section,
.product-scope--forbidden-finance {
  --color-primary: #A50021;
  --color-primary-dark: #7A0019;
  --color-primary-light: #C8102E;
  --color-line-accent: rgba(200, 16, 46, 0.45);
  --color-glass-fill: rgba(165, 0, 33, 0.05);
  --crimson-glow: rgba(165, 0, 33, 0.22);
}
.transmute-section,
.product-scope--transmute {
  --color-primary: #9e1b32;
  --color-primary-dark: #7a1527;
  --color-primary-light: #c6982f;
  --color-line-accent: rgba(198, 152, 47, 0.4);
  --color-glass-fill: rgba(198, 152, 47, 0.05);
  --crimson-glow: rgba(158, 27, 50, 0.18);
  --gold-glow: rgba(198, 152, 47, 0.1);
}

/* --------------------------------------------------------------------------
   5. Blog filter pills + product badges
   -------------------------------------------------------------------------- */
.blog-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.blog-filter__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.blog-filter__pill img { border-radius: 3px; }
.blog-filter__pill:hover {
  border-color: var(--color-line-accent);
  color: var(--color-text-primary);
}
.blog-filter__pill--active {
  border-color: var(--color-primary);
  background: var(--color-glass-fill);
  color: var(--color-text-primary);
}

.blog-card__chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.product-badge img { border-radius: 2px; }
.product-badge:hover { color: var(--color-text-primary); border-color: var(--color-line-accent); }
.product-badge[data-product="transmute"] { color: #c6982f; }
.product-badge[data-product="forbidden-finance"] { color: var(--color-primary-light); }

/* --------------------------------------------------------------------------
   5b. Product navigation — top-bar dropdowns + in-section sub-nav bar
   -------------------------------------------------------------------------- */
.site-nav__item--dropdown { position: relative; }
.site-nav__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 200px;
  padding: 8px;
  background: var(--color-elevated);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  z-index: 110;
}
.site-nav__item--dropdown:hover .site-nav__dropdown,
.site-nav__item--dropdown:focus-within .site-nav__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.site-nav__dropdown a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--font-body-md-size);
  color: var(--color-text-secondary);
}
.site-nav__dropdown a:hover {
  background: var(--color-glass-fill);
  color: var(--color-text-primary);
}
.site-nav__dropdown-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--color-line);
}

/* mobile overlay: indented product sub-links */
.site-nav-overlay__sublist {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  padding: 0 0 var(--space-md) var(--space-lg);
}
.site-nav-overlay__sublink {
  color: var(--color-text-tertiary);
}
.site-nav-overlay__sublink:hover { color: var(--color-text-primary); }

/* --------------------------------------------------------------------------
   6. Form controls (contact selector etc.) — themed, never UA-transparent
   -------------------------------------------------------------------------- */
.form-select {
  width: 100%;
  max-width: 24rem;
  padding: 0.6em 2.4em 0.6em 1em;
  border-radius: 10px;
  border: 1px solid var(--color-line);
  background-color: var(--color-surface-variant);
  color: var(--color-text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9em center;
  cursor: pointer;
}
.form-select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.form-select option {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}
