/* =========================================================
   JUHANA SELIN — PORTFOLIO (clone redesign)
   "Editorial darkroom" — warm near-black ground, bone type,
   vermilion signal accent. Fraunces display / Azeret Mono UI.
   Static build — no CMS, no build step.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62.5..125,100..900&family=Azeret+Mono:wght@300..700&display=swap');

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

:root {
  --font-mono: 'Azeret Mono', monospace;
  /* Archivo variable (Google Fonts) — display elements take its
     expanded cut via font-stretch: 125% */
  --font-display: 'Archivo', sans-serif;
  --font-text: 'Archivo', sans-serif;

  --bg: #131110;            /* warm near-black ground        */
  --bg-translucent: rgba(19, 17, 16, 0.86);
  --raise: #1c1916;          /* raised panels                 */
  --stone: #221f1c;          /* image placeholders            */
  --ink: #ebe4d8;            /* bone — primary text           */
  --muted: #9a9082;          /* secondary text                */
  --faint: #6b6358;          /* tertiary text                 */
  --line: rgba(235, 228, 216, 0.18);
  --line-dotted: 1px dotted rgba(235, 228, 216, 0.32);

  --red: #ff4b33;            /* vermilion — the only accent   */
  --red-deep: #b81f0c;       /* footer / fills                */
  --on-red: #190b08;         /* text on vermilion             */

  --gap: 1.25rem;
  --max-width: 1200px;
  --reading-width: 42rem;
  --header-height: 4.75rem;

  --ease-out: cubic-bezier(0.22, 0.68, 0.22, 1);
}

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

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

html {
  scroll-behavior: smooth;
}

html, body {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 350;
  line-height: 1.65;
  color: var(--ink);
}

body {
  padding-top: var(--header-height);
  background:
    radial-gradient(110% 55% at 75% -12%, rgba(255, 75, 51, 0.075), transparent 62%),
    radial-gradient(85% 45% at 8% 108%, rgba(255, 75, 51, 0.05), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

/* Film grain — fixed overlay, never intercepts input */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.14;
  mix-blend-mode: overlay;
}

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

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

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

hr {
  display: none;
}

::selection {
  background: var(--red);
  color: var(--on-red);
}

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

/* Skip link — visible only on keyboard focus */
.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2000;
  padding: 0.7em 1.1em;
  background: var(--red);
  color: var(--on-red);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  translate: 0 calc(-100% - 1.2rem);
  transition: translate 0.25s var(--ease-out);
}

.skip-link:focus-visible,
.skip-link:visited {
  color: var(--on-red);
}

.skip-link:focus {
  translate: 0 0;
}

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

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

main {
  padding: 3.5rem 0 7rem 0;
}

@media (max-width: 480px) {
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

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

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--bg-translucent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: var(--line-dotted);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Wordmark */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55em;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wordmark .dot {
  width: 0.45em;
  height: 0.45em;
  background: var(--red);
  transition: transform 0.35s var(--ease-out);
}

.wordmark:hover .dot {
  transform: rotate(135deg);
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2.75rem;
  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.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  position: relative;
  transition: color 0.25s;
}

nav ul a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

nav ul a:hover,
nav ul li.active a {
  color: var(--ink);
}

nav ul a:hover::after,
nav ul li.active a::after {
  transform: scaleX(1);
}

nav ul li.active a::after {
  height: 2px;
}

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

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

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

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

  nav.open {
    display: block;
    animation: nav-drop 0.3s var(--ease-out);
  }

  @keyframes nav-drop {
    from { opacity: 0; translate: 0 -8px; }
    to   { opacity: 1; translate: 0 0; }
  }

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

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

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

h2 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 3.25rem 0 1rem 0;
}

h2::before {
  content: "/ ";
  color: var(--red);
}

h2:first-child {
  margin-top: 0;
}

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

p {
  max-width: var(--reading-width);
  margin-bottom: 0.9rem;
}

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

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

em {
  font-style: italic;
}

