/* =========================================================
   JUHANA SELIN — PORTFOLIO
   Static build — no CMS, no theme overrides
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Azeret+Mono:wght@200..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300..600&display=swap');

/* =========================================================
   TOKENS
   ========================================================= */

:root {
  --font-mono: 'Azeret Mono', monospace;
  --font-reading: 'Fraunces', serif;
  --accent: #7a2020;
  --ink: #111;
  --ink-mid: #555;
  --ink-light: #999;
  --bg: #f3f0eb;
  --gap: 1.25rem;
  --max-width: 960px;
  --header-height: 5rem;
  --section-gap: 6rem;
}

/* =========================================================
   RESET & BASE
   ========================================================= */

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

html, body {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

body {
  padding-top: var(--header-height);
}

img {
  display: block;
  width: 100%;
  height: auto;
}

a {
  color: var(--ink);
  text-decoration: none;
}

a:visited {
  color: var(--ink);
}

hr {
  display: none;
}

/* =========================================================
   LAYOUT
   ========================================================= */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* =========================================================
   HEADER & NAV
   ========================================================= */

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px dotted rgba(0,0,0,0.25);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

#header .container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 3.5rem;
  padding: 0;
  margin: 0;
}

nav ul li {
  padding-left: 0;
  margin-bottom: 0;
}

nav ul li::before {
  display: none;
}

nav ul a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding: 0.35rem 0.85rem;
  border: 1px dotted transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav ul a:hover {
  color: var(--accent);
  border-color: rgba(122, 32, 32, 0.25);
}

nav ul li.active a {
  color: var(--accent);
  border-color: rgba(122, 32, 32, 0.55);
}

/* Remove the underline — button outline replaces it */
nav ul li.active a::after {
  display: none;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: opacity 0.2s;
}

@media (max-width: 767px) {
  #header .container {
    justify-content: flex-end;
  }

  .nav-toggle {
    display: flex;
  }

  nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px dotted rgba(0,0,0,0.25);
    padding: 1.5rem 2rem;
  }

  nav.open {
    display: block;
  }

  nav ul {
    flex-direction: column;
    gap: 1.25rem;
  }
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */

h1 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

h3 {
  font-size: inherit;
  font-weight: inherit;
}

p {
  max-width: 42rem;
  margin-bottom: 0.9rem;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
  letter-spacing: 0.02em;
}

em {
  font-style: italic;
}

/* Reading font */
.font-reading p {
  font-family: var(--font-reading);
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 0.9rem;
  max-width: 100%;
}

/* Portfolio page — cap text to approx two grid columns */
.page-portfolio p,
.page-portfolio .font-reading p {
  max-width: 66%;
}

/* Portfolio — one paragraph only, editorial brevity */
.page-portfolio .font-reading p + p {
  display: none;
}

/* Credit lines — same weight and colour as project-meta */
.page-portfolio .credit {
  font-size: 0.72rem;
  font-weight: 200;
  letter-spacing: 0.07em;
  color: var(--ink-light);
  line-height: 1.6;
  max-width: 66%;
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .page-portfolio p,
  .page-portfolio .font-reading p,
  .page-portfolio .credit {
    max-width: 100%;
  }
}

/* =========================================================
   SECTION HEADER — title left · category right, same baseline
   ========================================================= */

.section-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2rem;
  margin-bottom: 1.1rem;
}

.section-header h2 {
  margin: 0;
}

.section-header .project-meta {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .section-header {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .section-header .project-meta {
    text-align: left;
    white-space: normal;
  }
}

.project-meta {
  font-size: 0.72rem;
  font-weight: 200;
  letter-spacing: 0.07em;
  color: var(--ink-light);
  max-width: none;
  line-height: 1;
}

/* =========================================================
   LISTS
   ========================================================= */

ul {
  list-style: none;
  padding-left: 1.25rem;
  margin-bottom: 1.5rem;
}

ul li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.32em;
  height: 0.32em;
  background: currentColor;
}

/* =========================================================
   EDITORIAL DIVIDER
   ========================================================= */

