/* ═══════════════════════════════════════
   CSS VARIABLES & THEMING
   ═══════════════════════════════════════ */
:root {
  --bg: #0D0D0D;
  --surface: #1A1A1A;
  --elevation: #2A2A2A;
  --gold: #C9A962;
  --text-primary: #F5F4F2;
  --text-secondary: #8A8A8A;
  --text-muted: #6A6A6A;
  --text-disabled: #4A4A4A;
  --border: #2A2A2A;
  --header-bg: rgba(13, 13, 13, 0.95);
}

[data-theme="light"] {
  --bg: #F5F4F2;
  --surface: #EAEAE8;
  --elevation: #E0E0DE;
  --gold: #9E7C3A;
  --text-primary: #1A1A1A;
  --text-secondary: #5A5A5A;
  --text-muted: #7A7A7A;
  --text-disabled: #A0A0A0;
  --border: #D4D4D2;
  --header-bg: rgba(245, 244, 242, 0.95);
}

::selection {
  background: var(--gold);
  color: var(--bg);
}

/* ═══════════════════════════════════════
   NAV LINK UNDERLINE (pseudo-element)
   ═══════════════════════════════════════ */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* ═══════════════════════════════════════
   MOBILE MENU
   ═══════════════════════════════════════ */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-nav.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav a,
.mobile-nav button {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.3s ease;
  display: block;
}

.mobile-nav a:hover,
.mobile-nav button:hover {
  color: var(--text-primary);
}

/* Restore border for theme toggle in mobile menu */
.mobile-nav #theme-toggle-mobile {
  border: 1px solid var(--border) !important;
}

/* ═══════════════════════════════════════
   THEME TOGGLE SWITCH
   ═══════════════════════════════════════ */
.theme-icon-moon {
  display: none;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-icon-moon {
  display: block;
}

[data-theme="light"] #theme-toggle-desktop .theme-knob {
  left: 23px;
}

[data-theme="light"] #theme-toggle-mobile .theme-knob {
  left: 30px;
}

/* ═══════════════════════════════════════
   SCROLL REVEAL ANIMATION
   ═══════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero stagger */
.hero-section .reveal:nth-child(1) { transition-delay: 0.1s; }
.hero-section .reveal:nth-child(2) { transition-delay: 0.25s; }
.hero-section .reveal:nth-child(3) { transition-delay: 0.4s; }

/* Pillar stagger */
.pillar:nth-child(1) { transition-delay: 0.05s; }
.pillar:nth-child(2) { transition-delay: 0.15s; }
.pillar:nth-child(3) { transition-delay: 0.25s; }

/* ═══════════════════════════════════════
   SCROLLED HEADER STATE (JS-toggled)
   ═══════════════════════════════════════ */
header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   WORK LINK HOVER STATES
   ═══════════════════════════════════════ */
.work-link:hover .work-link-title {
  color: var(--gold);
}

.work-link:hover .work-link-arrow {
  transform: translateX(8px);
  color: var(--gold);
}

/* ═══════════════════════════════════════
   FORM FIELDS
   ═══════════════════════════════════════ */
.form-field {
  position: relative;
  padding-bottom: 1px;
}

.form-field::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.4s ease;
}

.form-field:focus-within::after {
  width: 100%;
}

.form-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'Newsreader', serif;
  font-size: 18px;
  line-height: 1.6;
  padding: 14px 0;
  outline: none;
  transition: border-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

.form-input:focus {
  border-bottom-color: transparent;
}

.form-input::placeholder {
  color: var(--text-disabled);
}

textarea.form-input {
  resize: none;
  min-height: 140px;
}

.form-label {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════
   SUBMIT BUTTON
   ═══════════════════════════════════════ */
.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 16px 32px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.btn-submit:hover {
  background: var(--gold);
  color: var(--bg);
}

.btn-submit svg {
  transition: transform 0.3s ease;
}

.btn-submit:hover svg {
  transform: translateX(4px);
}

/* ═══════════════════════════════════════
   TIMELINE — DESKTOP
   ═══════════════════════════════════════ */
.timeline-section {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0 64px;
  align-items: start;
}

.timeline-col {
  position: sticky;
  top: 120px;
}

.timeline-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.timeline-track.drawn::before {
  transform: scaleY(1);
}

.timeline-fill {
  position: absolute;
  left: 3px;
  top: 8px;
  width: 1px;
  background: var(--gold);
  height: 0;
  transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1;
}

.timeline-node {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 0 0 44px 0;
  cursor: pointer;
  outline: none;
}

.timeline-node:last-child {
  padding-bottom: 0;
}

.node-marker {
  width: 8px;
  height: 8px;
  border: 1px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  margin-top: 4px;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  z-index: 2;
}

.timeline-node:hover .node-marker {
  border-color: var(--gold);
}

.timeline-node.active .node-marker {
  background: var(--gold);
  border-color: var(--gold);
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 169, 98, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(201, 169, 98, 0); }
}

.node-present.active .node-marker {
  animation: pulse-gold 2.5s ease-in-out infinite;
}

[data-theme="light"] .node-present.active .node-marker {
  animation: pulse-gold-light 2.5s ease-in-out infinite;
}

@keyframes pulse-gold-light {
  0%, 100% { box-shadow: 0 0 0 0 rgba(158, 124, 58, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(158, 124, 58, 0); }
}

.node-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.node-period {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-disabled);
  transition: color 0.25s ease;
}