.font-reading p {
  font-family: var(--font-text);
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 0.9rem;
}

/* Dotted inline links */
.link-dotted {
  border-bottom: var(--line-dotted);
  transition: color 0.2s, border-color 0.2s;
}

.link-dotted:hover {
  color: var(--red);
  border-color: var(--red);
}

/* External link — mono label with vermilion arrow */
.link-external {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: var(--line-dotted);
  padding-bottom: 3px;
  transition: color 0.2s, border-color 0.2s;
}

.link-external::after {
  content: "\2197";
  color: var(--red);
  margin-left: 0.45em;
  display: inline-block;
  transition: translate 0.25s var(--ease-out);
}

.link-external:hover {
  color: var(--red);
  border-color: var(--red);
}

.link-external:hover::after {
  translate: 2px -2px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.95em 1.5em;
  border: 1px solid var(--line);
  color: var(--ink);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.btn .arrow {
  display: inline-block;
  transition: translate 0.25s var(--ease-out);
}

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

.btn:hover .arrow {
  translate: 4px 0;
}

.btn--primary {
  background: var(--red);
  border-color: var(--red);
  color: var(--on-red);
}

.btn--primary:visited {
  color: var(--on-red);
}

.btn--primary:hover {
  background: transparent;
  color: var(--red);
}

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

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

ul li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--muted);
}

ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 0.32em;
  height: 0.32em;
  background: var(--red);
}

ul.plain {
  padding-left: 0;
}

ul.plain li {
  padding-left: 0;
}

ul.plain li::before {
  display: none;
}

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

.editorial-divider {
  width: 10rem;
  border: none;
  border-top: var(--line-dotted);
  margin: 4.5rem 0;
}

/* =========================================================
   PAGE INTRO (portfolio & CV)
   ========================================================= */

.page-intro {
  padding: 2.5rem 0 4rem 0;
}

.page-intro__kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.1rem;
  max-width: none;
}

.page-intro__title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  max-width: 22ch;
  margin-bottom: 1.25rem;
}

.page-intro__title em {
  color: var(--red);
  font-style: normal;
}

.page-intro__meta {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  max-width: none;
}

.page-intro__meta .sep {
  color: var(--red);
  margin: 0 0.5em;
}

/* =========================================================
   HOME — HERO (full-bleed, two-column)
   ========================================================= */

.page-home main {
  padding: 0;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 54%) minmax(0, 46%);
  align-items: center;
  min-height: calc(100vh - var(--header-height));
}

.home-showreel {
  position: relative;
  align-self: stretch;
  background: var(--stone);
  overflow: hidden;
  border-right: var(--line-dotted);
}

.home-showreel video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.home-hero__content {
  padding: 4rem clamp(2rem, 6vw, 6rem);
  max-width: 40rem;
}

.home-hero__kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.4rem;
  max-width: none;
}

.home-hero__name {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  max-width: none;
}

.home-hero__name em {
  font-style: normal;
  color: var(--red);
}

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

.home-hero__content .font-reading p {
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--muted);
}

.home-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 2.5rem;
}

.home-hero__contact {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  line-height: 1.8;
  color: var(--muted);
  max-width: none;
}

.home-hero__contact a {
  color: var(--ink);
  border-bottom: var(--line-dotted);
  transition: color 0.2s, border-color 0.2s;
}

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