.editorial-divider {
  width: 100%;
  border: none;
  border-top: 1px dotted rgba(0,0,0,0.3);
  opacity: 1;
  margin: var(--section-gap) 0;
}

/* CV — tighter dividers */
.page-cv .editorial-divider {
  margin: 2.5rem 0;
}

/* =========================================================
   MAIN
   ========================================================= */

main {
  padding: 3rem 0 6rem 0;
}

.page-home main {
  padding-top: 0;
}

/* =========================================================
   HOME — BACKGROUND IMAGE — removed
   ========================================================= */

.page-home #header {
  z-index: 100;
  background: var(--bg);
}

.page-home main {
  position: relative;
  z-index: 1;
}

/* =========================================================
   HOME — HERO  (full-bleed 16:9 video, editorial text strip below)
   ========================================================= */

.home-hero {
  display: flex;
  flex-direction: column;
}

/* Break video out of container to full page width */
.home-showreel {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
}

.home-showreel video {
  width: 100%;
  display: block;
  aspect-ratio: 1920 / 700;
  object-fit: cover;
  object-position: center center;
}

/* Text strip — back inside normal container flow */
.home-hero__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
  padding: 1.5rem 0 2.5rem 0;
  border-top: 1px dotted rgba(0,0,0,0.25);
  margin-top: 1.75rem;
}

.home-hero__name {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  max-width: none;
}

.home-hero__role {
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink-mid);
  margin-bottom: 0;
  max-width: none;
}

.home-hero__content .font-reading {
  margin-bottom: 0;
}

.home-hero__content .font-reading p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Contact */
.home-hero__contact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1;
  max-width: none;
  color: var(--ink-mid);
}

.home-hero__contact a {
  color: var(--ink-mid);
}

.home-hero__contact a:hover {
  color: var(--accent);
}

/* Mobile */
@media (max-width: 700px) {
  .home-showreel {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
  }

  .home-showreel video {
    aspect-ratio: unset;
    height: 56vw;
    min-height: 260px;
    max-height: 480px;
    object-fit: cover;
  }

  .home-hero__content {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
    padding-bottom: 1.5rem;
  }
}

/* =========================================================
   PORTFOLIO GRID
   ========================================================= */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin: 1.25rem 0 0 0;
}

