/* ========================================
   E-Paper Portfolio - Humane Interface Design
   "Modern, but familiar. Charming, but functional.
    Never cramped. Never overinflated.
    Just doing a good job with a bit of personality."
   ======================================== */

/* ========================================
   CSS Variables
   ======================================== */
:root {
  /* E-Paper colors - slightly cooler but still warm */
  --paper: #F5F2EB;
  --paper-bg: #E5E2DC;        /* Page background - cooler paper */
  --ink: #1A1A1A;
  --ink-light: #6B6B6B;
  --ink-muted: #9A9A9A;
  --accent: #B5473A;          /* Muted red - "accent" not "warning" */
  --accent-text: #F5F2EB;
  --device: #2A2A2A;
  --terminal-bg: #1A1A1A;
  --terminal-text: #E5E2DC;
  --terminal-cursor: #B5473A;

  /* Typography - Commit Mono primary */
  --font-mono: 'CommitMono', 'JetBrains Mono', 'SF Mono', monospace;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;

  /* Spacing - generous whitespace */
  --content-max-width: 900px;
  --section-gap: 6rem;
  --content-padding: clamp(1.5rem, 4vw, 3rem);

  /* Border radius */
  --border-radius: 2px;

  /* Animation */
  --transition-fast: 100ms ease;
  --transition-normal: 200ms ease;

  /* Header and footer heights for viewport calculations */
  --header-height: 4rem;
  --footer-height: 4rem;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper-bg);
  min-height: 100vh;
}

/* Page load animation */
body.loading .paper {
  opacity: 0;
  transform: translateY(8px);
}

.paper {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* ========================================
   Layout - Separate Pages
   ======================================== */
.paper {
  background: var(--paper);
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--content-padding);
  padding-top: 5rem; /* Space for sticky header */
  padding-bottom: 4rem; /* Space for sticky footer */
  min-height: 100vh;
  box-shadow: 0 0 60px rgba(0,0,0,0.08);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5 {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.2;
}

h2 {
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  margin-bottom: 2rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
  color: var(--ink-light);
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-muted);
  transition: border-color var(--transition-fast);
}

a:hover {
  border-bottom-color: var(--ink);
}

/* ========================================
   Header (Sticky, matches paper width)
   ======================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-width);
  z-index: 100;
  background: var(--paper);
  padding: 1.5rem var(--content-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: none;
}

.site-title:hover {
  border: none;
}

/* ========================================
   Numbered Navigation
   ======================================== */
.nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-light);
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
  transition: all var(--transition-fast);
}

.nav-number {
  color: var(--ink-muted);
  margin-right: 0.25rem;
}

/* Hover: outline */
.nav a:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Active: inverted black */
.nav a.active {
  background-color: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.nav a.active .nav-number {
  color: inherit;
}

/* Button click state - tactile feedback */
.nav a:active {
  transform: scale(0.97);
  background-color: var(--ink);
  color: var(--paper);
}

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

/* Section numbers as subtle markers - thick line = nav → content boundary */
.section-marker {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-light);
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--ink);
  text-transform: uppercase;
}

/* ========================================
   Terminal Interface (About Section)
   ======================================== */

/* About section fills viewport height exactly */
#about {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  height: calc(100svh - var(--header-height) - var(--footer-height));
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  min-height: calc(100svh - var(--header-height) - var(--footer-height));
  max-height: calc(100vh - var(--header-height) - var(--footer-height));
  max-height: calc(100svh - var(--header-height) - var(--footer-height));
  overflow: hidden;
  margin-bottom: 0;
}

/* About section header - flex behavior */
#about .section-marker {
  flex-shrink: 0;
}

.terminal {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex child to shrink below content size */
  height: 100%; /* Ensure terminal fills available height */
}

/* Old terminal output styling removed - see Turn Headers section */

/* Terminal Empty State */
.terminal.terminal--empty {
  justify-content: center;
  align-items: center;
}

.terminal.terminal--empty .terminal-output,
.terminal.terminal--empty .terminal-spacer {
  display: none;
}

/* In empty state, constrain input width and center */
.terminal.terminal--empty .terminal-input-line {
  position: static;
  max-width: 600px;
  width: 100%;
  border-top: none;
  margin-top: 0;
}

.terminal-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  width: 100%;
  /* Offset upward to account for input line below, achieving true visual center */
  margin-top: -3rem;
}

