/* ==========================================================================
   @NoProfessional582 (Nicholas L.) // Clean Editorial Portfolio Design System
   Inspired by Devon Stank & Trace Developer, harmonized with Kinship/Newsfeed
   ========================================================================== */

:root {
  /* Warm Paper (Light Theme Default) */
  --paper: #f6f3ec;
  --paper-elevated: #fcfaf6;
  --paper-subtle: #ede8de;
  --paper-card: #ffffff;
  --ink: #1c1b18;
  --ink-secondary: #52504a;
  --ink-muted: #78746b;
  --line: #dcd6ca;
  --line-strong: #c5bdb0;

  /* Signature Editorial Accents */
  --terracotta: #bd5b3f;
  --terracotta-hover: #9e472e;
  --terracotta-soft: rgba(189, 91, 63, 0.11);
  --moss: #5c7053;
  --moss-soft: rgba(92, 112, 83, 0.12);
  --ochre: #b08038;
  --ochre-soft: rgba(176, 128, 56, 0.13);
  --slate: #436170;
  --slate-soft: rgba(67, 97, 112, 0.12);

  /* Typography */
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout & Spacing */
  --max-w: 1320px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(28, 27, 24, 0.05), 0 6px 18px rgba(28, 27, 24, 0.05);
  --shadow-md: 0 4px 12px rgba(28, 27, 24, 0.07), 0 20px 48px rgba(28, 27, 24, 0.08);
  --shadow-lg: 0 12px 32px rgba(28, 27, 24, 0.12), 0 32px 72px rgba(28, 27, 24, 0.12);

  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Warm Obsidian (Dark Editorial Theme) */
  --paper: #141311;
  --paper-elevated: #1c1a17;
  --paper-subtle: #25231f;
  --paper-card: #1f1d1a;
  --ink: #f3efe6;
  --ink-secondary: #bdb7aa;
  --ink-muted: #8c8679;
  --line: #2e2b26;
  --line-strong: #423e37;

  --terracotta: #df8265;
  --terracotta-hover: #eb987e;
  --terracotta-soft: rgba(223, 130, 101, 0.14);
  --moss: #8da682;
  --moss-soft: rgba(141, 166, 130, 0.15);
  --ochre: #d9a95b;
  --ochre-soft: rgba(217, 169, 91, 0.15);
  --slate: #82a7b8;
  --slate-soft: rgba(130, 167, 184, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45), 0 22px 52px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.6), 0 36px 80px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* Base Reset & Accessibility */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
}

/* Typography Utilities */
h1, h2, h3, h4, .serif {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.14;
  margin: 0;
  text-wrap: balance;
}

.mono {
  font-family: var(--font-mono);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--terracotta);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kicker::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1.5px;
  background-color: var(--terracotta);
}

/* Container & Structural Grid */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 40px;
  }
}

/* ==========================================================================
   Sticky Editorial Masthead / Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (min-width: 768px) {
  .nav-bar {
    padding: 16px 40px;
  }
}

.brand-identity {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}

.brand-handle {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand-handle span {
  color: var(--terracotta);
}

.brand-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-secondary);
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 900px) {
  .nav-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .brand-identity {
    justify-self: start;
  }

  .nav-links {
    display: flex;
    justify-self: center;
  }

  .nav-actions {
    justify-self: end;
  }
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: color 0.15s ease;
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--ink);
}

.nav-links a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--terracotta);
  border-radius: 2px;
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--terracotta);
  margin-right: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-elevated);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
  transition: all 0.15s ease;
}

.social-pill:hover {
  color: var(--ink);
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-elevated);
  display: inline-grid;
  place-items: center;
  color: var(--ink-secondary);
  transition: all 0.15s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper-subtle);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun {
  display: none;
}

/* ==========================================================================
   Hero Section (Devon Stank / Trace Developer Editorial Impact)
   ========================================================================== */
.hero {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

@media (min-width: 900px) {
  .hero {
    padding: 96px 0 80px;
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: end;
}

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: 8fr 4fr;
    gap: 56px;
  }
}

