/* calvincunningham.com — styles.
   Design tokens live at the top; everything else derives from them.
   Rule of the house: no inline styles anywhere (CSP-enforced in prod). */

/* ---------- Fonts (self-hosted) ---------- */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-300-italic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg:             #0A0A0B;
  --surface:        #131315;
  --surface-raised: #1A1A1D;
  --hairline:       rgba(255, 255, 255, 0.09);
  --hairline-hover: rgba(255, 255, 255, 0.22);
  --text:           #F2F0EB;
  --text-secondary: #9C9891;
  --accent:         #0366E0;

  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Inter", system-ui, -apple-system, sans-serif;

  --pad-inline: clamp(20px, 5vw, 48px);
  --section-pad: clamp(80px, 14vw, 160px);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---------- Reset / base ---------- */

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

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

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

/* ---------- Utilities ---------- */

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--bg);
  border: 1px solid var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Animated accent underline for text links */
.u-link {
  text-decoration: none;
  padding-bottom: 3px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.25s var(--ease);
}

.u-link:hover,
.u-link:focus-visible {
  background-size: 100% 1px;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px var(--pad-inline);
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.site-header.scrolled {
  background: rgba(10, 10, 11, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--hairline);
}

.brand {
  font: 500 0.78rem var(--font-body);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: clamp(20px, 3vw, 36px);
}

.site-nav a {
  font: 400 0.78rem var(--font-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-secondary);
  padding-bottom: 3px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: color 0.25s var(--ease), background-size 0.25s var(--ease);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  background-size: 100% 1px;
}

/* ---------- Layout containers ---------- */

.section {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--pad-inline);
  padding-block: var(--section-pad);
}

.section-label {
  font: 500 0.75rem/1 var(--font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: clamp(36px, 5vw, 56px);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 96px var(--pad-inline);
  overflow: hidden;
}

/* Background media: filled by JS with img/hero.jpg or img/hero.mp4.
   JS drives a slow parallax drift on scroll (skipped for reduced motion). */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg);
  will-change: transform;
}

.hero-media img,
.hero-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.hero-media img.loaded,
.hero-media video.loaded {
  opacity: 1;
}

/* Until hero.jpg / hero.mp4 exist: a quiet cool-toned gradient */
.hero-media.is-placeholder {
  background:
    radial-gradient(ellipse 65% 55% at 50% 38%, rgba(3, 102, 224, 0.10), transparent 68%),
    radial-gradient(ellipse 130% 80% at 50% 115%, rgba(3, 102, 224, 0.05), transparent 60%),
    var(--bg);
}

/* Readability scrim; bottom fades into the page background */
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 11, 0.60) 0%,
    rgba(10, 10, 11, 0.28) 42%,
    rgba(10, 10, 11, 0.55) 74%,
    #0A0A0B 100%
  );
}

/* Fine film grain, tiled SVG noise at very low opacity */
.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-inner {
  position: relative;
  z-index: 3;
}

.hero-name {
  font: 300 clamp(2rem, 7.5vw, 6rem)/1.05 var(--font-display);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.hero-rule {
  width: 56px;
  height: 1px;
  background: var(--accent);
  margin: 28px auto;
}

.hero-tagline {
  font: 400 0.85rem var(--font-body);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  z-index: 3;
  width: 1px;
  height: 48px;
  background: linear-gradient(rgba(242, 240, 235, 0), rgba(242, 240, 235, 0.55));
  animation: cue-fade 2.8s var(--ease) infinite;
}

@keyframes cue-fade {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ---------- Work ---------- */

.work-list {
  display: grid;
  gap: clamp(64px, 9vw, 104px);
}

.work-item {
  margin: 0;
}

.tile {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.25s var(--ease);
}

.tile:hover {
  border-color: var(--hairline-hover);
}

/* Placeholder ("coming soon") tile */
.tile-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.tile-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 62% 52% at 50% 36%, rgba(3, 102, 224, 0.08), transparent 70%);
}

.tile-placeholder .ph-title {
  position: relative;
  font: 300 clamp(1.15rem, 2.4vw, 1.6rem) var(--font-display);
  font-style: italic;
  color: var(--text-secondary);
}