.terminal:not(.terminal--empty) .terminal-empty-state {
  display: none;
}

.terminal-welcome {
  text-align: center;
}

.terminal-welcome-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.terminal-welcome-hint {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin: 0;
}

.terminal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  max-width: 600px;
  width: 100%;
}

.terminal-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.7rem;
  background: transparent;
  border: 1px solid var(--ink-muted);
  border-radius: var(--border-radius);
  color: var(--ink-light);
  cursor: pointer;
  transition: all 100ms ease;
}

.terminal-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.terminal-chip:active {
  background: var(--ink);
  color: var(--paper);
}

/* Animation state: inverted colors during text swap */
.terminal-chip--morphing {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Fadeout state for exhausted pills */
.terminal-chip--exhausted {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: all 200ms ease;
}

/* Pills remain visible throughout conversation - no hiding rule */

@media (prefers-reduced-motion: reduce) {
  .terminal-input-line { transition: none !important; }
  .terminal-chip { transition: none !important; }
  .terminal-chip--exhausted { transition: none !important; }
}

.terminal-prompt {
  color: var(--accent);
  font-weight: 600;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  caret-color: var(--accent);
}

.terminal-input::placeholder {
  color: var(--ink-muted);
}


/* Sticky input line at bottom of terminal */
.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 0.75rem 0;
  margin-top: 0.5rem;
  border-bottom: 1px solid var(--ink-muted);
  z-index: 1;
  flex-shrink: 0; /* Don't shrink input area */
}

.terminal-ping {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: help;
  width: 4.5em;
  text-align: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.terminal-ping.ping-good {
  background: #4a9f4a;
  border-color: #4a9f4a;
  color: var(--paper);
}

.terminal-ping.ping-ok {
  background: #b8860b;
  border-color: #b8860b;
  color: var(--paper);
}

.terminal-ping.ping-slow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.terminal-send-btn {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: all 200ms ease;
  flex-shrink: 0;
}

.terminal-send-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.terminal-send-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.terminal-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Terminal conversation container */
.terminal-output {
  white-space: pre-wrap;
  margin-bottom: 1rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  padding-bottom: 1rem; /* Reduced - footer is fixed so we don't need that much padding */
  min-height: 0; /* Allow shrinking for viewport constraint */
  overflow-wrap: break-word; /* Ensure long words wrap */
  word-wrap: break-word; /* Fallback for older browsers */

  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--ink-muted) transparent;
}

/* Webkit scrollbar (Chrome, Safari, Edge) */
.terminal-output::-webkit-scrollbar {
  width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: var(--ink-muted);
  border-radius: 3px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
  background: var(--ink-light);
}

/* Dynamic spacer - centers input in remaining whitespace */
.terminal-spacer {
  flex: 0 0 auto;
  transition: height 0.15s ease-out;
}

/* When in scroll mode, hide spacer and enable scrolling */
.terminal.terminal--scrolling .terminal-spacer {
  display: none;
}

.terminal.terminal--scrolling .terminal-output {
  overflow-y: auto;
}

/* Before scroll mode, disable scrolling on output */
.terminal:not(.terminal--scrolling) .terminal-output {
  overflow-y: visible;
  flex: 0 0 auto; /* Don't flex, just fit content */
}

/* Turn header - shows at speaker changes */
.terminal-turn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.terminal-turn:first-child {
  margin-top: 0;
}

.terminal-turn.user {
  border-left-color: var(--ink-muted);
}

.terminal-turn.user .terminal-turn-name {
  color: var(--ink-muted);
}

.terminal-turn.assistant {
  border-left-color: var(--accent);
}

.terminal-turn.assistant .terminal-turn-name {
  color: var(--accent);
}

.terminal-turn-time {
  color: var(--ink-light);
  font-size: 0.65rem;
  cursor: help;
  text-transform: none;
}

.terminal-turn-separator {
  color: var(--ink-muted);
}

/* Messages with left rail */
.terminal-message {
  padding-left: 0.75rem;
  border-left: 2px solid transparent;
  margin-bottom: 0.25rem;
}

.terminal-message:last-of-type {
  margin-bottom: 0;
}

/* User messages: muted text, muted rail */
.terminal-message.user {
  color: var(--ink-light);
  border-left-color: var(--ink-muted);
  font-family: var(--font-sans);
}

