/* =============================================
   TEXTBOOK × MODERN — DESIGN TOKENS
   ============================================= */
:root {
  /* Paper & Ink — Light mode */
  --paper: #faf8f4;
  --paper-alt: #f3f0e8;
  --paper-elevated: #ffffff;
  --ink: #1a1a1a;
  --ink-light: #3d3d3d;
  --ink-muted: #7a7a7a;
  --ink-faint: #c5bfb3;

  /* Accents */
  --red: #c0392b;
  --red-soft: #e74c3c;
  --red-bg: rgba(192, 57, 43, 0.06);
  --blue: #2558a6;
  --blue-bg: rgba(37, 88, 166, 0.05);
  --highlight: #fef3c7;
  --highlight-border: #f59e0b;

  /* Modern additions */
  --glow: rgba(192, 57, 43, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-hover: 0 16px 48px rgba(0,0,0,0.1), 0 6px 16px rgba(0,0,0,0.05);

  /* Typography */
  --font-serif: 'Source Serif 4', 'Georgia', serif;
  --font-sans: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Layout */
  --content-width: 700px;
  --page-padding: clamp(1.5rem, 5vw, 4rem);
  --chapter-gap: clamp(3rem, 6vw, 5rem);

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.2s var(--ease);
  --t-base: 0.35s var(--ease);
  --t-slow: 0.6s var(--ease);
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] {
  --paper: #111116;
  --paper-alt: #1a1a22;
  --paper-elevated: #22222e;
  --ink: #e8e6e1;
  --ink-light: #b8b5ae;
  --ink-muted: #6e6c66;
  --ink-faint: #333330;

  --red: #ef6b5e;
  --red-soft: #f87171;
  --red-bg: rgba(239, 107, 94, 0.1);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.08);
  --highlight: rgba(251, 191, 36, 0.12);
  --highlight-border: #d97706;

  --glow: rgba(239, 107, 94, 0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-hover: 0 16px 48px rgba(0,0,0,0.45);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
}

body {
  font-family: var(--font-serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.8;
  overflow-x: hidden;
  transition: background var(--t-base), color var(--t-base);
}

::selection {
  background: var(--highlight);
  color: var(--ink);
}

a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: rgba(37, 88, 166, 0.25);
  text-underline-offset: 3px;
  transition: all var(--t-fast);
}

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

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

/* =============================================
   READING PROGRESS BAR
   ============================================= */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--red-soft));
  z-index: 200;
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* =============================================
   PAGE STRUCTURE & BOOK LAYOUT
   ============================================= */
.book-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  gap: 3.5rem;
  position: relative;
}

.book-sidebar {
  width: 280px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 0;
  border-right: 1px solid var(--ink-faint);
  padding-right: 1.5rem;
  flex-shrink: 0;
}

.sidebar-header .edition {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header .edition::before {
  content: '';
  width: 16px;
  height: 1px;
  background: var(--red);
}

.sidebar-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.sidebar-subtitle {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}

/* Sidebar Status & Action Buttons */
.availability-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 1rem;
}

.availability-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.6);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

.sidebar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border: 1px solid var(--red);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--red);
  text-decoration: none;
  background: var(--red-bg);
  transition: all var(--t-fast);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-btn:hover {
  background: var(--red);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.sidebar-btn svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-toc h3 {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.sidebar-toc .toc-list {
  list-style: none;
  counter-reset: s-toc;
}

.sidebar-toc .toc-list li {
  counter-increment: s-toc;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--ink-faint);
  font-size: 0.8rem;
  transition: all var(--t-fast);
}

.sidebar-toc .toc-list li::before {
  content: counter(s-toc, upper-roman) ".";
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--ink-muted);
  min-width: 1.6rem;
}

.sidebar-toc .toc-list a {
  color: var(--ink-light);
  text-decoration: none;
  font-size: 0.82rem;
  flex: 1;
}

.sidebar-toc .toc-list li:hover a {
  color: var(--red);
}

.sidebar-toc .toc-list li.active {
  background: var(--red-bg);
  border-radius: 4px;
  border-color: transparent;
  padding-left: 0.5rem;
}

.sidebar-toc .toc-list li.active a {
  color: var(--red);
  font-weight: 600;
}

.sidebar-toc .toc-list .toc-page {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-muted);
}