.hero-title {
  font-size: clamp(2.4rem, 4.8vw, 4.35rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin-top: 18px;
  color: var(--ink);
}

.hero-title em {
  font-style: italic;
  color: var(--terracotta);
  font-weight: 400;
}

.hero-lead {
  margin-top: 24px;
  font-size: clamp(1.05rem, 1.35vw, 1.22rem);
  color: var(--ink-secondary);
  max-width: 68ch;
  line-height: 1.65;
}

.hero-cta-row {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--paper-elevated);
  color: var(--ink);
  transition: all 0.16s ease;
}

.btn:hover {
  border-color: var(--ink);
  background: var(--paper-subtle);
}

.btn-primary {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fcfaf6;
}

:root[data-theme="dark"] .btn-primary {
  color: #141311;
}

.btn-primary:hover {
  background: var(--terracotta-hover);
  border-color: var(--terracotta-hover);
}

.hero-aside {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.hero-aside-title {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--moss);
  font-weight: 600;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--moss);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.metric-box {
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.metric-val {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Editorial Section Layout (Sticky Left Index Rail + Right Content)
   ========================================================================== */
.editorial-section {
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 960px) {
  .editorial-section {
    padding: 96px 0;
  }
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}

@media (min-width: 960px) {
  .section-grid {
    grid-template-columns: 320px 1fr;
    gap: 56px;
    align-items: start;
  }
}

.section-rail {
  position: relative;
}

@media (min-width: 960px) {
  .section-rail.sticky {
    position: sticky;
    top: 104px;
  }
}

.section-number {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--terracotta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}

.section-heading {
  font-size: clamp(1.85rem, 2.8vw, 2.55rem);
  color: var(--ink);
  margin-bottom: 14px;
}

.section-summary {
  font-size: 0.96rem;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ==========================================================================
   About & Philosophy Components
   ========================================================================== */
.rail-role {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-secondary);
  margin: -4px 0 14px;
  letter-spacing: 0.02em;
}

.prose-lead {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.38;
  color: var(--ink);
  margin: 0 0 24px;
}

.prose-body {
  color: var(--ink-secondary);
  font-size: 1.02rem;
  line-height: 1.75;
}

.prose-body p {
  margin: 0 0 18px;
}

.principles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 32px;
}

@media (min-width: 680px) {
  .principles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.principle-card {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.principle-idx {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--terracotta);
  margin-bottom: 8px;
  display: block;
}

.principle-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.principle-card p {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin: 0;
  line-height: 1.55;
}

/* Stack Matrix */
.stack-matrix {
  margin-top: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-elevated);
  overflow: hidden;
}

.stack-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.stack-row:last-child {
  border-bottom: none;
}

@media (min-width: 640px) {
  .stack-row {
    grid-template-columns: 210px 1fr;
    align-items: baseline;
    gap: 20px;
  }
}

.stack-cat {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
}

.tag-accent {
  background: var(--terracotta-soft);
  border-color: color-mix(in srgb, var(--terracotta) 35%, var(--line));
  color: var(--terracotta);
}

/* ==========================================================================
   AI-Assisted Engineering Workflow Section
   ========================================================================== */
.workflow-pipeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 28px;
}

@media (min-width: 768px) {
  .workflow-pipeline {
    grid-template-columns: repeat(2, 1fr);
  }
}

.workflow-stage {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px;
  position: relative;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--terracotta-soft);
  border: 1px solid color-mix(in srgb, var(--terracotta) 35%, var(--line));
  color: var(--terracotta);
  font-weight: 500;
}

.stage-owner {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.workflow-stage h3 {
  font-size: 1.32rem;
}

.workflow-stage p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.workflow-proof {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.workflow-proof strong {
  color: var(--ink);
}

/* Agent Roster Strip */
.agent-roster {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ==========================================================================
   Selected Works // Homepage Case Study Showcase Cards
   ========================================================================== */
.showcase-list {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.showcase-card {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 900px) {
  .showcase-card {
    padding: 40px;
  }
}

.showcase-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}

@media (min-width: 1024px) {
  .showcase-grid {
    grid-template-columns: 5fr 7fr;
    gap: 44px;
  }
}

.showcase-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.showcase-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--terracotta);
}

.showcase-title {
  font-size: clamp(1.8rem, 2.5vw, 2.35rem);
  margin-bottom: 8px;
}

.showcase-tagline {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
}

.showcase-desc {
  font-size: 0.94rem;
  color: var(--ink-secondary);
  margin: 0 0 20px;
  line-height: 1.65;
}

.showcase-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.showcase-highlights li {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  padding-left: 18px;
  position: relative;
}

.showcase-highlights li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--terracotta);
  font-family: var(--font-mono);
}