/* Assistant messages: dark text, accent rail */
.terminal-message.assistant {
  color: var(--ink);
  border-left-color: var(--accent);
  font-family: var(--font-sans);
}

/* Individual message lines within assistant responses */
.message-line {
  display: block;
  position: relative;
  padding: 0.15em 0.25em;
  margin: 0.3em -0.25em;
  border-radius: 3px;
  transition: background-color 150ms ease;
}

.message-line:first-child {
  margin-top: 0;
}

.message-line:last-child {
  margin-bottom: 0;
}

.message-line:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

/* ========================================
   Message Line Reactions
   ======================================== */

/* Reaction picker - overlays text at right side, appears on hover */
.reaction-picker {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  padding: 3px 6px;
  background: var(--paper);
  border: 1px solid var(--ink-light);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
  z-index: 10;
}

/* Show picker on line hover */
.message-line:hover .reaction-picker {
  opacity: 1;
  visibility: visible;
}

/* Individual reaction buttons in picker */
.reaction-btn {
  border: none;
  background: transparent;
  font-size: 1rem;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 150ms ease, background-color 150ms ease;
  line-height: 1;
}

.reaction-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
  transform: scale(1.2);
}

.reaction-btn:active {
  transform: scale(0.95);
}

/* Container for multiple reactions below a line */
.line-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  margin-left: 0.25em;
}

/* Individual reaction chip displayed under line */
.line-reaction {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
  animation: reactionAppear 300ms ease-out;
}

.line-reaction:hover {
  background: rgba(0, 0, 0, 0.08);
}

@keyframes reactionAppear {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Line with reaction has subtle indicator */
.message-line.has-reaction {
  border-left: 2px solid var(--ink-light);
  padding-left: calc(0.25em + 2px);
  margin-left: calc(-0.25em - 2px);
}

/* Mobile: show picker on tap, larger touch targets */
@media (max-width: 600px) {
  .reaction-picker {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    top: auto;
    padding: 8px 12px;
    gap: 8px;
  }

  .reaction-btn {
    font-size: 1.5rem;
    padding: 8px;
  }

  .message-line.picker-active .reaction-picker {
    opacity: 1;
    visibility: visible;
  }
}

/* Print: hide reactions */
@media print {
  .reaction-picker,
  .line-reactions {
    display: none !important;
  }
}

/* Turn header fade-in animation */
.terminal-turn.fade-in {
  opacity: 0;
  animation: turnFadeIn 500ms ease-out forwards;
}

@keyframes turnFadeIn {
  to { opacity: 1; }
}

/* Chat scroll-up animation before assistant response */
.terminal-output.preparing-response {
  transition: transform 500ms ease-out;
  transform: translateY(-1rem);
}


/* ========================================
   Experience Section - Company Blocks
   ======================================== */
.company-block {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--ink-muted);
}

.company-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.company-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  /* No thick border - thick lines only under nav/section-marker */
}

.company-name {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin: 0;
}

.company-tenure {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-light);
}

/* Roles within company - rail on body only, not header */
.role {
  margin-bottom: 2rem;
  /* Rail moved to .role-body - titles remain outside rail */
}

/* Current role gets accent title, dates, and chevrons */

.role:has(.current-label) .role-title {
  color: var(--accent);
}

.role:has(.current-label) .role-dates {
  color: var(--accent);
}

.role:has(.current-label) .achievements li::before {
  color: var(--accent);
}

/* Hide CURRENT label in Experience - color indicates current role */
.role .current-label {
  display: none;
}

.role:last-child {
  margin-bottom: 0;
}

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

.role-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
}

.role-dates {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
}

/* Role body - description + achievements get the rail */
.role-body {
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
  margin-top: 0.5rem;
}

/* Current role body gets accent rail */
.role:has(.current-label) .role-body {
  border-left-color: var(--accent);
}

.role-description {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin-bottom: 0.75rem;
}

/* Current label - the only red accent */
.current-label {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Achievement list */
.achievements {
  list-style: none;
  margin: 0.75rem 0 0 0;
}

.achievements li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.35rem;
  color: var(--ink-light);
  font-size: 0.9rem;
}

.achievements li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  line-height: 1.5rem;
}

.achievements li strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

/* ========================================
   Project Cards (Editorial List Style)
   ======================================== */
.project {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--ink-muted);
}

