/* Portfolio — warm, refined, Justin Mason–inspired */

:root {
  --bg: #fafaf9;
  --bg-card: #f5f5f4;
  --text: #000000;
  --text-secondary: #45403c;
  --text-muted: #58534d;
  --text-faint: #a6a09b;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.1);
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --max: 1340px;
  --narrow: 720px;
  --signoff: 780px;
  --radius: 12px;
  --space-section: clamp(6rem, 14vw, 11rem);
  --space-block: clamp(3.5rem, 7vw, 6rem);
}

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

/* ---- Custom cursor (mouse/trackpad only) ---- */
@media (pointer: fine) {
  *, *::before, *::after { cursor: none !important; }

  .cursor-dot,
  .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    z-index: 10002;
  }

  .cursor-dot {
    width: 8px;
    height: 8px;
    background: #fff;
  }

  .cursor-ring {
    width: 36px;
    height: 36px;
    border: 1.5px solid #fff;
    background: transparent;
    z-index: 10001;
    transition: width 250ms cubic-bezier(0.22, 1, 0.36, 1),
                height 250ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 200ms ease;
  }

  .cursor-ring.is-hovering {
    width: 58px;
    height: 58px;
  }

  .cursor-ring.is-clicking {
    width: 20px;
    height: 20px;
  }

  body.cursor-away .cursor-dot,
  body.cursor-away .cursor-ring {
    opacity: 0;
  }
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg);
}

/* Subtle grain texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

.wrap--narrow {
  max-width: var(--narrow);
}

.wrap--signoff {
  max-width: var(--signoff);
  text-align: center;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Floating pill nav ---- */
.site-header {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0.35rem;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.15),
    0 4px 16px 0 rgba(0, 0, 0, 0.08),
    0 1px 3px 0 rgba(0, 0, 0, 0.06);
}

.nav-links {
  display: flex;
  gap: 0;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 999px;
  transition: color 0.3s ease, background 0.3s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.035);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  width: 1.1rem;
  background: var(--text-secondary);
  margin: 0 auto;
  transition: transform 0.25s, opacity 0.25s;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  padding: clamp(10rem, 22vw, 18rem) 0 var(--space-section);
  text-align: center;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
}

.hero .wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-noise {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
}

.hero-glow {
  display: none;
}

.hero-heading {
  font-family: var(--font-serif);
  font-size: clamp(4rem, 14vw, 17rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.04em;
  color: var(--text);
}

/* Letter float animation */
/* Word groups — each is non-breaking so wrap only occurs between them */
.hero-word {
  display: inline-block;
  white-space: nowrap;
}

.hero-letter {
  display: inline-block;
}

.hero-space {
  display: inline-block;
  width: 0.28em;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-letter {
    animation: heroFloat 2.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * 80ms);
  }
}

.hero-sub {
  margin-top: clamp(2.25rem, 4vw, 3.5rem);
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 42ch;
}

.hero-meta {
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  color: var(--text-faint);
}

.hero-meta a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0, 0, 0, 0.15);
}

.hero-meta a:hover {
  color: var(--text);
  text-decoration-color: rgba(0, 0, 0, 0.4);
}

/* ---- Section heading ---- */
.section-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-block);
  text-align: center;
}

/* ---- Project cards ---- */
.project-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 7vw, 6rem);
}

.project-card {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(2rem, 3.5vw, 3rem);
  align-items: center;
  text-decoration: none;
  padding: clamp(1.75rem, 3.5vw, 3rem);
  border-radius: calc(var(--radius) + 8px);
  background: transparent;
  transition: background 200ms ease-out;
}

.project-card:hover {
  text-decoration: none;
  background: rgba(0, 0, 0, 0.03);
}

.project-card__media {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #e7e5e4 0%, #d6d3d1 100%);
}

.project-card__media img,
.project-card__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e7e5e4 0%, #d6d3d1 100%);
}

.project-card__placeholder span {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  color: rgba(0, 0, 0, 0.12);
  font-style: italic;
}

.project-card__body {
  padding: 0;
}

.project-card__year {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.project-card__title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.project-card__desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 52ch;
  margin-bottom: 1.25rem;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.6);
}

/* ---- Work section ---- */
.work {
  padding-bottom: var(--space-section);
}

/* ---- About ---- */
.about {
  padding: var(--space-block) 0;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.about-copy {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 56ch;
  line-height: 1.6;
}

.about-copy + .about-copy {
  margin-top: 1.25rem;
}

.text-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(0, 0, 0, 0.2);
  transition: text-decoration-color 0.2s;
}

.text-link:hover {
  color: var(--text);
  text-decoration-color: rgba(0, 0, 0, 0.5);
}

/* ---- Signoff ---- */
.signoff {
  padding: var(--space-section) 0;
}

.signoff-headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
  text-wrap: balance;
}

.signoff-cta {
  margin-top: clamp(2rem, 3.5vw, 3rem);
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 3.5rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-faint);
}


.footer-social a:hover {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-credit {
  font-size: 0.8125rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.reveal-d1 { transition-delay: 0.12s; }
.reveal-d2 { transition-delay: 0.24s; }

/* Project cards get a subtle shift on reveal */
.project-card.reveal {
  transform: translateY(36px);
  transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    background 200ms ease-out;
}

.project-card.reveal.visible {
  transform: none;
}

/* Hero heading gets a longer, more dramatic entrance */
.hero-heading.reveal {
  transform: translateY(36px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Signoff headline entrance */
.signoff-headline.reveal {
  transform: translateY(32px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .site-header {
    top: 1rem;
  }

  .nav-pill {
    flex-direction: column;
    border-radius: var(--radius);
    padding: 0.5rem;
    min-width: 200px;
  }

  .nav-toggle {
    display: flex;
    align-self: center;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-top: 0.25rem;
  }

  .nav-links a {
    border-radius: 8px;
    padding: 0.6rem 1rem;
  }

  .nav-pill.is-open .nav-links {
    display: flex;
  }

  .nav-pill.is-open .nav-toggle span:first-child {
    transform: translateY(3.25px) rotate(45deg);
  }

  .nav-pill.is-open .nav-toggle span:last-child {
    transform: translateY(-3.25px) rotate(-45deg);
  }

  .hero {
    padding-top: clamp(7rem, 14vw, 10rem);
  }

  .hero-heading {
    font-size: clamp(2.75rem, 12vw, 4rem);
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .project-card__body {
    order: 2;
  }

  .project-card__media {
    order: 1;
    aspect-ratio: 16 / 9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
