/* ==========================================================================
   DESIGN SYSTEM — Arya Javadi Portfolio (Editorial Redesign)
   Playfair Display + Inter + Cormorant Garamond
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --bg-page:          #FAFAF7;
  --bg-surface:       #FFFFFF;
  --bg-surface-hover: #F5F4F0;
  --bg-muted:         #F3F2EE;

  --text-primary:     #1A1A1A;
  --text-secondary:   #4A4A4A;
  --text-muted:       #8A8A8A;

  --border-color:     #E8E6E1;
  --border-light:     #F0EDE8;

  --accent-link:      #2D5F8A;
  --accent-green:     #4ade80;

  /* Fonts */
  --font-display:     'Playfair Display', Georgia, serif;
  --font-body:        'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-essay:       'Cormorant Garamond', Georgia, serif;

  /* Type Scale */
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   2rem;
  --text-4xl:   2.5rem;
  --text-5xl:   clamp(2.5rem, 5vw, 3.5rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.5rem;
  --space-6:  2rem;
  --space-7:  2.5rem;
  --space-8:  3rem;
  --space-9:  4rem;
  --space-10: 6rem;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.10);

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out:         cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast:  150ms var(--ease-out);
  --transition-base:  250ms var(--ease-out);
  --transition-slow:  400ms var(--ease-out);

  /* Layout */
  --container-max:  1200px;
  --content-max:    860px;
  --prose-max:      65ch;
}

/* Dark mode — applied via data-theme="dark" on <html> */
[data-theme="dark"] {
  --bg-page:          #141414;
  --bg-surface:       #1E1E1E;
  --bg-surface-hover: #2A2A2A;
  --bg-muted:         #252525;

  --text-primary:     #EDEDEC;
  --text-secondary:   #B0AFA8;
  --text-muted:       #7A7972;

  --border-color:     #2E2E2C;
  --border-light:     #252523;

  --accent-link:      #6BAADC;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.4);
}


/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg-page);
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3, h4, h5, h6 { margin: 0; }

p { margin: 0; }


/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.content-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
}


/* --------------------------------------------------------------------------
   4. NAVIGATION — Sticky header with backdrop blur
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-page) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header { background: var(--bg-page); }
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 64px;
}

.site-header .nav-links {
  margin-left: auto;
}

.site-logo {
  display: flex;
  align-items: center;
}

.site-logo-img {
  height: 40px;
  width: auto;
  border-radius: 50%;
  object-fit: cover;
  transition: opacity var(--transition-base), filter var(--transition-base);
}

.site-logo:hover .site-logo-img {
  opacity: 0.75;
}

[data-theme="dark"] .site-logo-img {
  filter: invert(1) hue-rotate(180deg);
}

.nav-links {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.nav-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color var(--transition-base);
  position: relative;
  padding: var(--space-1) 0;
}

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

.nav-link.active {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-primary);
}

/* Hamburger — mobile only */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text-primary);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle.is-active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transition: color var(--transition-base), border-color var(--transition-base);
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

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

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


/* --------------------------------------------------------------------------
   5. PAGE INTRO / HERO
   -------------------------------------------------------------------------- */
.page-intro {
  padding: var(--space-10) 0;
  text-align: center;
}

.page-intro h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

.page-intro .subtitle {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.page-intro .description {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-6);
}

/* Homepage Hero — two column */
.hero {
  padding: var(--space-10) 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  align-items: center;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--space-4);
}

.hero-text .tagline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.hero-text .description {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-7);
}

.hero-links {
  display: flex;
  gap: var(--space-6);
}

.hero-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border-color);
  transition: text-decoration-color var(--transition-base);
}

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

.hero-image img {
  width: 100%;
  border-radius: var(--radius-md);
  object-fit: cover;
  filter: contrast(1.03) saturate(1.05);
}


/* --------------------------------------------------------------------------
   6. SECTION RULES & STRUCTURE
   -------------------------------------------------------------------------- */
.section-rule {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-10) 0;
}

.section {
  padding: var(--space-9) 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-8);
  line-height: 1.2;
}


/* --------------------------------------------------------------------------
   7. EXPERIENCE TIMELINE
   -------------------------------------------------------------------------- */