.project:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Project header - no thick border inside content */
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  /* No thick border - thick lines only under nav/section-marker */
}

.project-header-titles {
  flex: 1;
  min-width: 0;
}

.project-header .project-meta {
  text-align: right;
  flex-shrink: 0;
}

.project-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* Case study headline - the problem statement */
.project-headline {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

/* Smaller title when headline is present */
.project-title-sub {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-light);
}

.project-meta {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-light);
}

.project-description {
  color: var(--ink-light);
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Video placeholder */
.video-placeholder {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border: 1px solid var(--ink-muted);
  background: var(--paper-bg);
  margin: 1rem 0;
}

.video-placeholder-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.video-placeholder-inner::before {
  content: '▶';
  margin-right: 0.5rem;
}

/* Viewfinder corners */
.video-placeholder .corner-tl,
.video-placeholder .corner-tr,
.video-placeholder .corner-bl,
.video-placeholder .corner-br {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--ink-muted);
  border-style: solid;
}

.video-placeholder .corner-tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.video-placeholder .corner-tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.video-placeholder .corner-bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.video-placeholder .corner-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

/* Video container with viewfinder corners */
.video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 1rem 0;
  overflow: hidden;
  background: var(--paper-bg);
  cursor: pointer;
}

.project-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.8) contrast(0.9) sepia(0.08) brightness(0.97);
  transition: filter 0.3s ease;
}

.video-container:hover .project-video {
  filter: grayscale(0) contrast(1);
}

/* Viewfinder corners on video - removed for cleaner look */

/* Play icon - centered, fills on hover */
.video-expand-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.video-expand-hint::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 14px solid var(--accent);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 4px;
  transition: border-left-color 0.3s ease;
}

.video-container:hover .video-expand-hint {
  background: var(--accent);
}

.video-container:hover .video-expand-hint::before {
  border-left-color: var(--accent-text);
}

/* Video lightbox */
.video-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.video-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.video-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-video {
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--accent);
}

/* Project metrics */
.project-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.75rem 0;
}

.metric {
  text-align: center;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.metric.highlight .metric-value {
  color: var(--accent);
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Case study abstract - with rail */
.abstract {
  margin-top: 1rem;
  font-size: 0.9rem;
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

/* Featured project gets accent rail on abstract */
.project.featured .abstract {
  border-left-color: var(--accent);
}

.abstract h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.5rem 0;
}

.abstract h5:first-child {
  margin-top: 0;
}

.abstract p,
.abstract ul {
  color: var(--ink-light);
  font-size: 0.9rem;
}

.abstract ul {
  list-style: none;
}

.abstract li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.25rem;
}

.abstract li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Keywords */
.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.keyword {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.4rem;
  background: var(--ink);
  border-radius: var(--border-radius);
  color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ========================================
   Collapsible Sections
   ======================================== */
.expand-toggle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--ink);
  padding: 0.5rem 1rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-top: 1rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.expand-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}

.expand-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.expand-toggle .toggle-icon {
  display: inline-block;
  transition: transform var(--transition-normal);
  order: -1;
}

.expand-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

.expand-toggle[aria-expanded="true"] {
  background: transparent;
  color: var(--ink);
}

.expand-toggle[aria-expanded="true"]:hover {
  background: var(--ink);
  color: var(--paper);
}

.collapsible {
  overflow: hidden;
}

.collapsible[hidden] {
  display: none;
}

/* ========================================
   Metric Tooltips
   ======================================== */
.metric.has-tooltip {
  position: relative;
  cursor: help;
}

.metric.has-tooltip::before {
  content: '?';
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 1rem;
  height: 1rem;
  background: var(--ink-muted);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.metric.has-tooltip:hover::before {
  opacity: 1;
}

.metric.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-family: var(--font-sans);
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 200px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 10;
  text-align: center;
}

.metric.has-tooltip:hover::after {
  opacity: 1;
}

/* Tooltip arrow */
.metric.has-tooltip:hover::after {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ========================================
   Patent/Credentials
   ======================================== */
.credential {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--ink-muted);
}

.credential-icon {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
}

.credential-text {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin: 0;
}

.credential-text strong {
  color: var(--ink);
  font-weight: 500;
}

.credential-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.credential-contributor {
  font-size: 0.8rem;
  color: var(--ink-light);
  margin: 0.5rem 0 0 0;
  font-style: italic;
}

