/* Design tokens (from design handoff) */
:root {
  --bg: #fdfdfd;
  --ink: #262521;
  --text-secondary: #6f6e6a;
  --text-muted: #9b9a97;
  --text-faint: #b8b7b3;
  --hairline: #ececea;
  --hairline-strong: #e0dfdc;
  --link: #37352f;
  --red: hsl(4, 60%, 52%);
  --green: hsl(128, 45%, 42%);
  --yellow: hsl(46, 75%, 48%);
}

html, body {
  margin: 0;
  padding: 0;
  /* width: 100% not 100vw — scrollbar causes overflow */
  width: 100%;
  background: var(--bg);
  font-family: Helvetica, Arial, sans-serif;
}

a { color: var(--link); }
a:hover { color: #000; }

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Content sits above the canvas; clicks pass through except on links. */
/* Vertical sizes use clamp(...vh...) so the page compresses to fit one
   screen on short viewports instead of scrolling. */
.content-layer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(24px, 5vh, 48px) 72px;
  min-height: 100vh;
  padding: clamp(12px, 4vh, 40px) 48px;
  box-sizing: border-box;
  pointer-events: none;
}

.content-layer a { pointer-events: auto; }

/* --- Photo --- */
.photo-frame {
  box-sizing: border-box;
  flex-shrink: 0;
  max-width: 100%;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--hairline-strong);
  box-shadow: 12px 12px 0 hsla(46, 80%, 55%, 0.35);
}

/* Scales down with viewport width AND height; aspect ratio keeps the
   frame proportions. max-width must stay OUTSIDE the min() — a percentage
   inside it makes the frame inherit the photo's natural width. */
.photo-slot {
  display: block;
  width: min(280px, calc(46vh * 28 / 33));
  max-width: 100%;
  aspect-ratio: 28 / 33;
  object-fit: cover;
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  background: repeating-linear-gradient(45deg, #f2f1ef, #f2f1ef 8px, #e9e8e5 8px, #e9e8e5 16px);
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Right column --- */
.right-col {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3vh, 32px);
  max-width: 560px;
  min-width: 0;
  flex: 1 1 400px;
}

.name {
  margin: 0 0 clamp(4px, 0.9vh, 8px);
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(30px, 5vh, 44px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Small sans-serif eyebrow line above the big name */
.name-prefix {
  display: block;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: clamp(4px, 0.8vh, 8px);
}

/* Letters rise in one by one on load, and tint red/green/yellow on hover */
.name-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  animation: name-letter-in 0.55s ease forwards;
  transition: color 0.25s ease, transform 0.25s ease;
}

@keyframes name-letter-in {
  to { opacity: 1; transform: translateY(0); }
}

.name-text:hover .name-letter { transform: translateY(-2px); }
.name-text:hover .name-letter:nth-child(3n+1) { color: hsl(4, 60%, 45%); }
.name-text:hover .name-letter:nth-child(3n+2) { color: hsl(128, 45%, 35%); }
.name-text:hover .name-letter:nth-child(3n)   { color: hsl(46, 75%, 40%); }

.name-period, .name-text:hover .name-letter.name-period { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  .name-letter {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.tagline {
  font-size: clamp(18px, 2.6vh, 22px);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.rotating-word {
  display: inline-block;
  min-width: 180px; /* prevents layout shift as words change */
  font-weight: 600;
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 1;
  transform: translateY(0);
}

.rotating-word.word-out {
  opacity: 0;
  transform: translateY(8px);
}

/* --- Contact row --- */
.contact-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: clamp(8px, 1.5vh, 16px);
  font-size: 13px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--link);
  text-decoration: none;
}

.contact-link svg { flex-shrink: 0; }

.contact-email:hover    { color: hsl(4, 60%, 42%); }
.contact-phone:hover    { color: hsl(46, 75%, 38%); }
.contact-github:hover   { color: hsl(128, 45%, 35%); }
.contact-linkedin:hover { color: hsl(210, 50%, 40%); }

.bio {
  margin: clamp(6px, 1.2vh, 14px) 0 0;
  font-size: clamp(13px, 2vh, 15px);
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.55;
}

/* --- Sections --- */
.sections {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.4vh, 28px);
}

.section-header {
  margin: 0 0 clamp(6px, 1.4vh, 16px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.rows {
  display: flex;
  flex-direction: column;
}

.rows-experience { gap: clamp(6px, 1.2vh, 14px); }

/* Awards sit side by side like project cards */
.rows-awards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
}

.entry-title {
  font-size: clamp(14px, 2.2vh, 16px);
  font-weight: 600;
  color: var(--ink);
}

.entry-date {
  font-size: clamp(11px, 1.8vh, 13px);
  color: var(--text-muted);
  text-align: right;
}

.entry-sub {
  font-size: clamp(12px, 1.9vh, 14px);
  color: var(--text-secondary);
}

.entry-award {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.entry-award .entry-title { font-size: clamp(13px, 2vh, 15px); }
.entry-award .entry-sub { font-size: clamp(11px, 1.8vh, 13px); }
.entry-award .entry-date { text-align: left; }

/* --- Projects --- */
/* 3 columns at full width, collapses to 2 then 1 as the viewport narrows */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.project-card {
  box-sizing: border-box;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  padding: clamp(6px, 1vh, 10px);
  text-decoration: none;
  border: 1px solid var(--hairline);
  background: rgba(253, 253, 253, 0.9);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.project-image {
  display: block;
  width: 100%;
  height: clamp(44px, 9vh, 96px);
  object-fit: cover;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.project-arrow { font-size: 12px; }

.project-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -4px;
}

.card-red .project-arrow { color: var(--red); }
.card-red:hover {
  border-color: hsl(4, 60%, 62%);
  box-shadow: 0 4px 14px hsla(4, 60%, 52%, 0.15);
  transform: translateY(-3px);
}

.card-green .project-arrow { color: var(--green); }
.card-green:hover {
  border-color: hsl(128, 45%, 52%);
  box-shadow: 0 4px 14px hsla(128, 45%, 42%, 0.15);
  transform: translateY(-3px);
}

.card-yellow .project-arrow { color: var(--yellow); }
.card-yellow:hover {
  border-color: hsl(46, 80%, 52%);
  box-shadow: 0 4px 14px hsla(46, 75%, 48%, 0.18);
  transform: translateY(-3px);
}

/* --- Small screens --- */
@media (max-width: 600px) {
  .content-layer {
    padding: 32px 20px;
    gap: 36px;
  }
  .name { font-size: 36px; }
  .tagline { font-size: 20px; }
  .rotating-word { min-width: 150px; }
  .photo-frame { box-shadow: 8px 8px 0 hsla(46, 80%, 55%, 0.35); }
  .entry-title { font-size: 15px; }
}