.timeline-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--space-5);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-light);
  align-items: start;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.timeline-content h3 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.timeline-content .company {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.timeline-content .location {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Research items — no logo */
.research-item {
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-light);
}

.research-item:last-child {
  border-bottom: none;
}

.research-item h3 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.research-item .meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.research-item .desc {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-secondary);
}


/* --------------------------------------------------------------------------
   8. PROJECT CARDS — Full-width expandable
   -------------------------------------------------------------------------- */
.project-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #DDD9D3;
}

.project-card-preview {
  display: grid;
  grid-template-columns: 380px 1fr;
  cursor: pointer;
  transition: background var(--transition-base);
}

.project-card-preview:hover {
  background: var(--bg-muted);
}

.project-card-preview:focus {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}

.project-card-preview:focus:not(:focus-visible) {
  outline: none;
}

.project-card-image {
  min-height: 280px;
  overflow: hidden;
  background: var(--bg-surface);
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Stretch image to full card height */
.project-card-preview {
  align-items: stretch;
}

.project-card-info {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
}

.project-card-info .card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.project-card-info h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  flex: 1;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.status-current {
  background: var(--text-primary);
  color: #fff;
}

.status-completed {
  background: var(--text-muted);
  color: #fff;
}

.at-a-glance {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-primary);
}

.glance-item {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.glance-item:last-child { margin-bottom: 0; }

.glance-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.project-card-info .preview-text {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-muted);
  margin-top: auto;
}

.expand-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.project-card:hover .expand-toggle {
  color: var(--text-secondary);
}

.expand-toggle .chevron {
  transition: transform var(--transition-base);
  width: 16px;
  height: 16px;
}

.project-card.is-expanded .expand-toggle .chevron {
  transform: rotate(180deg);
}

.project-card.is-expanded .expand-toggle span {
  /* text changes via JS */
}

.project-card.is-expanded .preview-text {
  display: none;
}

.project-card.is-expanded .expand-toggle {
  border-top: none;
  padding-top: 0;
}

/* Expanded body */
.project-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.project-card.is-expanded .project-card-body {
  overflow: visible;
}

.project-card-body-inner {
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--border-light);
}

.project-card-body-inner h4 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--space-7) 0 var(--space-4);
}

.project-card-body-inner h4:first-child {
  margin-top: 0;
}

.project-card-body-inner p {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.project-card-body-inner ul {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-5);
}

.project-card-body-inner li {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.project-card-body-inner strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Project links (GitHub etc) */
.project-links {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.project-link:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-muted);
}

.project-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Project award */
.project-award {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: rgba(74, 222, 128, 0.1);
  border-left: 3px solid var(--accent-green);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: #16a34a;
}

/* Project figures */
.project-figure {
  margin: var(--space-7) 0;
  text-align: center;
}

.project-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin: 0 auto var(--space-3);
}

.project-figure figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

.project-figure video {
  width: 100%;
  max-width: 800px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin: 0 auto var(--space-3);
  display: block;
}

/* YouTube link */
.video-link-container {
  max-width: 800px;
  margin: 0 auto var(--space-3);
}

.youtube-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  border-radius: var(--radius-sm);
  color: white;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.youtube-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.youtube-link-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.youtube-link-content svg {
  width: 64px;
  height: 64px;
  fill: white;
}

.youtube-link-content span {
  font-size: var(--text-lg);
  font-weight: 500;
}


/* --------------------------------------------------------------------------
   9. READING CARDS — Grid layout
   -------------------------------------------------------------------------- */
.readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  align-items: start;
}