/* ========================================
   Recognition Section (Patent, Highlights, Speaking, Testimonials)
   ======================================== */

/* Recognition section - inherits from base .section-marker */

/* Featured Card with corner marks (Patent) */
.featured-card {
  position: relative;
  padding: 2rem;
  margin-bottom: 2.5rem;
  background: var(--paper-bg);
}

.featured-card .corner-tl,
.featured-card .corner-tr,
.featured-card .corner-bl,
.featured-card .corner-br {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--accent);
  border-style: solid;
}

.featured-card .corner-tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.featured-card .corner-tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.featured-card .corner-bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.featured-card .corner-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.featured-card-content {
  text-align: center;
}

.featured-card-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.featured-card-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5rem 0;
}

.featured-card-numbers {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 1rem 0;
}

.featured-card-numbers a {
  color: var(--ink-muted);
  border-bottom-color: var(--ink-muted);
}

.featured-card-numbers a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.featured-card-description {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin: 0 0 0.75rem 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.featured-card-contribution {
  font-size: 0.85rem;
  color: var(--ink-light);
  font-style: italic;
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Highlights Section */
.highlights-section {
  margin-bottom: 2.5rem;
}

.highlights-list {
  list-style: none;
  margin: 0 0 1.5rem 0;
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

.highlight-item {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--ink-light);
  font-size: 0.95rem;
}

.highlight-item::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5rem;
}

/* Highlight callout - prominent stat */
.highlight-callout {
  background: var(--paper-bg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
}

.highlight-callout-text {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

/* Closing stat - section punctuation after speaking events */
.highlight-callout.closing-stat {
  margin-top: 2rem;
  margin-bottom: 2rem;
  text-align: center;
  border-left: none;
  border-top: 1px solid var(--ink-muted);
  border-bottom: 1px solid var(--ink-muted);
  padding: 1.5rem;
}

/* Events grouped by category - title and list share same rail */
.events-group {
  margin-bottom: 1.5rem;
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

.events-group:last-child {
  margin-bottom: 0;
}

.events-group-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin: 0 0 0.15rem 0;
}

.testimonials {
  margin-bottom: 2.5rem;
}

.testimonial {
  margin-bottom: 2rem;
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

/* First testimonial gets accent rail */
.testimonial:first-child {
  border-left-color: var(--accent);
}

.testimonial:last-child {
  margin-bottom: 0;
}

.testimonial-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-light);
  font-style: italic;
  margin: 0 0 1rem 0;
  white-space: pre-line;
}


.testimonial-author {
  display: block;
  font-style: normal;
}

.testimonial-author strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
}

.testimonial-role {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.25rem;
}

.speaking-events {
  margin-top: 1.5rem;
}

.subsection-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink);
}

.events-list {
  list-style: none;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.15rem 0;
  border-bottom: none;
}

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

.event-name {
  font-size: 0.9rem;
  color: var(--ink-light);
}

.event-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: right;
}

/* ========================================
   Footer (Sticky, matches paper width)
   ======================================== */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-width);
  z-index: 100;
  background: var(--paper);
  padding: 0.75rem var(--content-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.footer-contact a {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-contact .contact-icon {
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.footer-contact .contact-icon svg {
  display: block;
}

.footer-cta {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  padding: 6px 12px;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.footer-cta:hover {
  background: var(--ink);
  transform: translateY(-1px);
}

.footer-cta:active {
  transform: translateY(0);
}

.footer-download-cv {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 10px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.footer-download-cv:hover {
  background: var(--ink);
  color: var(--paper);
}

.footer-download-cv .contact-icon {
  font-size: 0.8rem;
}

.footer-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.footer-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--ink-muted);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  margin: 0 2px;
}

/* ========================================
   Keyboard Shortcuts Modal
   ======================================== */
.shortcuts-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 2rem;
  z-index: 200;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.shortcuts-modal.visible {
  display: block;
}

.shortcuts-modal h3 {
  margin-bottom: 1rem;
}

.shortcuts-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.shortcuts-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--ink-muted);
}

.shortcuts-list kbd {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--paper-bg);
}

.shortcuts-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 199;
}

.shortcuts-overlay.visible {
  display: block;
}

/* ========================================
   Loading State
   ======================================== */