.showcase-highlights strong {
  color: var(--ink);
  font-weight: 600;
}

.showcase-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Browser / App Window Frame */
.window-frame {
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.window-bar {
  background: var(--paper-subtle);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.window-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.window-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.window-dots span:nth-child(1) { background: #d9776c; }
.window-dots span:nth-child(2) { background: #d4a759; }
.window-dots span:nth-child(3) { background: #6b9e78; }

.window-url {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--ink-muted);
  background: var(--paper);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-viewport {
  position: relative;
  background: #141311;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  cursor: zoom-in;
}

.window-viewport img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.35s ease;
}

.window-viewport:hover img {
  transform: scale(1.015);
}

.window-caption-bar {
  padding: 10px 14px;
  background: var(--paper-elevated);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-tab {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-secondary);
  transition: all 0.15s ease;
}

.preview-tab:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.preview-tab[aria-selected="true"] {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fcfaf6;
}

:root[data-theme="dark"] .preview-tab[aria-selected="true"] {
  color: #141311;
}

/* ==========================================================================
   Case Study Sub-Page Styles (projects/*.html)
   ========================================================================== */
.case-hero {
  padding: 48px 0 44px;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-secondary);
  margin-bottom: 24px;
  transition: color 0.15s ease;
}

.breadcrumb:hover {
  color: var(--terracotta);
}

.case-specs-bar {
  margin-top: 36px;
  padding: 20px 24px;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (min-width: 840px) {
  .case-specs-bar {
    grid-template-columns: repeat(5, 1fr);
  }
}

.spec-item dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.spec-item dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

/* Interactive Case Study Gallery */
.gallery-stage {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .gallery-stage {
    padding: 28px;
  }
}

.gallery-main-frame {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #121210;
  position: relative;
  transition: max-width 0.25s ease, border-radius 0.25s ease;
  margin: 0 auto;
}

.gallery-main-img-wrap {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: zoom-in;
}

.gallery-main-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #121210;
}

[data-gallery][data-mobile-view="true"] .gallery-main-frame {
  max-width: 390px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}

[data-gallery][data-mobile-view="true"] .gallery-main-img-wrap {
  aspect-ratio: 390 / 800;
}

[data-gallery][data-mobile-view="true"] .gallery-main-img-wrap img {
  object-fit: cover;
}

.gallery-caption-row {
  padding: 14px 18px;
  background: var(--paper-card);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gallery-caption-text {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin: 0;
}

.gallery-thumbs {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.thumb-btn {
  text-align: left;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thumb-btn:hover {
  border-color: var(--line-strong);
}

.thumb-btn[aria-selected="true"] {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
  box-shadow: 0 0 0 1px var(--terracotta);
}

.thumb-btn img {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.thumb-btn[data-thumb-mobile="true"] img {
  object-fit: contain;
  object-position: center;
  background: var(--paper-subtle);
  padding: 4px 0;
}

.thumb-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Technical Architecture Diagrams & Spec Tables */
.arch-diagram {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}

.arch-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .arch-flow {
    grid-template-columns: repeat(4, 1fr);
  }
}

.arch-node {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
}

.arch-node-step {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--terracotta);
  margin-bottom: 6px;
  display: block;
}

.arch-node h4 {
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.arch-node p {
  font-size: 0.83rem;
  color: var(--ink-secondary);
  margin: 0;
  line-height: 1.5;
}

.spec-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-elevated);
  margin: 20px 0;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.spec-table th,
.spec-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.spec-table th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: var(--paper-subtle);
}

.spec-table tr:last-child td {
  border-bottom: none;
}

.spec-table code,
p code,
li code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  color: var(--ink);
}

pre.code-block {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.6;
  background: #171614;
  color: #f3efe6;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  overflow-x: auto;
  margin: 18px 0;
}

pre.code-block code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Case Study Footer Navigation */
.case-nav-footer {
  padding: 48px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 680px) {
  .case-nav-footer {
    grid-template-columns: repeat(2, 1fr);
  }
}

.case-nav-card {
  padding: 22px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--paper-elevated);
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.case-nav-card:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}

/* Native HTML5 Dialog Lightbox */
dialog.lightbox {
  max-width: min(94vw, 1360px);
  max-height: 92vh;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #121110;
  color: #f3efe6;
  box-shadow: var(--shadow-lg);
}

dialog.lightbox::backdrop {
  background: rgba(12, 11, 10, 0.82);
  backdrop-filter: blur(6px);
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

.lightbox-bar {
  padding: 12px 18px;
  background: #1c1a17;
  border-bottom: 1px solid #2e2b26;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lightbox-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #d6d0c4;
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lightbox-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--terracotta);
  background: rgba(189, 91, 63, 0.16);
  border: 1px solid rgba(189, 91, 63, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.lightbox-body {
  padding: 16px 64px;
  overflow: auto;
  display: grid;
  place-items: center;
  position: relative;
  user-select: none;
}

@media (max-width: 680px) {
  .lightbox-body {
    padding: 12px 44px;
  }
}

.lightbox-body img {
  max-height: 78vh;
  width: auto;
  border-radius: 6px;
}

.lightbox-nav,
.stage-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 19, 17, 0.78);
  color: #fcfaf6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.lightbox-nav:hover,
.stage-nav:hover {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fcfaf6;
  transform: translateY(-50%) scale(1.06);
}

.lightbox-nav:focus-visible,
.stage-nav:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.lightbox-nav.prev {
  left: 14px;
}

.lightbox-nav.next {
  right: 14px;
}

.stage-nav {
  width: 36px;
  height: 36px;
  opacity: 0.85;
}

.stage-nav.prev {
  left: 12px;
}

.stage-nav.next {
  right: 12px;
}

.window-viewport:hover .stage-nav,
.gallery-main-img-wrap:hover .stage-nav {
  opacity: 1;
}

.lightbox-nav svg,
.stage-nav svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Site Footer */
.site-footer {
  padding: 56px 0 64px;
  background: var(--paper-elevated);
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ==========================================================================
   Agentic Development System // Process Deep-Dive Components
   ========================================================================== */

/* At-a-Glance Metrics Strip */
.stats-strip {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 680px) {
  .stats-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1080px) {
  .stats-strip {
    grid-template-columns: repeat(6, 1fr);
  }
}

.stat-card {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.stat-card-val {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.2vw, 2.1rem);
  font-weight: 600;
  color: var(--terracotta);
  line-height: 1.05;
}

.stat-card-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.stat-card-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* Homepage Deep-Dive Callout Banner */
.deep-dive-banner {
  margin-top: 24px;
  padding: 26px 28px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    var(--terracotta-soft) 0%,
    var(--paper-elevated) 100%
  );
  border: 1px solid color-mix(in srgb, var(--terracotta) 38%, var(--line));
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.deep-dive-banner h3 {
  font-size: 1.38rem;
  margin-bottom: 6px;
}

.deep-dive-banner p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--ink-secondary);
  max-width: 64ch;
}

/* 5-Part System Architecture List */
.parts-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 24px 0 36px;
}

.part-item {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 680px) {
  .part-item {
    grid-template-columns: 52px 1fr;
    align-items: start;
    gap: 16px;
  }
}

.part-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--terracotta);
  background: var(--terracotta-soft);
  border: 1px solid color-mix(in srgb, var(--terracotta) 30%, var(--line));
  border-radius: var(--radius-sm);
  width: 42px;
  height: 34px;
  display: inline-grid;
  place-items: center;
}