.reading-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.reading-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.reading-card:focus {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.reading-card:focus:not(:focus-visible) {
  outline: none;
}

.reading-card-image {
  width: 100%;
  height: 250px;
  overflow: hidden;
  background: var(--bg-surface);
}

.reading-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Per-book image positioning */
.reading-card-image img[src*="symposium2"]            { object-position: center 50%; }
.reading-card-image img[src*="LiarsPoker2"]           { object-position: center 50%; }
.reading-card-image img[src*="inferno2"]              { object-position: center 50%; }
.reading-card-image img[src*="Browning2"]             { object-position: center 50%; }
.reading-card-image img[src*="Letters"]               { object-position: center 50%; }
.reading-card-image img[src*="gentleman in moscow"]   { object-position: center 80%; }
.reading-card-image img[src*="TheAlchemist2"]         { object-position: center 50%; }
.reading-card-image img[src*="KiteRunner2"]           { object-position: center 40%; }
.reading-card-image img[src*="TheBookThief"]          { object-position: center 50%; }
.reading-card-image img[src*="The Double2"]           { object-position: center 50%; }
.reading-card-image img[src*="Crime and Punishment 2"]{ object-position: center 40%; }
.reading-card-image img[src*="ThePrince2"]            { object-position: center 60%; }
.reading-card-image img[src*="The Stranger2"]         { object-position: center 50%; }

.reading-card-content {
  padding: var(--space-5);
}

.reading-card-content .title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.reading-card-content h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  flex: 1;
}

.reading-card-content .author {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

.reading-card-content .preview {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-muted);
}

.reading-card .expand-toggle {
  padding: 0 var(--space-5) 0 0;
}

/* Reading card expanded */
.reading-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.reading-card.is-expanded .reading-card-body {
  overflow: visible;
}

.reading-card-body-inner {
  padding: 0 var(--space-5) var(--space-5);
}

.reading-card-body-inner p {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.reading-card-body-inner p:last-child {
  margin-bottom: 0;
}

.reading-card.is-expanded .preview {
  display: none;
}

.reading-card.hidden {
  display: none !important;
}


/* --------------------------------------------------------------------------
   10. FILTER CHIPS
   -------------------------------------------------------------------------- */
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  justify-content: center;
}

.filter-chip {
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

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

.filter-chip.active {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

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

.shuffle-btn svg {
  width: 16px;
  height: 16px;
}


/* --------------------------------------------------------------------------
   11. WRITINGS / ESSAY PAGE
   -------------------------------------------------------------------------- */
.writings-page .content-wrapper {
  max-width: 720px;
}

.essay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.essay-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  min-height: 360px;
  max-height: 720px;
  overflow: hidden;
  background: var(--text-primary);
}

.essay-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.essay-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}

.essay-banner-caption {
  margin: 0;
  padding: var(--space-2) var(--space-7) 0;
  font-family: var(--font-essay);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--text-primary);
  background: var(--bg-surface);
}

.essay-body {
  padding: var(--space-7) var(--space-7) var(--space-8);
  background: var(--bg-surface);
}

.essay-title {
  font-family: var(--font-essay);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--space-6);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.essay-content {
  font-family: var(--font-essay);
  font-size: 1.1875rem;
  line-height: 1.9;
  color: var(--text-primary);
  max-width: var(--prose-max);
  margin: 0 auto;
  font-weight: 500;
}

.essay-content p {
  margin-bottom: var(--space-5);
  font-size: inherit;
  line-height: inherit;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
}

.essay-content p:first-of-type {
  font-size: 1.0625em;
  line-height: 1.85;
}

.essay-signature {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
  font-family: var(--font-essay);
  font-size: var(--text-base);
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}


/* --------------------------------------------------------------------------
   12. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-10);
  padding: var(--space-6) 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}


/* --------------------------------------------------------------------------
   13. SCROLL REVEAL
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

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

/* Stagger support via data-delay in JS */


/* --------------------------------------------------------------------------
   14. PAGE LOAD ANIMATION
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.site-header {
  animation: fadeInUp 0.5s var(--ease-out) both;
}


/* --------------------------------------------------------------------------
   15. 404 PAGE
   -------------------------------------------------------------------------- */