.sidebar-footer {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--ink-faint);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--paper-alt);
  cursor: pointer;
  transition: all var(--t-fast);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-theme-toggle:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
  transform: translateY(-1px);
}

.colophon-text {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.page {
  flex: 1;
  max-width: 780px;
  padding: 0 2rem var(--chapter-gap) 3.5rem;
  position: relative;
}

/* =============================================
   RUNNING HEADER
   ============================================= */
.running-header {
  position: fixed;
  top: 3px; /* below progress bar */
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--ink-faint);
  padding: 0.6rem var(--page-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: all var(--t-base);
}

.running-header.scrolled {
  box-shadow: var(--shadow-md);
}

.running-header .left-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.running-header .book-title {
  font-weight: 600;
  color: var(--ink-light);
}

.running-header .current-chapter {
  color: var(--red);
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  transition: all var(--t-base);
}

.running-header.scrolled .current-chapter {
  opacity: 1;
  transform: translateY(0);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--ink-faint);
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  transition: all var(--t-fast);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.running-header nav {
  display: flex;
  gap: 1.5rem;
}

.running-header nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  padding: 0.2rem 0;
  transition: color var(--t-fast);
}

/* Modern bookmark ribbon indicator */
.running-header nav a.active {
  color: var(--red);
}

.running-header nav a.active::after {
  content: '';
  position: absolute;
  bottom: -0.6rem;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  animation: slideIn 0.3s var(--ease-spring);
}

@keyframes slideIn {
  from { width: 0; opacity: 0; }
  to { width: 16px; opacity: 1; }
}

.running-header nav a:hover {
  color: var(--ink);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  font-family: var(--font-serif);
}

/* =============================================
   TITLE PAGE
   ============================================= */
.title-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem 0 4rem;
  border-bottom: 3px double var(--ink-faint);
  margin-bottom: var(--chapter-gap);
}

.title-page .edition {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title-page .edition::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--red);
}

.title-page h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.title-page .subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--ink-light);
  font-style: italic;
  margin-bottom: 2.5rem;
  line-height: 1.55;
}

.title-page .author-info {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 2;
  border-top: 1px solid var(--ink-faint);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.title-page .author-info span {
  color: var(--ink-light);
  font-weight: 500;
}

.availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--red);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  transition: all var(--t-fast);
}

.availability-badge:hover {
  background: var(--red-bg);
  box-shadow: 0 0 0 4px var(--glow);
}

.availability-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(22, 163, 74, 0.5); }
  50% { opacity: 0.3; box-shadow: 0 0 2px rgba(22, 163, 74, 0.2); }
}

/* Scroll indicator — modern subtle */
.scroll-cue {
  margin-top: 3rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.scroll-cue .line {
  width: 40px;
  height: 1px;
  background: var(--ink-faint);
  position: relative;
  overflow: hidden;
}

.scroll-cue .line::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--red);
  animation: slide-right 2s ease-in-out infinite;
}

@keyframes slide-right {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* =============================================
   TABLE OF CONTENTS
   ============================================= */
.toc {
  margin-bottom: var(--chapter-gap);
  padding-bottom: var(--chapter-gap);
  border-bottom: 1px solid var(--ink-faint);
}

.toc h2 {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

.toc-list {
  list-style: none;
  counter-reset: toc;
}

.toc-list li {
  counter-increment: toc;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--ink-faint);
  transition: all var(--t-fast);
}

.toc-list li:hover {
  padding-left: 0.5rem;
  background: var(--red-bg);
  border-radius: 4px;
  border-color: transparent;
}

.toc-list li::before {
  content: counter(toc, upper-roman) ".";
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--ink-muted);
  min-width: 2.5rem;
}

.toc-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  flex: 1;
  transition: color var(--t-fast);
}

.toc-list li:hover a {
  color: var(--red);
}

.toc-list .toc-page {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* =============================================
   CHAPTERS
   ============================================= */
.chapter {
  margin-bottom: var(--chapter-gap);
  padding-bottom: var(--chapter-gap);
  border-bottom: 1px solid var(--ink-faint);
  position: relative;
}

.chapter:last-of-type {
  border-bottom: none;
}

.chapter-number {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.chapter-number::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--red), transparent);
  max-width: 100px;
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2rem;
  letter-spacing: -0.015em;
}