.part-item h3 {
  font-size: 1.18rem;
  margin-bottom: 4px;
}

.part-item p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* Layered Rulebook Authority Diagram */
.rule-hierarchy {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 20px 0 28px;
  box-shadow: var(--shadow-sm);
}

.rule-chain {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

@media (min-width: 860px) {
  .rule-chain {
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
  }
}

.rule-tier {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.rule-tier-top {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}

.rule-tier-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta);
  display: block;
  margin-bottom: 4px;
}

.rule-tier h4 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}

.rule-tier p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.rule-arrow {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--terracotta);
  text-align: center;
  user-select: none;
}

/* Orchestrator Visual Diagram */
.orchestrator-diagram {
  background: var(--paper-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin: 24px 0 32px;
  box-shadow: var(--shadow-md);
}

.orch-header-node {
  max-width: 560px;
  margin: 0 auto;
  background: var(--paper-card);
  border: 2px solid var(--terracotta);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.orch-header-node h4 {
  font-size: 1.22rem;
  margin: 4px 0 6px;
}

.orch-header-node p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-secondary);
}

.orch-connector-stem {
  width: 2px;
  height: 28px;
  background: var(--terracotta);
  margin: 0 auto;
}

.orch-workers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  position: relative;
  padding-top: 16px;
  border-top: 2px solid var(--line-strong);
}