.not-found {
  text-align: center;
  padding: var(--space-10) 0;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.not-found h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.not-found p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.not-found a {
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}


/* --------------------------------------------------------------------------
   16. RESPONSIVE — Tablet (<=1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-5);
  }

  .hero-grid {
    gap: var(--space-8);
  }

  .project-card-preview {
    grid-template-columns: 300px 1fr;
  }

  .project-card-image {
    height: 240px;
  }

  .timeline-logo {
    width: 50px;
    height: 50px;
  }

  .timeline-item {
    grid-template-columns: 50px 1fr;
  }
}


/* --------------------------------------------------------------------------
   17. RESPONSIVE — Mobile (<=768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .container {
    padding: 0 var(--space-4);
  }

  /* Nav — hamburger layout */
  .site-header .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-page);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-5) var(--space-6);
    gap: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    margin-left: 0;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .nav-link.active::after {
    display: none;
  }

  /* Hero — stack */
  .hero {
    padding: var(--space-8) 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .hero-image {
    display: none;
  }

  .hero-text h1 {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }

  /* Section */
  .section-title {
    font-size: var(--text-2xl);
  }

  .page-intro {
    padding: var(--space-8) 0;
  }

  .page-intro h1 {
    font-size: var(--text-3xl);
  }

  /* Project cards — stack */
  .project-card-preview {
    grid-template-columns: 1fr;
  }

  .project-card-image {
    height: 220px;
  }

  .project-card-info {
    padding: var(--space-5);
  }

  .project-card-info h2 {
    font-size: var(--text-xl);
  }

  .project-card-body-inner {
    padding: var(--space-5);
  }

  .project-links {
    flex-direction: column;
  }

  .project-link {
    width: 100%;
    justify-content: center;
  }

  .project-figure figcaption {
    font-size: var(--text-xs);
    padding: 0 var(--space-2);
  }

  /* Timeline */
  .timeline-item {
    grid-template-columns: 48px 1fr;
    gap: var(--space-4);
    padding: var(--space-5) 0;
  }

  .timeline-logo {
    width: 48px;
    height: 48px;
  }

  .timeline-content h3 {
    font-size: var(--text-base);
  }

  /* Readings grid */
  .readings-grid {
    grid-template-columns: 1fr;
  }

  .reading-card-image {
    height: 220px;
  }

  /* Essay */
  .essay-banner {
    min-height: 300px;
    max-height: 520px;
  }

  .essay-banner-caption {
    padding: var(--space-2) var(--space-5) 0;
  }

  .essay-body {
    padding: var(--space-5);
  }

  .essay-title {
    font-size: 1.5rem !important;
  }

  .essay-content {
    font-size: var(--text-base);
    line-height: 1.85;
  }

  .essay-signature {
    font-size: var(--text-sm);
  }

  /* Footer */
  .site-footer {
    margin-top: var(--space-8);
  }

  .site-footer p {
    font-size: var(--text-xs);
  }
}


/* --------------------------------------------------------------------------
   18. RESPONSIVE — Small Mobile (<=480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-3);
  }

  .hero-text h1 {
    font-size: clamp(1.75rem, 7vw, 2rem);
  }

  .hero-links {
    flex-direction: column;
    gap: var(--space-3);
  }

  .section-title {
    font-size: var(--text-xl);
  }

  .page-intro h1 {
    font-size: var(--text-2xl);
  }

  .project-card-image {
    height: 180px;
  }

  .project-card-info {
    padding: var(--space-4);
  }

  .project-card-info h2 {
    font-size: var(--text-lg);
  }

  .project-card-body-inner {
    padding: var(--space-4);
  }

  .timeline-item {
    grid-template-columns: 40px 1fr;
    gap: var(--space-3);
  }

  .timeline-logo {
    width: 40px;
    height: 40px;
  }

  .reading-card-image {
    height: 200px;
  }

  .reading-card-content {
    padding: var(--space-4);
  }

  .reading-card-content h3 {
    font-size: var(--text-lg);
  }

  .essay-banner-caption {
    padding: var(--space-1) var(--space-4) 0;
    font-size: var(--text-xs);
  }

  .essay-body {
    padding: var(--space-4);
  }

  .essay-title {
    font-size: 1.375rem !important;
  }

  .essay-content {
    font-size: var(--text-sm);
    line-height: 1.8;
  }

  .filter-toolbar {
    gap: var(--space-2);
  }

  .filter-chip {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  .site-footer {
    margin-top: var(--space-6);
  }
}


/* --------------------------------------------------------------------------
   19. ACCESSIBILITY — Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