/* Drop cap */
.drop-cap::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 3.8rem;
  font-weight: 700;
  line-height: 0.82;
  margin-right: 0.08em;
  margin-top: 0.08em;
  color: var(--red);
}

.chapter p {
  margin-bottom: 1.25rem;
  color: var(--ink-light);
  text-align: justify;
  hyphens: auto;
}

/* Highlighted keywords — modern annotation */
.keyword {
  background: var(--highlight);
  padding: 0.05em 0.3em;
  border-radius: 3px;
  border-bottom: 2px solid var(--highlight-border);
  font-weight: 600;
  color: var(--ink);
  transition: all var(--t-fast);
}

.keyword:hover {
  background: rgba(245, 158, 11, 0.2);
}

/* =============================================
   MARGIN NOTES — with modern connector
   ============================================= */
.margin-note {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.55;
  border-left: 3px solid var(--highlight-border);
  padding: 0.85rem 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  background: var(--highlight);
  border-radius: 0 6px 6px 0;
  transition: all var(--t-base);
}

.margin-note:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

.margin-note strong {
  color: var(--ink-light);
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =============================================
   FIGURE — Stats with animated counters
   ============================================= */
.figure {
  margin: 2rem 0;
  padding: 1.75rem;
  background: var(--paper-alt);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}

.figure:hover {
  box-shadow: var(--shadow-md);
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  text-align: center;
}

.figure-stat {
  transition: all var(--t-fast);
}

.figure-stat:hover {
  transform: translateY(-2px);
}

.figure-stat .value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1.2;
}

.figure-stat .label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 0.3rem;
}

.figure-caption {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-top: 1.25rem;
  text-align: center;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--ink-faint);
}

.figure-caption strong {
  color: var(--ink-light);
}

/* =============================================
   TABLES — with modern hover
   ============================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.data-table thead {
  border-bottom: 2px solid var(--ink);
}

.data-table th {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
}

.data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  color: var(--ink-light);
  vertical-align: top;
  transition: all var(--t-fast);
}

.data-table tbody tr {
  transition: all var(--t-fast);
}

.data-table tbody tr:hover {
  background: var(--red-bg);
}

.data-table tbody tr:hover td {
  color: var(--ink);
}

.data-table .category-label {
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  white-space: nowrap;
}

.skill-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.12rem 0.45rem;
  margin: 0.15rem 0.1rem;
  background: var(--blue-bg);
  border-radius: 4px;
  color: var(--ink-light);
  transition: all var(--t-fast);
  border: 1px solid transparent;
}

.skill-tag:hover {
  background: var(--red-bg);
  border-color: rgba(192, 57, 43, 0.15);
  color: var(--red);
  transform: translateY(-1px);
}

.table-caption {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.table-caption strong {
  color: var(--ink-light);
}

/* =============================================
   EXPERIENCE — with hover lift
   ============================================= */
.entry {
  margin-bottom: 2rem;
  padding: 1.75rem;
  background: var(--paper-alt);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}

.entry:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(192, 57, 43, 0.1);
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.entry-role {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.entry-period {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--red);
  background: var(--red-bg);
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
}

.entry-company {
  color: var(--blue);
  font-size: 0.92rem;
  font-style: italic;
  margin-bottom: 0.9rem;
  display: block;
}

.entry-list {
  list-style: none;
  padding: 0;
}

.entry-list li {
  padding-left: 1.5rem;
  position: relative;
  margin-bottom: 0.45rem;
  color: var(--ink-light);
  font-size: 0.9rem;
  line-height: 1.7;
}

.entry-list li::before {
  content: '§';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
  font-size: 0.85rem;
}

/* =============================================
   PROJECTS — with lift + left border
   ============================================= */
.project-entry {
  margin-bottom: 1.5rem;
  padding: 1.75rem;
  background: var(--paper-elevated);
  border-left: 4px solid var(--red);
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}

.project-entry:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px) translateX(2px);
  border-left-color: var(--red-soft);
}

.project-entry .proj-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}

.project-entry h4 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
}

.project-entry .proj-year {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--blue);
  background: var(--blue-bg);
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
}

.project-entry .proj-desc {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.project-entry p {
  color: var(--ink-light);
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
  margin-top: 0.5rem;
  text-align: left;
  line-height: 1.7;
}

.project-entry .tech-used {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.project-entry .tech-label {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-right: 0.25rem;
}

.tech-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--paper-alt);
  color: var(--ink-muted);
  border: 1px solid rgba(0,0,0,0.05);
}