.node-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  line-height: 1.15;
  transition: color 0.25s ease;
}

.timeline-node.active .node-period {
  color: var(--gold);
}

.timeline-node.active .node-title {
  color: var(--text-primary);
}

.timeline-node:hover .node-title {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════
   CONTENT PANEL
   ═══════════════════════════════════════ */
.panel-wrap {
  min-height: 500px;
}

.panel-exit {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s ease-in, transform 0.28s ease-in;
}

.panel-enter {
  animation: panelIn 0.4s ease-out forwards;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}

.focus-card {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  padding-bottom: 28px;
  padding-right: 24px;
}

.project-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 36px;
  padding-bottom: 36px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   MOBILE TIMELINE (tabs)
   ═══════════════════════════════════════ */
.mobile-tabs {
  display: none;
  flex-direction: row;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mobile-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.25s ease;
  outline: none;
}

.mobile-tab .node-period {
  font-size: 10px;
}

.mobile-tab .node-title {
  font-size: 14px;
}

.mobile-tab.active {
  border-bottom-color: var(--gold);
}

.mobile-tab.active .node-period {
  color: var(--gold);
}

.mobile-tab.active .node-title {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════
   RESPONSIVE GRID OVERRIDES (900px)
   ═══════════════════════════════════════ */
@media (max-width: 900px) {
  .pillars-grid {
    grid-template-columns: 1fr !important;
    gap: 56px !important;
    max-width: 600px;
  }
  .impact-item {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }
  .impact-item:first-child {
    padding-top: 0 !important;
  }
  .work-link {
    grid-template-columns: 1fr auto !important;
    gap: 16px !important;
  }
  .work-link-desc {
    grid-column: 1 / -1;
    order: 3;
  }
  .focus-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 767px) {
  .timeline-section {
    display: block;
  }

  .timeline-col {
    display: none;
  }

  .mobile-tabs {
    display: flex;
  }
}

@media (min-width: 768px) and (max-width: 900px) {
  .timeline-section {
    grid-template-columns: 200px 1fr;
    gap: 0 40px;
  }

  .focus-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════
   CONTENT PANEL
   ═══════════════════════════════════════ */
.panel-wrap {
  min-height: 500px;
}

.panel-content {
  display: none;
}

.panel-content:first-child {
  display: block;
}

.panel-exit {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s ease-in, transform 0.28s ease-in;
}

.panel-enter {
  animation: panelIn 0.4s ease-out forwards;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus cards grid */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}

.focus-card {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  padding-bottom: 28px;
  padding-right: 24px;
}

/* Project items */
.project-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 36px;
  padding-bottom: 36px;
  border-top: 1px solid var(--border);
}

@media (max-width: 767px) {
  .focus-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════
   TABLE OF CONTENTS
   ═══════════════════════════════════════ */
.toc-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-disabled);
  margin-bottom: 16px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin: 0;
}

.toc-link {
  display: block;
  font-family: 'Newsreader', serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 0 7px 16px;
  border-left: 1px solid var(--border);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.toc-link:hover {
  color: var(--text-secondary);
  border-left-color: var(--text-secondary);
}

.toc-link.active {
  color: var(--gold);
  border-left-color: var(--gold);
}

/* Mobile ToC */
.toc-mobile-wrapper {
  margin-bottom: 48px;
}

.toc-mobile {
  border: 1px solid var(--border);
  padding: 20px 24px;
}

.toc-mobile .toc-label {
  margin-bottom: 12px;
}

.toc-mobile .toc-link {
  border-left: none;
  padding-left: 0;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 15px;
}

.toc-mobile .toc-link.active {
  color: var(--gold);
}

/* ═══════════════════════════════════════
   ARTICLE LAYOUT
   ═══════════════════════════════════════ */
.article-layout {
  display: block;
}

.toc-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .article-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 72px;
    align-items: start;
  }

  .toc-sidebar {
    display: block;
    position: sticky;
    top: 128px;
  }

  .toc-mobile-wrapper {
    display: none;
  }
}

/* ═══════════════════════════════════════
   ARTICLE TYPOGRAPHY
   ═══════════════════════════════════════ */
.article-body {
  max-width: 660px;
}

.article-body p {
  font-family: 'Newsreader', serif;
  font-size: 20px;
  line-height: 1.85;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.article-body h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: 1px;
  font-weight: 400;
  color: var(--text-primary);
  margin-top: 64px;
  margin-bottom: 24px;
  line-height: 1.05;
  scroll-margin-top: 120px;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body blockquote {
  border-left: 2px solid var(--gold);
  padding: 4px 0 4px 24px;
  margin: 36px 0;
}

.article-body blockquote p {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1.75;
  margin-bottom: 0;
}

.article-body ul {
  margin-bottom: 28px;
  margin-left: 28px;
  padding-left: 0;
  list-style: none;
}

.article-body ul li {
  font-family: 'Newsreader', serif;
  font-size: 20px;
  line-height: 1.85;
  color: var(--text-secondary);
  padding-left: 0;
  position: relative;
  margin-bottom: 12px;
}

.article-body ul li::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 14px;
  width: 6px;
  height: 6px;
  background: var(--gold);
}

.article-body a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

.article-body a:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════
   BACK LINK
   ═══════════════════════════════════════ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--text-primary);
}

.back-arrow {
  transition: transform 0.3s ease;
}

.back-link:hover .back-arrow {
  transform: translateX(-4px);
}
