/* ============================================================
   Personal site — design system
   Voice: an engineer who shoots film and writes about movies.
   Signature: the contact-sheet grid on the Photography page.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Work+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  /* Color — bright, nature-inspired palette */
  --paper: #F7F9F6;
  --paper-raised: #FFFFFF;
  --ink: #2D3D35;
  --ink-muted: #6B8078;
  --rule: #D9E5DC;
  --safelight: #4B8E6B;
  --safelight-dim: #3A6B52;
  --safelight-wash: rgba(75, 142, 107, 0.08);

  /* Type */
  --font-display: 'Space Mono', 'Courier New', monospace;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --max-width: 1120px;
  --radius-sm: 3px;
  --radius: 6px;

  /* Space scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1.25rem;
  --space-md: 2rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: 7rem;

  --transition: 0.18s ease;
}


/* ============================================================
   Reset & base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

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

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

ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

code {
  font-family: var(--font-display);
  background: var(--safelight-wash);
  color: var(--safelight);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

a:hover code {
  background: var(--safelight);
  color: var(--paper);
  transition: background var(--transition), color var(--transition);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Focus states — visible everywhere, never suppressed */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--safelight);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Structural label — the "// comment" device used for section
   headers throughout the site. A software engineer's way of
   annotating their own page.
   ============================================================ */

.label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--safelight);
  margin: 0 0 var(--space-2xs);
}

.label::before {
  content: '// ';
  color: var(--ink-muted);
}

/* ============================================================
   Header / Nav
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 246, 0.88);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  color: var(--ink);
  transition: transform var(--transition);
  padding: 0;
  margin-left: -70px;
}

.logo:hover {
  transform: scale(1.15);
}

.clover-icon {
  width: 102px;
  height: 102px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  gap: var(--space-md);
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.main-nav a {
  padding: var(--space-2xs) 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition), color var(--transition);
}

.main-nav a:hover { color: var(--safelight); }

.main-nav a.is-active {
  color: var(--safelight);
  border-bottom-color: var(--safelight);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Buttons & links
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-display);
  font-size: 0.9rem;
  padding: 0.7em 1.1em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--safelight);
  border-color: var(--safelight);
}

.btn-secondary {
  background: transparent;
  border-color: var(--rule);
}

.btn-secondary:hover {
  border-color: var(--ink);
}

.icon-links {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6em;
  height: 2.6em;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  transition: border-color var(--transition), color var(--transition);
}

.icon-link:hover {
  border-color: var(--safelight);
  color: var(--safelight);
}

.icon-link svg {
  width: 1.15em;
  height: 1.15em;
  fill: currentColor;
}

.text-link {
  border-bottom: 1px solid var(--rule);
  transition: border-color var(--transition), color var(--transition);
  padding-bottom: 1px;
}

.text-link:hover {
  color: var(--safelight);
  border-color: var(--safelight);
}

/* ============================================================
   Hero (home)
   ============================================================ */

.hero {
  padding: var(--space-2xl) 0 var(--space-xl);
}

.hero-name {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  margin-bottom: var(--space-sm);
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  color: var(--ink-muted);
  margin-bottom: var(--space-md);
}

.cursor {
  display: inline-block;
  color: var(--safelight);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-bio {
  max-width: 58ch;
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: var(--space-lg);
}

.hero-bio a {
  border-bottom: 1px solid var(--rule);
}
.hero-bio a:hover { color: var(--safelight); border-color: var(--safelight); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ============================================================
   Explore grid (home) — three quiet cards, no fake numbering
   since these are parallel categories, not a sequence.
   ============================================================ */

.section {
  padding: var(--space-xl) 0;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--rule);
}

.section-intro {
  max-width: 60ch;
  color: var(--ink-muted);
  margin-bottom: var(--space-lg);
  font-size: 1.05rem;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.explore-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), transform var(--transition);
}

.explore-card:hover {
  border-color: var(--safelight);
  transform: translateY(-2px);
}

.explore-card h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-2xs);
}

.explore-card p {
  color: var(--ink-muted);
  flex-grow: 1;
  margin-bottom: var(--space-sm);
}

.explore-card .text-link {
  font-family: var(--font-display);
  font-size: 0.85rem;
  align-self: flex-start;
}

/* ============================================================
   Page header (used on projects / photography / writing)
   ============================================================ */

.page-header {
  padding: var(--space-xl) 0 var(--space-lg);
}

.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: var(--space-sm);
}

.page-intro {
  max-width: 62ch;
  font-size: 1.1rem;
  color: var(--ink-muted);
}

/* ============================================================
   Experience (projects page)
   ============================================================ */

.experience-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.experience-item {
  display: grid;
  grid-template-columns: 11ch 1fr;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--rule);
}

.experience-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.experience-date {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-muted);
  padding-top: 0.3em;
}

.experience-role {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.2em;
}

.experience-org {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-2xs);
}

.experience-desc {
  color: var(--ink);
  max-width: 65ch;
}

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

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.skill-group-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-xs);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.tag {
  font-family: var(--font-display);
  font-size: 0.78rem;
  padding: 0.3em 0.6em;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
}

