/* ============================================================
   INDEX RAIL VARIANT
   Persistent left rail carries navigation as large type.
   The right pane hosts every view; rail hover previews
   collections while on the home view.
   ============================================================ */
:root {
  --paper: #FCFCFA;
  --ink: #141414;
  --gray: #8A8A85;
  --hairline: #E7E7E2;
  --safelight: #B3271E;
  --body-text: #3A3A36;
  --ground: #EDEDE8;
  --display: 'Archivo', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --rail-w: clamp(280px, 30vw, 400px);
}

/* ============================================================
   DARK MODE — the darkroom
   Toggled via data-theme on <html>. Follows the system
   preference until the visitor picks one themselves.
   ============================================================ */
[data-theme="dark"] {
  --paper: #121210;
  --ink: #F0F0EC;
  --gray: #85857E;
  --hairline: #2A2A27;
  --safelight: #D0453A; /* slightly brighter so it reads on dark */
  --body-text: #C4C4BC;
  --ground: #1E1E1C;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
img { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
::selection { background: var(--ink); color: var(--paper); }

/* ============================================================
   LAYOUT FRAME
   ============================================================ */
.frame-layout {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

/* ============================================================
   THE RAIL
   ============================================================ */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vh, 44px) clamp(24px, 3vw, 44px);
  border-right: 1px solid var(--hairline);
}
.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: clamp(40px, 8vh, 80px);
}
.wordmark span { color: var(--gray); }
.wordmark:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.rail-nav { display: flex; flex-direction: column; }
.rail-nav a {
  font-size: clamp(26px, 2.6vw, 38px);
  font-weight: 200;
  letter-spacing: .01em;
  color: var(--gray);
  padding: 10px 0 10px 14px;
  margin-left: -14px;
  border-left: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease, padding-left .2s ease;
}
.rail-nav a:hover { color: var(--ink); padding-left: 20px; }
.rail-nav a.active {
  color: var(--ink);
  border-left-color: var(--safelight);
}
.rail-nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.rail-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gray);
}
.rail-foot a { transition: color .2s ease; }
.rail-foot a:hover, .rail-foot a.active { color: var(--ink); }
.theme-toggle {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gray);
  padding: 2px 0;
  border-bottom: 1px solid var(--hairline);
  transition: color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { color: var(--ink); border-bottom-color: var(--safelight); }
.theme-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ============================================================
   MAIN PANE
   ============================================================ */
.pane {
  padding: clamp(24px, 4vh, 44px) clamp(24px, 3.5vw, 56px);
  min-width: 0;
}
.view { display: none; }
.view.current { display: block; }

/* ============================================================
   HOME PREVIEW
   ============================================================ */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.preview-cell {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--ground);
}
.preview-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s ease, transform .4s ease;
}
.preview-cell img.loaded { opacity: 1; }
.preview-cell:hover img { transform: scale(1.03); }
.preview-cell:focus-visible { outline: 2px solid var(--safelight); outline-offset: -2px; }
.preview-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gray);
  margin-top: 18px;
}

/* ============================================================
   GALLERY VIEWS (in-pane)
   ============================================================ */
.gallery-head { margin-bottom: clamp(28px, 5vh, 48px); max-width: 640px; }
.gallery-head h1 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 200;
  letter-spacing: .01em;
  line-height: 1.05;
}
.gallery-head .meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 12px;
}
.gallery-head p.blurb {
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--body-text);
  font-weight: 300;
}

.masonry { column-count: 2; column-gap: 14px; }
.masonry figure {
  break-inside: avoid;
  margin-bottom: 14px;
  cursor: zoom-in;
  position: relative;
}
.masonry img {
  width: 100%;
  height: auto;
  background: var(--hairline);
  transition: opacity .25s ease;
}
.masonry figure:hover img { opacity: .92; }
.masonry figcaption {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray);
  padding-top: 8px;
  letter-spacing: .04em;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-list { max-width: 760px; }
.project-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--hairline);
  transition: padding-left .25s ease;
}
.project-row:first-child { border-top: 1px solid var(--hairline); }
a.project-row:hover { padding-left: 10px; }
a.project-row:hover .project-title { color: var(--safelight); }
.project-year { font-family: var(--mono); font-size: 12px; color: var(--gray); letter-spacing: .08em; }
.project-title { font-size: clamp(18px, 2vw, 24px); font-weight: 300; transition: color .2s ease; }
.project-desc { font-size: 14px; color: var(--gray); font-weight: 300; grid-column: 2; margin-top: 6px; }
.project-status { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gray); }
.projects-empty {
  padding: 50px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gray);
  letter-spacing: .06em;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(24px, 4vw, 56px);
  max-width: 960px;
}
.about-grid img { width: 100%; height: auto; filter: grayscale(1); }
.about-text p {
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.7;
  font-weight: 300;
  color: var(--body-text);
}
.about-text p + p { margin-top: 18px; }
.about-contact { margin-top: 36px; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.about-contact a { border-bottom: 1px solid var(--hairline); transition: border-color .2s ease; }
.about-contact a:hover { border-bottom-color: var(--safelight); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, .96);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 82vh; object-fit: contain; }
.lightbox-caption {
  font-family: var(--mono);
  font-size: 12px;
  color: #a0a09b;
  margin-top: 18px;
  letter-spacing: .06em;
}
.lightbox-close {
  position: absolute;
  top: 24px; right: 32px;
  color: #fff;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .12em;
  padding: 8px;
}
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 28px;
  font-weight: 200;
  padding: 20px;
  opacity: .7;
  transition: opacity .2s ease;
}
.lightbox-arrow:hover { opacity: 1; }
.lightbox-arrow.prev { left: 12px; }
.lightbox-arrow.next { right: 12px; }

/* ============================================================
   FOOTER (inside pane)
   ============================================================ */
footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ============================================================
   RESPONSIVE
   The rail collapses to a top block on narrow screens;
   hover previews naturally stop applying (no hover on touch).
   ============================================================ */
@media (max-width: 820px) {
  .frame-layout { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 20px;
  }
  .wordmark { margin-bottom: 22px; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; gap: 4px 22px; }
  .rail-nav a {
    font-size: 17px;
    padding: 6px 0;
    margin-left: 0;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .rail-nav a:hover { padding-left: 0; }
  .rail-nav a.active { border-bottom-color: var(--safelight); }
  .rail-foot { margin-top: 18px; }
  .preview-grid { grid-template-columns: 1fr; }
  .masonry { column-count: 1; }
  .about-grid { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 64px 1fr; }
  .project-status { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