/* =============================================
   CERTIFICATIONS
   ============================================= */
.cert-list {
  list-style: none;
  counter-reset: cert;
}

.cert-list li {
  counter-increment: cert;
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 0.9rem;
  border-radius: 4px;
  transition: all var(--t-fast);
}

.cert-list li:hover {
  background: var(--red-bg);
  padding-left: 1rem;
}

.cert-list li::before {
  content: counter(cert) ".";
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.cert-name {
  color: var(--ink-light);
}

.cert-name .issuer {
  font-weight: 600;
  color: var(--ink);
}

.cert-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* =============================================
   EDUCATION
   ============================================= */
.edu-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.edu-card {
  padding: 1.75rem;
  background: var(--paper-alt);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}

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

.edu-card .degree-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.edu-card .institute-name {
  color: var(--blue);
  font-size: 0.88rem;
  font-style: italic;
  margin-bottom: 0.6rem;
}

.edu-card .grade {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red);
  background: var(--red-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  display: inline-block;
  font-weight: 500;
}

/* =============================================
   CONTACT
   ============================================= */
.colophon {
  text-align: center;
  padding: 2rem 0;
}

.colophon p {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-style: italic;
}

.contact-methods {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--ink-faint);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-light);
  text-decoration: none;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
}

.contact-item:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.contact-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* =============================================
   FOOTER — Endpage
   ============================================= */
.endpage {
  text-align: center;
  padding: 2.5rem 0 3.5rem;
  border-top: 3px double var(--ink-faint);
  margin-top: 2rem;
}

.endpage .ornament {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  display: block;
  color: var(--ink-faint);
}

.endpage p {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* =============================================
   BACK TO TOP — Modern floating button
   ============================================= */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper-elevated);
  border: 1px solid var(--ink-faint);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--ink-muted);
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--t-base);
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--red);
  color: var(--red);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

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

.reveal-d1 { transition-delay: 0.06s; }
.reveal-d2 { transition-delay: 0.12s; }
.reveal-d3 { transition-delay: 0.18s; }
.reveal-d4 { transition-delay: 0.24s; }
.reveal-d5 { transition-delay: 0.3s; }
.reveal-d6 { transition-delay: 0.36s; }
.reveal-d7 { transition-delay: 0.42s; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .book-layout {
    flex-direction: column;
    gap: 0;
    padding: 0 1.5rem;
  }

  .book-sidebar {
    display: none !important;
  }

  .page {
    max-width: 700px;
    margin: 0 auto;
    padding: 0;
  }
}

@media (min-width: 1025px) {
  .running-header {
    justify-content: center;
    padding: 0.6rem 2rem;
  }
  .running-header nav {
    display: none !important;
  }
  .running-header .header-actions {
    display: none !important;
  }
}

@media (max-width: 768px) {
  html { font-size: 16px; }

  .running-header {
    padding: 0.5rem 1rem;
    justify-content: space-between;
  }

  .running-header nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 1px solid var(--ink-faint);
    padding: 0.75rem var(--page-padding);
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
  }

  .running-header nav.open { display: flex; }

  .menu-toggle { display: block; }

  .running-header .current-chapter { display: none; }

  .figure-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-header,
  .project-entry .proj-header {
    flex-direction: column;
    gap: 0.15rem;
  }

  .cert-list li {
    grid-template-columns: 1.5rem 1fr;
  }

  .cert-date { grid-column: 2; }

  .contact-methods {
    flex-direction: column;
    align-items: center;
  }

  .title-page h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .figure-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .edu-entries { grid-template-columns: 1fr; }
}

/* =============================================
   PRINT
   ============================================= */
@media print {
  .running-header, .progress-bar, .back-to-top, .theme-toggle { display: none; }
  .reveal { opacity: 1; transform: none; }
  body { background: white; font-size: 11pt; }
  .chapter { page-break-before: always; }
  a { color: var(--ink); }
}

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .availability-badge .dot { animation: none; }
  .scroll-cue .line::after { animation: none; }
  .entry:hover, .project-entry:hover, .edu-card:hover, .figure:hover,
  .margin-note:hover, .figure-stat:hover { transform: none; }
}