/* ============================================================
   Project cards
   ============================================================ */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.project-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.project-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.project-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-title {
  font-size: 1.2rem;
  margin-bottom: var(--space-xs);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  margin-bottom: var(--space-sm);
}

.project-desc {
  color: var(--ink-muted);
  flex-grow: 1;
  margin-bottom: var(--space-sm);
}

.project-links {
  display: flex;
  gap: var(--space-md);
  font-family: var(--font-display);
  font-size: 0.85rem;
}

/* ============================================================
   Contact sheet — the signature element (Photography page)
   Dark tray, thin gutters, frame numbers, always-legible
   captions — like a roll of negatives laid out for review.
   ============================================================ */

.contact-sheet {
  background: #E8EEEA;
  border-radius: var(--radius);
  overflow: hidden;
}

.sprockets {
  height: 14px;
  background-image: radial-gradient(circle, var(--paper) 2.5px, transparent 3px);
  background-size: 22px 14px;
  background-repeat: repeat-x;
  background-position: center;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
}

.photo-item {
  display: flex;
  flex-direction: column;
}

.photo-frame {
  position: relative;
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg, #3A342E 0%, #211D19 100%);
  overflow: hidden;
  transition: filter var(--transition);
}

.photo-item:hover .photo-frame { filter: brightness(1.15); }

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-number {
  position: absolute;
  top: 6px;
  left: 8px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: rgba(230, 130, 90, 0.75);
  letter-spacing: 0.02em;
}

.photo-caption {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: #ABA298;
  padding: var(--space-2xs) var(--space-xs);
  line-height: 1.4;
}

button.photo-frame {
  display: block;
  width: 100%;
  border: none;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ============================================================
   Photo roll lightbox — opens when a contact-sheet cover
   (a roll or a trip) is clicked, showing the rest of that roll.
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 29, 25, 0.85);
  border: none;
  padding: 0;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  background: #E8EEEA;
  border-radius: var(--radius);
  padding: var(--space-md);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.lightbox-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.lightbox-close:hover {
  background: var(--safelight);
  color: var(--paper);
}

.lightbox-caption {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-sm);
  padding-right: var(--space-lg);
}

.lightbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

.roll-gallery {
  display: none;
}

/* ============================================================
   Writing list
   ============================================================ */

.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-item {
  display: block;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--rule);
  transition: opacity var(--transition);
}

.writing-item:hover { opacity: 0.72; }

.writing-meta {
  display: flex;
  gap: var(--space-sm);
  align-items: baseline;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-2xs);
}

.writing-tag { color: var(--safelight); }

.writing-title {
  font-size: 1.35rem;
  margin-bottom: var(--space-2xs);
}

.writing-excerpt {
  color: var(--ink-muted);
  max-width: 68ch;
}

/* ============================================================
   Article (post-example)
   ============================================================ */

.article-header {
  padding: var(--space-xl) 0 var(--space-md);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--space-lg);
}

.article-meta {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: var(--space-sm);
}

.article-title {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
}

.article-body {
  max-width: 68ch;
  font-size: 1.12rem;
}

.article-body p { margin-bottom: var(--space-sm); }

.article-body h2 {
  font-size: 1.3rem;
  margin: var(--space-lg) 0 var(--space-sm);
}

.article-body ul {
  margin-bottom: var(--space-sm);
  padding-left: 1.3em;
}
.article-body li {
  list-style: disc;
  margin-bottom: 0.4em;
}

.article-body blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--safelight);
  border-left: 2px solid var(--safelight);
  padding-left: var(--space-sm);
  margin: var(--space-md) 0;
}

.article-body a {
  border-bottom: 1px solid var(--rule);
}
.article-body a:hover { color: var(--safelight); border-color: var(--safelight); }

.article-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--rule);
  margin-top: var(--space-xl);
}

.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* ============================================================
   Cat companion — a small easter egg. Click anywhere in the main
   content area and it hops over to that spot. Real links/buttons
   underneath still work (script.js forwards the click to them).
   ============================================================ */

main {
  position: relative;
}

.cat-lane {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.cat-sprite {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 0;
  width: 66px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.cat-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.12s ease;
  -webkit-user-drag: none;
}

.cat-sprite:hover img {
  transform: translateY(-2px);
}

.cat-hint {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 0.68rem;
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.cat-hint.is-visible {
  opacity: 1;
}

.cat-controls {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  opacity: 0.4;
  transition: opacity var(--transition);
}

.cat-controls:hover {
  opacity: 1;
}

@media (max-width: 560px) {
  .cat-controls {
    right: var(--space-sm);
    bottom: var(--space-sm);
  }
}

.cat-swatch {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
}

.cat-swatch.is-active {
  border-color: var(--ink);
}

/* ============================================================
   Fade-in on scroll utility
   ============================================================ */

.fade-in {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 980px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .explore-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .main-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
  }

  .main-nav.is-open { max-height: 300px; }

  .main-nav a {
    padding: var(--space-sm) var(--space-md);
    width: 100%;
    border-bottom: 1px solid var(--rule);
  }

  .nav-toggle { display: flex; }

  .experience-item { grid-template-columns: 1fr; gap: var(--space-2xs); }
  .skills-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
