/* ==========================================================================
   Melvin Johnson — Personal Website Design System
   Minimalist, typography-first, zero-pomp architecture with 4 design themes
   ========================================================================== */

:root {
  /* Default Theme: Design 1 — Academic Monograph (Warm Editorial) */
  --bg: #faf8f5;
  --bg-subtle: #f2efe9;
  --text-primary: #171715;
  --text-secondary: #57554f;
  --text-muted: #85827a;
  --border: #e4e0d8;
  --border-strong: #c9c4b8;
  --accent: #1d4ed8;
  --link-underline: #c2bdb2;
  --link-hover: #171715;

  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

  --container-width: 680px;
  --section-gap: 3.25rem;
  --body-size: 0.975rem;
  --body-lh: 1.68;
}

/* Dark Ink Mode Override */
[data-mode="dark"] {
  --bg: #121211;
  --bg-subtle: #1b1b19;
  --text-primary: #eceae4;
  --text-secondary: #a6a39b;
  --text-muted: #6e6b64;
  --border: #262522;
  --border-strong: #3d3b36;
  --link-underline: #4a4842;
  --link-hover: #ffffff;
}

/* ==========================================================================
   Theme 2: Swiss Index (Two-Column Asymmetric Ledger)
   ========================================================================== */
[data-design="swiss"] {
  --bg: #f6f6f4;
  --bg-subtle: #ecece8;
  --text-primary: #111111;
  --text-secondary: #525252;
  --text-muted: #787878;
  --border: #dededa;
  --border-strong: #111111;
  --link-underline: #b5b5b0;
  --link-hover: #000000;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --container-width: 980px;
  --section-gap: 3rem;
  --body-size: 0.9375rem;
  --body-lh: 1.62;
}

[data-design="swiss"][data-mode="dark"] {
  --bg: #0f1011;
  --bg-subtle: #18191b;
  --text-primary: #f0f0f0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #232528;
  --border-strong: #e5e7eb;
  --link-underline: #4b5563;
  --link-hover: #ffffff;
}

/* ==========================================================================
   Theme 3: Research Note / Plain-Text Monospace
   ========================================================================== */
[data-design="mono"] {
  --bg: #fcfcfa;
  --bg-subtle: #f3f3ee;
  --text-primary: #18191a;
  --text-secondary: #4c4f52;
  --text-muted: #7a7e82;
  --border: #e1e2dc;
  --border-strong: #9ca0a4;
  --link-underline: #b0b4b8;
  --link-hover: #000000;

  --font-display: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --font-sans: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;

  --container-width: 720px;
  --section-gap: 2.5rem;
  --body-size: 0.875rem;
  --body-lh: 1.72;
}

[data-design="mono"][data-mode="dark"] {
  --bg: #101214;
  --bg-subtle: #171a1d;
  --text-primary: #e2e6e9;
  --text-secondary: #9ba3ab;
  --text-muted: #646d75;
  --border: #22262a;
  --border-strong: #454d54;
  --link-underline: #3e464d;
  --link-hover: #ffffff;
}

/* ==========================================================================
   Theme 4: Essentialist Card (Ultra-Brief Single Viewport)
   ========================================================================== */
[data-design="essential"] {
  --bg: #fbfaf8;
  --bg-subtle: #f2f0ec;
  --text-primary: #161615;
  --text-secondary: #5c5a55;
  --text-muted: #8a8780;
  --border: #e8e5de;
  --border-strong: #cbc6bc;
  --link-underline: #c9c5bc;
  --link-hover: #161615;

  --font-display: 'Newsreader', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --container-width: 580px;
  --section-gap: 2.15rem;
  --body-size: 0.9375rem;
  --body-lh: 1.64;
}

[data-design="essential"][data-mode="dark"] {
  --bg: #131312;
  --bg-subtle: #1c1c1a;
  --text-primary: #edece8;
  --text-secondary: #a19f98;
  --text-muted: #6c6a64;
  --border: #252422;
  --border-strong: #3e3c38;
  --link-underline: #494742;
  --link-hover: #ffffff;
}