.portfolio-grid a {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8e4de;
  opacity: 0;
  translate: 0 18px;
  transition:
    opacity   0.55s ease,
    translate 0.55s ease,
    filter    0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.portfolio-grid a.is-visible {
  opacity: 1;
  translate: 0 0;
}

.portfolio-grid a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(15%);
  transform: scale(1);
  transition:
    filter    0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ::after removed — scale animation is sufficient on hover */
.portfolio-grid a::after {
  display: none;
}

.portfolio-grid a:hover img {
  filter: grayscale(0%);
  transform: scale(1.035);
}

@media (max-width: 480px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

/* =========================================================
   PORTFOLIO VIDEO
   ========================================================= */

.portfolio-video {
  margin: 1.25rem 0 0 0;
}

.portfolio-video video {
  width: 100%;
  height: auto;
  display: block;
}

/* =========================================================
   CV — PROFILE
   ========================================================= */

.cv-profile {
  display: grid;
  grid-template-columns: 208px 1fr;
  column-gap: 2.5rem;
  align-items: start;
  margin: 2rem 0 0 0;
}

.cv-profile__image img {
  width: 100%;
  height: auto;
  display: block;
}

.cv-profile__text p {
  font-family: var(--font-reading);
  font-size: 1.2rem;
  line-height: 1.65;
  margin-bottom: 0.9rem;
  max-width: none;
}

.cv-profile__text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .cv-profile {
    grid-template-columns: 1fr;
    row-gap: 1.5rem;
  }

  .cv-profile__image {
    max-width: 182px;
  }
}

/* =========================================================
   CV — EXPERIENCE — two-column with dotted rule
   ========================================================= */

.cv-experience {
  display: grid;
  grid-template-columns: 2fr 3fr;
  column-gap: 3;
  position: relative;
  margin-bottom: 2.5rem;
  align-items: center;
}

.cv-experience::before {
  content: "";
  position: absolute;
  left: 40%;
  top: 0.25rem;
  bottom: 0;
  border-left: 1px dotted rgba(0,0,0,0.18);
  pointer-events: none;
}

.cv-experience__left {
  padding-right: 2rem;
  display: flex;
  align-items: center;
  align-self: center;
}

.cv-experience__right {
  padding-left: 2rem;
  align-self: start;
  max-width: 38rem;
}

.cv-experience__right ul {
  padding-left: 1rem;
  margin-bottom: 0;
}

.cv-experience__right ul li {
  margin-bottom: 0.75rem;
}

/* Role block */
.cv-role {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  column-gap: 2rem;
  align-items: center;
  margin-bottom: 0;
}

.cv-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cv-icon img {
  max-height: 3.5rem;
  width: auto;
  display: block;
  opacity: 1;
  filter: grayscale(100%);
}

.cv-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

.cv-text strong {
  display: block;
  margin-bottom: 0.1rem;
}

.cv-dates {
  font-size: 0.76rem;
  font-weight: 300;
  color: var(--ink-light);
  letter-spacing: 0.03em;
  display: block;
  margin-top: 0.1rem;
}

@media (max-width: 600px) {
  .cv-experience {
    grid-template-columns: 1fr;
  }

  .cv-experience::before {
    display: none;
  }

  .cv-experience__left {
    padding-right: 0;
    margin-bottom: 1rem;
    align-self: auto;
  }

  .cv-experience__right {
    padding-left: 0;
  }
}

/* =========================================================
   CV — TYPOGRAPHY SPACING
   ========================================================= */

/* h2 needs breathing room below on CV page */
.page-cv h2 {
  margin-bottom: 0.9rem;
}

/* =========================================================
   CV — CONTACT LIST (no bullets, no indent — email/phone only)
   ========================================================= */

.cv-tools-list {
  padding-left: 0;
}

.cv-tools-list li {
  padding-left: 0;
  font-size: 0.9rem;
}

.cv-tools-list li::before {
  display: none;
}

/* =========================================================
   PORTFOLIO — CTA
   ========================================================= */

.cta-block {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 2.5rem 0;
  border-top: 1px dotted rgba(0,0,0,0.3);
  margin-top: var(--section-gap);
}

.cta-text {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin: 0;
  max-width: none;
}

.cta-link {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(122, 32, 32, 0.5);
  padding-bottom: 0.1rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.cta-link:hover {
  border-color: var(--accent);
}

@media (max-width: 600px) {
  .cta-block {
    flex-direction: column;
    gap: 0.75rem;
  }
}

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#lightbox.lb-open {
  display: flex;
}

#lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  cursor: pointer;
}

/* Spinner while loading */
#lightbox.lb-loading #lb-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.7);
  border-radius: 50%;
  animation: lb-spin 0.7s linear infinite;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

#lb-figure {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 88vw;
  max-height: 90vh;
  gap: 0.75rem;
}

#lb-img {
  display: block;
  max-width: 88vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#lb-img.lb-img-visible {
  opacity: 1;
}

#lb-caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  text-align: center;
  max-width: 60ch;
}

#lb-counter {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  translate: -50% 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  z-index: 2;
}

/* Close button */
#lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
  font-family: var(--font-mono);
}

#lb-close:hover {
  color: #fff;
}

/* Prev / Next buttons */
#lb-prev,
#lb-next {
  position: fixed;
  top: 50%;
  translate: 0 -50%;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 1rem;
  transition: color 0.2s, opacity 0.2s;
  font-family: var(--font-mono);
  line-height: 1;
}

#lb-prev { left: 1rem; }
#lb-next { right: 1rem; }

#lb-prev:hover,
#lb-next:hover {
  color: #fff;
}

@media (max-width: 600px) {
  #lb-prev { left: 0.25rem; }
  #lb-next { right: 0.25rem; }
  #lb-figure { max-width: 96vw; }
  #lb-img { max-width: 96vw; max-height: 75vh; }
}

/* =========================================================
   FOOTER
   ========================================================= */

#footer {
  display: none;
}