.home-hero__contact span {
  display: block;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .home-showreel {
    align-self: auto;
    border-right: none;
    border-bottom: var(--line-dotted);
  }

  .home-showreel video {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .home-hero__content {
    padding: 3rem 2rem 4.5rem 2rem;
  }
}

/* =========================================================
   PORTFOLIO — LAYOUT WITH PROJECT INDEX
   ========================================================= */

.portfolio-layout {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  column-gap: 3.5rem;
  align-items: start;
}

.project-index-nav {
  position: sticky;
  top: calc(var(--header-height) + 2.5rem);
}

.project-index-nav ul {
  padding-left: 0;
  margin-bottom: 0;
}

.project-index-nav li {
  padding-left: 0;
  margin-bottom: 0.9rem;
}

.project-index-nav li::before {
  display: none;
}

.project-index-nav a {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.45;
  color: var(--faint);
  transition: color 0.2s, translate 0.25s var(--ease-out);
}

.project-index-nav a .idx {
  color: var(--faint);
  margin-right: 0.6em;
  transition: color 0.2s;
}

.project-index-nav a:hover,
.project-index-nav li.current a {
  color: var(--ink);
}

.project-index-nav a:hover {
  translate: 3px 0;
}

.project-index-nav a:hover .idx,
.project-index-nav li.current a .idx {
  color: var(--red);
}

/* Below 1024px the rail becomes a sticky horizontal chip bar
   so in-page navigation survives on mobile */
@media (max-width: 1023px) {
  .portfolio-layout {
    display: block;
  }

  .project-index-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    margin: 0 -2rem 2.5rem -2rem;
    padding: 0.8rem 2rem;
    background: var(--bg-translucent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: var(--line-dotted);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .project-index-nav::-webkit-scrollbar {
    display: none;
  }

  .project-index-nav ul {
    display: flex;
    gap: 1.5rem;
  }

  .project-index-nav li {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .project-index-nav a:hover {
    translate: 0 0;
  }
}

@media (max-width: 480px) {
  .project-index-nav {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* =========================================================
   PORTFOLIO — PROJECT SECTIONS
   ========================================================= */

.project {
  scroll-margin-top: calc(var(--header-height) + 4.5rem);
}

@media (max-width: 1023px) {
  .project {
    scroll-margin-top: calc(var(--header-height) + 5rem);
  }
}

/* Mono numeral with a dotted rule running off it */
.project-number {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1;
  color: var(--red);
  margin-bottom: 1.1rem;
  max-width: none;
}

.project-number::after {
  content: "";
  flex: 1;
  border-top: var(--line-dotted);
}

.project-title::before {
  content: none;
}

.project-title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-transform: none;
  margin: 0 0 0.6rem 0;
}

.project-meta {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.5rem;
  max-width: none;
}

.project .font-reading {
  max-width: var(--reading-width);
}

.project .font-reading p {
  color: var(--muted);
}

.project-credits {
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--faint);
  margin-top: 1rem;
}

.project-links {
  margin-top: 1.75rem;
}

/* Lead image — full container width, natural aspect ratio */
.project-lead {
  display: block;
  position: relative;
  margin: 2.25rem 0 0 0;
  overflow: hidden;
  background: var(--stone);
}

.project-lead img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-lead:hover img {
  transform: scale(1.015);
}

.project-lead::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--red);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.project-lead:hover::after,
.project-lead:focus-visible::after {
  opacity: 1;
}

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

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

.portfolio-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-grid a {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--stone);
}

.portfolio-grid .span-2 {
  grid-column: span 2;
  aspect-ratio: 2.06 / 1;
}

.portfolio-grid a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.94) saturate(0.95);
  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);
}

/* Vermilion inset border on hover & keyboard focus */
.portfolio-grid a::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--red);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.portfolio-grid a:hover img,
.portfolio-grid a:focus-visible img {
  filter: brightness(1) saturate(1);
  transform: scale(1.035);
}

.portfolio-grid a:hover::after,
.portfolio-grid a:focus-visible::after {
  opacity: 1;
}

/* Caption — slides up on hover */
.portfolio-grid a[data-cap]::before {
  content: attr(data-cap);
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
  padding: 0.45em 0.95em;
  translate: 0 100%;
  transition: translate 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
}

.portfolio-grid a[data-cap]:hover::before,
.portfolio-grid a[data-cap]:focus-visible::before {
  translate: 0 0;
}

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

  .portfolio-grid--two {
    grid-template-columns: 1fr;
  }

  .portfolio-grid--two a {
    aspect-ratio: auto;
  }

  .portfolio-grid .span-2 {
    grid-column: span 2;
  }
}

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