/* ==========================================================================
   Base Reset & Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  transition: background-color 0.2s ease, color 0.2s ease;
  padding-bottom: 6rem;
}

a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--text-primary);
}

/* ==========================================================================
   Page Layout Container
   ========================================================================== */
.page-shell {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

[data-design="essential"] .page-shell {
  padding-top: 3.5rem;
}

/* Swiss Two-Column Grid Layout */
[data-design="swiss"] .page-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3.5rem;
  align-items: start;
}

@media (max-width: 820px) {
  [data-design="swiss"] .page-shell {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

[data-design="swiss"] .site-header {
  position: sticky;
  top: 3.5rem;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

@media (max-width: 820px) {
  [data-design="swiss"] .site-header {
    position: static;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
  }
}

/* ==========================================================================
   Header & Identity Block (Block A)
   ========================================================================== */
.site-header {
  margin-bottom: 2.5rem;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

[data-design="swiss"] .header-top {
  flex-direction: column-reverse;
  gap: 1rem;
}

.identity-group h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

[data-design="swiss"] .identity-group h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

[data-design="mono"] .identity-group h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

[data-design="essential"] .identity-group h1 {
  font-size: 1.75rem;
}

.role-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 0.9rem;
}

[data-design="mono"] .role-subtitle {
  font-size: 0.85rem;
}

.profile-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-portrait.hidden {
  display: none;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

[data-design="swiss"] .header-links {
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.header-links a {
  color: var(--text-secondary);
}

.header-links a:hover {
  color: var(--text-primary);
}

.swiss-nav {
  display: none;
}

[data-design="swiss"] .swiss-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}

[data-design="swiss"] .swiss-nav a {
  text-decoration: none;
  color: var(--text-muted);
}

[data-design="swiss"] .swiss-nav a:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   Content Sections & Headings
   ========================================================================== */
.content-section {
  margin-bottom: var(--section-gap);
}

.content-section.hidden-block {
  display: none !important;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

[data-design="swiss"] .section-header {
  border-bottom: 1px solid var(--text-primary);
  padding-bottom: 0.4rem;
}

[data-design="essential"] .section-header {
  border-bottom: none;
  margin-bottom: 0.65rem;
  padding-bottom: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

[data-design="swiss"] .section-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

[data-design="mono"] .section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-design="essential"] .section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.section-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Bio Copy (Block A)
   ========================================================================== */
.bio-prose p {
  margin-bottom: 0.95rem;
  color: var(--text-primary);
}

.bio-prose p:last-child {
  margin-bottom: 0;
}

.bio-prose .secondary-para {
  color: var(--text-secondary);
}

[data-design="essential"] .bio-prose .secondary-para {
  display: none;
}

/* ==========================================================================
   Research Arc / Themes (Block B)
   ========================================================================== */
.themes-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.theme-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1.25rem;
  align-items: baseline;
}

@media (max-width: 600px) {
  .theme-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.theme-period {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.theme-body h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.theme-body p {
  font-size: 0.885rem;
  color: var(--text-secondary);
  line-height: 1.58;
}

/* ==========================================================================
   Publications (Block C)
   ========================================================================== */
.pub-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

[data-design="essential"] .pub-controls {
  display: none;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.scope-toggle-btn {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  cursor: pointer;
}

.scope-toggle-btn:hover {
  color: var(--text-primary);
}

.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

[data-design="swiss"] .pub-list {
  gap: 0;
}

[data-design="essential"] .pub-list {
  gap: 0.55rem;
}

.pub-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1rem;
  align-items: baseline;
}

[data-design="swiss"] .pub-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

[data-design="swiss"] .pub-item:first-child {
  padding-top: 0.15rem;
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pub-content {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
}

.pub-title-line {
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.42;
}

[data-design="essential"] .pub-title-line {
  font-weight: 400;
}

.pub-authors {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

[data-design="essential"] .pub-authors {
  display: none;
}

.pub-authors strong {
  color: var(--text-primary);
  font-weight: 500;
}

.pub-venue-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.pub-venue {
  font-style: italic;
}

[data-design="mono"] .pub-venue,
[data-design="swiss"] .pub-venue {
  font-style: normal;
}

.pub-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Talks, Lectures & Essays (Block D)
   ========================================================================== */
.ledger-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

[data-design="swiss"] .ledger-list {
  gap: 0;
}

.ledger-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  align-items: baseline;
}

[data-design="swiss"] .ledger-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 560px) {
  .ledger-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.ledger-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ledger-main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.ledger-title {
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.42;
}

[data-design="essential"] .ledger-title {
  font-weight: 400;
}

.ledger-sub {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

[data-design="essential"] .ledger-sub {
  display: none;
}

.inline-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

/* ==========================================================================
   Production Systems & Impact (Block F)
   ========================================================================== */
.systems-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem 1.75rem;
}

@media (max-width: 600px) {
  .systems-grid {
    grid-template-columns: 1fr;
  }
}

.system-item h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.system-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ==========================================================================
   Footer / Colophon (Block H)
   ========================================================================== */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.footer-links a {
  color: var(--text-secondary);
}

/* ==========================================================================
   Interactive Studio Bar (Collapsible Design & Content Block Picker)
   ========================================================================== */
.studio-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #181816;
  color: #f4f2ed;
  border: 1px solid #33322e;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  width: min(94vw, 880px);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.8125rem;
  transition: all 0.2s ease;
}

[data-mode="dark"] .studio-bar {
  background: #1e1f22;
  border-color: #383a40;
}

.studio-bar.minimized {
  width: auto;
  border-radius: 999px;
}

.studio-bar.minimized .studio-body {
  display: none;
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid #2c2b28;
  gap: 1rem;
}

.studio-bar.minimized .studio-header {
  border-bottom: none;
  padding: 0.45rem 0.85rem;
}

.studio-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.73rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #b5b2a8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.studio-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.studio-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.studio-btn {
  background: #282724;
  color: #e6e4dd;
  border: 1px solid #3c3a35;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.studio-btn:hover {
  background: #363531;
  border-color: #57544d;
}

.studio-btn.primary {
  background: #f4f2ed;
  color: #181816;
  border-color: #f4f2ed;
  font-weight: 500;
}

.studio-btn.primary:hover {
  background: #ffffff;
}

.studio-body {
  padding: 0.75rem 0.9rem;
  display: grid;
  grid-template-columns: 1.1fr 1.6fr;
  gap: 1rem;
}

@media (max-width: 720px) {
  .studio-body {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.studio-group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8c897f;
  margin-bottom: 0.45rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.design-option {
  background: #22211e;
  border: 1px solid #33312c;
  color: #c7c4bb;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.design-option:hover {
  border-color: #524f47;
  color: #ffffff;
}

.design-option.active {
  background: #302f2b;
  border-color: #e6e4dd;
  color: #ffffff;
}

.design-option-name {
  font-weight: 500;
  font-size: 0.76rem;
}

.design-option-desc {
  font-size: 0.66rem;
  color: #8a877d;
}

.blocks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.block-chip {
  background: #22211e;
  border: 1px solid #33312c;
  color: #8e8b82;
  padding: 0.28rem 0.55rem;
  border-radius: 4px;
  font-size: 0.73rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.block-chip:hover {
  border-color: #4f4c45;
  color: #d6d3cb;
}

.block-chip.active {
  background: #2b2a26;
  border-color: #8c897f;
  color: #f4f2ed;
}

.block-chip .chip-check {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #10b981;
}

.block-chip:not(.active) .chip-check {
  color: #57544d;
}