@media (min-width: 860px) {
  .orch-workers-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.orch-worker-card {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  position: relative;
}

@media (min-width: 860px) {
  .orch-worker-card {
    grid-row: span 3;
    grid-template-rows: subgrid;
  }
}

.orch-worker-card::before {
  content: "▼";
  font-size: 0.68rem;
  color: var(--terracotta);
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper-elevated);
  padding: 0 4px;
}

.orch-worker-role {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.orch-worker-step {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--terracotta);
  font-weight: 500;
  line-height: 1.35;
}

.orch-worker-model {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.3;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  color: var(--ink-muted);
  text-align: center;
}

.orch-worker-card h5 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.orch-worker-card p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.orch-loop-bar {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--paper-subtle);
  border: 1px dashed var(--line-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-secondary);
}

/* Native <details> Accordion Stack for 8-Part Deep Dive */
.accordion-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.accordion-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

details.process-disclosure {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

details.process-disclosure[open] {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

details.process-disclosure summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  user-select: none;
  transition: background-color 0.15s ease;
}

details.process-disclosure summary::-webkit-details-marker {
  display: none;
}

details.process-disclosure summary:hover {
  background: var(--paper-subtle);
}

.disclosure-heading-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

@media (min-width: 720px) {
  .disclosure-heading-group {
    display: grid;
    grid-template-columns: 195px 1fr;
    column-gap: 20px;
    row-gap: 3px;
    align-items: baseline;
  }

  .disclosure-idx {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .disclosure-title {
    grid-column: 2;
    grid-row: 1;
  }

  .disclosure-subtitle {
    grid-column: 2;
    grid-row: 2;
  }
}

.disclosure-idx {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--terracotta);
  font-weight: 500;
  flex-shrink: 0;
}

.disclosure-title {
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 1.8vw, 1.45rem);
  font-weight: 500;
  color: var(--ink);
}

.disclosure-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.disclosure-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink-secondary);
  flex-shrink: 0;
  transition: transform 0.2s ease, background-color 0.15s ease, color 0.15s ease;
}

details.process-disclosure[open] .disclosure-icon {
  transform: rotate(45deg);
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fcfaf6;
}

:root[data-theme="dark"] details.process-disclosure[open] .disclosure-icon {
  color: #141311;
}

.disclosure-body {
  padding: 4px 24px 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-secondary);
  font-size: 0.95rem;
  line-height: 1.68;
}

.disclosure-body > *:first-child {
  margin-top: 18px;
}

.disclosure-body p {
  margin: 0 0 14px;
}

.disclosure-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disclosure-body li strong {
  color: var(--ink);
}

/* Check Gate Grid */
.gate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 16px 0;
}

@media (min-width: 680px) {
  .gate-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gate-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.87rem;
  color: var(--ink-secondary);
}

.gate-pill-check {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--moss);
  font-weight: 600;
  flex-shrink: 0;
}

/* Principles 2-Col / 3-Col Extended Grid */
.takeaways-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 720px) {
  .takeaways-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.limits-card {
  margin-top: 32px;
  background: var(--paper-elevated);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--ochre);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.limits-card h3 {
  font-size: 1.35rem;
  margin-bottom: 12px;
}

.limits-card ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 0.94rem;
}