.portfolio-video {
  margin: 2.25rem 0 0 0;
  background: var(--stone);
}

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

/* =========================================================
   SCROLL REVEAL (JS adds .is-visible; gated on .js so
   content stays visible if JS never runs)
   ========================================================= */

.js .reveal,
.js .portfolio-grid a {
  opacity: 0;
  translate: 0 20px;
}

.js .reveal.is-visible {
  opacity: 1;
  translate: 0 0;
  transition: opacity 0.65s ease, translate 0.65s var(--ease-out);
}

.js .portfolio-grid a {
  transition:
    opacity 0.55s ease,
    translate 0.55s var(--ease-out),
    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);
}

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

/* =========================================================
   PAGE-LOAD ORCHESTRATION — one staggered rise per page
   ========================================================= */

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes panel-reveal {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

.js .anim {
  animation: rise 0.85s var(--ease-out) both;
}

.js .anim-1 { animation-delay: 0.08s; }
.js .anim-2 { animation-delay: 0.18s; }
.js .anim-3 { animation-delay: 0.28s; }
.js .anim-4 { animation-delay: 0.38s; }
.js .anim-5 { animation-delay: 0.48s; }
.js .anim-6 { animation-delay: 0.58s; }

.js .anim-panel {
  animation: panel-reveal 1.1s var(--ease-out) 0.15s both;
}

/* =========================================================
   CV
   ========================================================= */

/* Scoped to main so the fixed header/footer keep the same
   width on every page — no nav jump when entering the CV */
.page-cv main .container {
  max-width: 960px;
}

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

.cv-profile__image {
  position: relative;
  background: var(--stone);
}

.cv-profile__image img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(20%);
}

.cv-profile__image::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: var(--red);
}

.cv-profile__text p {
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 0.9rem;
  max-width: none;
}

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

.cv-profile__text p:first-child {
  color: var(--ink);
  font-size: 1.15rem;
}

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

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

/* CV entry — date rail + body */
.cv-entry {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  column-gap: 2.5rem;
  align-items: start;
  padding: 1.75rem 0;
  border-top: var(--line-dotted);
}

.cv-entry:last-of-type {
  border-bottom: var(--line-dotted);
}

.cv-entry__when {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.35rem;
}

.cv-entry--current .cv-entry__when {
  color: var(--red);
}

.cv-entry__head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Logo chip — bone tile so original dark marks stay legible */
.cv-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--ink);
  padding: 0.45rem;
}

.cv-logo img {
  max-height: 100%;
  width: auto;
  max-width: 100%;
  filter: grayscale(100%);
}

.cv-entry__role strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
}

.cv-entry__role span {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cv-entry__body ul {
  margin-bottom: 0;
  padding-left: 0;
}

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

  .cv-entry__when {
    padding-top: 0;
  }
}

/* Skill list in two columns at desktop */
.cv-skills {
  columns: 2;
  column-gap: 3rem;
}

.cv-skills li {
  break-inside: avoid;
}

@media (max-width: 600px) {
  .cv-skills {
    columns: 1;
  }
}

/* Compact three-up meta block: tools / education / languages */
.cv-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
}

.cv-cols h2 {
  margin-top: 0;
}

.cv-cols ul {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .cv-cols {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .cv-cols section + section h2 {
    margin-top: 2.5rem;
  }
}

.cv-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */

#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(12, 10, 9, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

#lightbox.lb-loading #lb-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(235, 228, 216, 0.15);
  border-top-color: rgba(235, 228, 216, 0.75);
  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;
  transform: scale(0.965);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#lb-img.lb-img-visible {
  opacity: 1;
  transform: scale(1);
}

#lb-caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 350;
  letter-spacing: 0.08em;
  color: rgba(235, 228, 216, 0.78);
  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: 350;
  letter-spacing: 0.1em;
  color: rgba(235, 228, 216, 0.65);
  z-index: 2;
}

#lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(235, 228, 216, 0.65);
  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: var(--ink);
}

#lb-prev,
#lb-next {
  position: fixed;
  top: 50%;
  translate: 0 -50%;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(235, 228, 216, 0.65);
  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:not(:disabled),
#lb-next:hover:not(:disabled) {
  color: var(--ink);
}

#lb-prev:disabled,
#lb-next:disabled {
  opacity: 0.18;
  cursor: default;
}

@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 — CONTACT CTA
   ========================================================= */

#footer {
  position: relative;
  background:
    radial-gradient(120% 90% at 85% -20%, rgba(255, 130, 100, 0.35), transparent 60%),
    linear-gradient(175deg, #d62a10 0%, var(--red-deep) 100%);
  color: #fff8f0;
  padding: 5.5rem 0 4.5rem 0;
  overflow: hidden;
}

.footer-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 248, 240, 0.75);
  margin-bottom: 1.1rem;
  max-width: none;
}

.footer-title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  max-width: none;
}

.footer-title em {
  font-style: normal;
}

#footer a,
#footer a:visited {
  color: #fff8f0;
}

.footer-mail {
  display: inline-block;
  font-family: var(--font-text);
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  font-weight: 400;
  border-bottom: 1px dotted rgba(255, 248, 240, 0.55);
  padding-bottom: 3px;
  margin-bottom: 2.25rem;
  transition: border-color 0.2s;
}

.footer-mail:hover {
  border-bottom-style: solid;
  border-color: #fff8f0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 2.25em;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 248, 240, 0.8);
  max-width: none;
}

/* =========================================================
   BRAND PAGE (brand.html — internal style guide)
   ========================================================= */

.brand-note {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--faint);
  margin-bottom: 2rem;
}

/* Color swatches — whole card is a click-to-copy button */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: 1.5rem;
}

.swatch {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid var(--line);
  padding: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  color: var(--ink);
  transition: border-color 0.25s;
}

.swatch:hover {
  border-color: var(--red);
}

.swatch__chip {
  display: block;
  height: 6.5rem;
  border-bottom: 1px solid var(--line);
}

.swatch--lead .swatch__chip {
  height: 10rem;
}

.swatch__info {
  display: block;
  padding: 0.9rem 1rem 1rem 1rem;
}

.swatch__name {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.swatch__hex {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.swatch__rgb {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-top: 0.15rem;
}

.swatch__role {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--faint);
  margin-top: 0.6rem;
}

.swatch.is-copied .swatch__hex {
  color: var(--red);
}

.swatch.is-copied .swatch__hex::after {
  content: " — copied";
}

@media (max-width: 767px) {
  .swatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Type specimens */
.specimen {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  column-gap: 3rem;
  padding: 2.5rem 0;
  border-top: var(--line-dotted);
}

.specimen:last-of-type {
  border-bottom: var(--line-dotted);
}

.specimen__meta {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  line-height: 1.7;
  color: var(--faint);
}

.specimen__meta strong {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.specimen__meta span {
  display: block;
}

.specimen__sample {
  max-width: none;
  overflow-wrap: break-word;
}

.specimen__sample--display {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.specimen__sample--display em {
  font-style: normal;
  color: var(--red);
}

.specimen__sample--text {
  font-family: var(--font-text);
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--muted);
  max-width: var(--reading-width);
}

.specimen__sample--mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 2.1;
  color: var(--muted);
}

.specimen__sample--mono .red {
  color: var(--red);
}

.specimen__alphabet {
  display: block;
  margin-top: 1rem;
  font-size: 0.6em;
  line-height: 1.4;
  color: var(--muted);
}

.specimen__sample--mono .specimen__alphabet {
  font-size: 0.95em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.06em;
}

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

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@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;
  }

  .js .reveal,
  .js .portfolio-grid a {
    opacity: 1;
    translate: 0 0;
  }
}