.tile-placeholder .ph-rule {
  position: relative;
  width: 32px;
  height: 1px;
  background: var(--hairline-hover);
}

.tile-placeholder .ph-soon {
  position: relative;
  font: 500 0.7rem var(--font-body);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Click-to-play facade */
.tile-facade {
  display: block;
  padding: 0;
  text-align: center;
}

.tile-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

.tile-facade:hover .tile-poster,
.tile-facade:focus-visible .tile-poster {
  transform: scale(1.02);
}

.play-glyph {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(242, 240, 235, 0.55);
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.play-glyph::after {
  content: "";
  border-left: 13px solid var(--text);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 4px;
}

.tile-facade:hover .play-glyph,
.tile-facade:focus-visible .play-glyph {
  border-color: var(--text);
  background: rgba(10, 10, 11, 0.55);
}

/* Live player */
.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  overflow: hidden;
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Credit line under each tile */
.credit {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.credit-title {
  font: 300 clamp(1.2rem, 2.4vw, 1.5rem) var(--font-display);
}

.credit-meta {
  font: 400 0.72rem var(--font-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- Film photography collage ----------
   Masonry via CSS columns: photos keep their natural aspect ratio,
   mixed orientations flow into an editorial collage. */

.photo-collage {
  columns: 3;
  column-gap: 20px;
}

.photo-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 20px;
  break-inside: avoid;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.25s var(--ease);
}

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

.photo-btn img {
  width: 100%;
  height: auto;
  transition: transform 0.3s var(--ease);
}

.photo-btn:hover img,
.photo-btn:focus-visible img {
  transform: scale(1.02);
}

/* ---------- About ---------- */

.about-inner {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}

.portrait {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  overflow: hidden;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
}

/* Placeholder shown until img/portrait.jpg exists */
.portrait-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 32%, rgba(3, 102, 224, 0.07), transparent 70%);
}

.portrait-placeholder::after {
  content: "CC";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 300 3rem var(--font-display);
  font-style: italic;
  color: var(--text-secondary);
  opacity: 0.45;
}

.bio {
  font-size: 1.125rem;
  line-height: 1.75;
  max-width: 55ch;
  color: var(--text);
}

/* ---------- Footer / contact ---------- */

.footer {
  padding-bottom: clamp(48px, 6vw, 80px);
}

.footer-heading {
  font: 300 clamp(2.25rem, 5vw, 3.5rem)/1.1 var(--font-display);
  margin-bottom: clamp(32px, 5vw, 48px);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(28px, 4vw, 48px);
}

.contact-links a {
  font-size: 1rem;
  color: var(--text);
}

.fine-print {
  margin-top: clamp(56px, 8vw, 96px);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: none;
  padding: 0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox[open] {
  display: flex;
}

.lightbox::backdrop {
  background: rgba(10, 10, 11, 0.95);
}

.lb-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
}

.lb-btn {
  position: absolute;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-secondary);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.5);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.lb-btn:hover,
.lb-btn:focus-visible {
  color: var(--text);
  border-color: var(--hairline-hover);
}

.lb-close {
  top: 20px;
  right: 20px;
  font-size: 1.6rem;
}

.lb-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- No-JS note ---------- */

.noscript-note {
  max-width: 1240px;
  margin-inline: auto;
  padding: 48px var(--pad-inline);
  color: var(--text-secondary);
}

.noscript-note a {
  color: var(--text);
}

/* ---------- Reveal on scroll (added by JS) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .photo-collage {
    columns: 2;
  }
}

@media (max-width: 720px) {
  /* Header collapses to name + Contact */
  .site-nav a[data-section-link] {
    display: none;
  }

  .credit {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .about-inner {
    grid-template-columns: 1fr;
  }

  .portrait {
    max-width: 300px;
  }

  .contact-links {
    flex-direction: column;
    gap: 20px;
  }

  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

@media (max-width: 600px) {
  .photo-collage {
    column-gap: 12px;
  }

  .photo-btn {
    margin-bottom: 12px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
