/* ============================================================
   TOKENS
   Change these once, they cascade through the whole site.
   ============================================================ */
:root {
  --bg: #141414;
  --fg: #f4f2ec;
  --fg-dim: #a8a69f;
  --line: rgba(244, 242, 236, 0.28);
  --surface: #ffffff;
  --surface-text: #0e0e0e;

  --font-display: "Instrument Serif", serif;
  --font-mono: "Space Mono", monospace;

  --cv-width: clamp(400px, 27vw, 440px);
  --portfolio-max: 1400px;

  --ease: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ============================================================
   RESET / BASE
   ============================================================ */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
}

a { color: inherit; }

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

::selection { background: var(--fg); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.site {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ---------- CV PANEL ---------- */
.cv-panel {
  flex: 0 0 var(--cv-width);
  height: 100%;
  overflow: hidden;
}

.cv-scroll {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 48px 40px 80px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cv-scroll::-webkit-scrollbar {
  display: none;
}

.cv-header {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
}

.cv-photo {
  flex: 0 0 auto;
  width: 42%;
  max-width: 170px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

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

.cv-header-info {
  container-type: inline-size;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cv-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 27cqw, 3.6rem);
  line-height: 0.95;
  margin: 0;
}

.cv-contact-icons {
  list-style: none;
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
}

.cv-contact-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  transition: opacity 0.2s var(--ease);
}

.cv-contact-icons a:hover {
  opacity: 0.6;
}

.cv-contact-icons svg {
  width: 24px;
  height: 24px;
}

.cv-section {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.cv-section:first-of-type {
  margin-top: 40px;
  border-top: none;
  padding-top: 0;
}

.cv-eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--fg-dim);
}

.cv-body {
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0 0 16px;
  color: var(--fg);
}

.cv-entry { margin-bottom: 26px; }
.cv-entry:last-child { margin-bottom: 0; }

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

.cv-entry-grid .cv-entry:nth-last-child(-n+2) { margin-bottom: 0; }

.cv-entry-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.cv-entry-title em { font-style: italic; font-weight: 400; color: var(--fg-dim); }

.cv-entry-meta {
  font-size: 0.72rem;
  color: var(--fg-dim);
  margin: 0 0 10px;
}

.cv-list {
  margin: 0;
  padding-left: 16px;
  font-size: 0.76rem;
  line-height: 1.7;
}

.cv-list li { margin-bottom: 6px; }
.cv-list li:last-child { margin-bottom: 0; }

.cv-list--flat { list-style: none; padding-left: 0; }

.cv-spacer {
  flex: 1 1 auto;
}

.cv-downloads {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cv-download {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 12px 16px;
  border: 1px solid var(--fg);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.cv-download:hover { background: var(--fg); color: var(--bg); }

/* ---------- DIVIDER ---------- */
.divider {
  flex: 0 0 1px;
  height: 100%;
  background: var(--line);
}

/* ---------- PORTFOLIO PANEL ---------- */
.portfolio-panel {
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
}

.portfolio-scroll {
  height: 100%;
  overflow-y: auto;
  max-width: var(--portfolio-max);
  margin: 0 auto;
  padding: 48px 56px 80px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.portfolio-scroll::-webkit-scrollbar {
  display: none;
}

.project {
  container-type: inline-size;
  padding-bottom: 56px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--line);
}

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

.project-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.project-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 4rem);
  margin: 0;
  line-height: 1;
}

.project-meta {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

.project-text {
  font-size: 0.82rem;
  line-height: 1.8;
  margin: 0 0 28px;
  color: var(--fg);
}

/* Frame hugs the image's own rendered height — it only reveals its
   background on the sides when the image hits the 16:9 height cap
   and gets centered narrower than full width. Shorter images fill
   the frame edge-to-edge with no visible matting. */
.project-img-frame {
  width: 100%;
  max-height: 56.25cqw; /* 9/16 of the project's own inline size */
  margin-bottom: 16px;
  background: var(--bg);
}

.project-img-frame:last-child { margin-bottom: 0; }

.project-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 56.25cqw;
  margin: 0 auto;
  cursor: zoom-in;
  transition: opacity 0.2s var(--ease);
}

.project-img:hover { opacity: 0.9; }

/* ---------- MOBILE TABS (hidden on desktop) ---------- */
.tab {
  display: none;
  position: fixed;
  top: 0;
  height: 100%;
  width: 44px;
  background: var(--bg);
  border: none;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 20;
  align-items: center;
  justify-content: center;
}

.tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tab--cv { left: 0; border-right: 1px solid var(--line); }
.tab--work { right: 0; border-left: 1px solid var(--line); }

/* ============================================================
   MOBILE BREAKPOINT
   Below this width the two-panel layout stops making sense as
   a side-by-side view, so it switches to a tap-to-open toggle.
   ============================================================ */
@media (max-width: 900px) {

  .cv-panel,
  .portfolio-panel {
    transition: flex-basis 0.45s var(--ease);
  }

  .cv-panel {
    flex-basis: 0%;
  }

  .portfolio-panel {
    flex-basis: 100%;
  }

  .divider { display: none; }

  .cv-scroll,
  .portfolio-scroll {
    padding-left: 28px;
    padding-right: 28px;
  }

  /* Extra padding on the side a fixed tab strip sits over, so it
     never covers scroll content underneath it. */
  .portfolio-scroll { padding-left: 64px; }
  .cv-scroll { padding-right: 64px; }

  .portfolio-scroll { max-width: none; }

  .tab { display: flex; }
  .tab--work { display: none; }

  body.cv-open .cv-panel { flex-basis: 100%; }
  body.cv-open .portfolio-panel { flex-basis: 0%; }
  body.cv-open .tab--cv { display: none; }
  body.cv-open .tab--work { display: flex; }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-image {
  max-width: 88vw;
  max-height: 74vh;
  object-fit: contain;
  background: transparent;
}

.lightbox-thumbs {
  display: flex;
  gap: 8px;
  max-width: 88vw;
  overflow-x: auto;
  padding: 4px;
}

.lightbox-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
  cursor: pointer;
  background: transparent;
  opacity: 0.35;
  transition: opacity 0.2s var(--ease);
}

.lightbox-thumb:hover { opacity: 0.7; }
.lightbox-thumb.active { opacity: 1; }

.lightbox.single .lightbox-nav,
.lightbox.single .lightbox-thumbs {
  display: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  padding: 12px;
}

.lightbox-close { top: 16px; right: 20px; font-size: 1.8rem; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); font-size: 3rem; }

@media (max-width: 900px) {
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}