.loading-indicator {
  display: none;
  text-align: center;
  padding: 3rem;
  color: var(--ink-light);
  font-family: var(--font-mono);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 700px) {
  :root {
    --section-gap: 4rem;
    --header-height: 5rem;
    --footer-height: 3.5rem; /* Compact single row: email + Download CV only */
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem var(--content-padding);
  }

  .nav {
    gap: 0.75rem;
  }

  .nav a {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  /* Collapsible nav labels on mobile - show only numbers by default */
  .nav-label {
    display: none;
  }

  /* Expand label when nav item is active */
  .nav a.active .nav-label {
    display: inline;
  }

  .paper {
    padding-top: 6rem;
    padding-bottom: 5rem;
  }

  .project {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
  }

  .role-header,
  .project-header,
  .company-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .site-footer {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
  }

  /* Hide recruiting CTA on mobile */
  .footer-cta {
    display: none;
  }

  /* Hide location text on mobile - keep email + LinkedIn + Download CV */
  .footer-contact > span {
    display: none !important;
  }

  .footer-hint {
    display: none;
  }

  /* Hide section titles on mobile - nav already shows current section */
  .section-marker {
    display: none;
  }

  .terminal {
    font-size: 0.85rem;
  }

  .terminal-empty-state {
    padding: 1rem;
    gap: 1rem;
  }

  .terminal-welcome-label {
    font-size: 1rem;
  }

  .terminal-chips {
    gap: 0.4rem;
  }

  .terminal-chip {
    font-size: 0.68rem;
    padding: 0.3rem 0.6rem;
  }

  /* Adjust about section height for mobile padding changes */
  #about {
    height: calc(100vh - var(--header-height) - var(--footer-height));
    height: calc(100svh - var(--header-height) - var(--footer-height));
    max-height: calc(100vh - var(--header-height) - var(--footer-height));
    max-height: calc(100svh - var(--header-height) - var(--footer-height));
    margin-bottom: 0;
  }
}

@media (min-width: 1000px) {
  .paper {
    padding: 3rem;
    padding-top: 5rem;
    padding-bottom: 4rem;
  }
}

/* ========================================
   Chat Widget (Welcome & Suggestions)
   ======================================== */
.chat-welcome {
  text-align: center;
  padding: 2rem 1rem;
}

.chat-welcome-icon {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.chat-welcome-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.chat-welcome-text {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin-bottom: 1.5rem;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.chat-suggestion {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--ink-muted);
  border-radius: var(--border-radius);
  color: var(--ink-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-suggestion:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.chat-suggestion:active {
  background: var(--ink);
  color: var(--paper);
}

.chat-speculation {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  padding: 0.25rem 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.chat-speculation.active {
  opacity: 1;
}

/* ========================================
   Skills Section
   ======================================== */

/* Skills section - inherits from base .section-marker */

.skills-positioning {
  font-family: var(--font-mono);
  margin-bottom: 2rem;
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}

.skills-positioning-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.skills-positioning-subtitle {
  font-size: 0.9rem;
  color: var(--ink-light);
}

.skills-core {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--ink-muted);
}

.skills-core-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  margin-bottom: 0.25rem;
}

.skills-core-list {
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

.skills-core-list {
  list-style: none;
  font-size: 0.9rem;
  color: var(--ink-light);
}

.skills-core-list li {
  margin-bottom: 0.15rem;
  padding-left: 1.25rem;
  position: relative;
}

.skills-core-list li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5rem;
}

.skills-core-list .skill-detail {
  color: var(--ink-light);
  font-size: 0.85rem;
}

.skills-primary {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 2rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.skills-category {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ink-muted);
}

.skills-category-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  margin-bottom: 0.25rem;
}

.skills-list {
  border-left: 2px solid var(--ink-muted);
  padding-left: 1rem;
}

.skills-list {
  list-style: none;
  font-size: 0.9rem;
  color: var(--ink-light);
}

.skills-list li {
  margin-bottom: 0.15rem;
  padding-left: 1.25rem;
  position: relative;
}

.skills-list li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ========================================
   Print
   ======================================== */
@media print {
  .site-header,
  .terminal,
  .nav,
  .shortcuts-modal,
  .shortcuts-overlay,
  .footer-hint {
    display: none !important;
  }

  body {
    background: white;
  }

  .paper {
    box-shadow: none;
    padding-top: 0;
    max-width: none;
  }

  .section {
    break-inside: avoid;
  }
}

/* ========================================
   Utility
   ======================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
