/* ─────────────────────────────────────────────────────────────────
   TINTIN.CX — Design System
   ───────────────────────────────────────────────────────────────── */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  /* Palette */
  --color-bg:         #FAFAF8;
  --color-surface:    #F2EDE6;
  --color-border:     #E5DFD5;
  --color-accent:     #B87060;   /* muted terracotta */
  --color-accent-dim: #C9896F22; /* for ambient glow */
  --color-text:       #1C1917;
  --color-muted:      #79706B;
  --color-subtle:     #B5ADA7;

  /* Typography */
  --font-serif:  'Instrument Serif', Georgia, serif;
  --font-sans:   'Geist', system-ui, -apple-system, sans-serif;

  /* Type scale (fluid) */
  --text-xs:   clamp(0.7rem,   0.65rem  + 0.25vw, 0.8rem);
  --text-sm:   clamp(0.85rem,  0.8rem   + 0.25vw, 0.95rem);
  --text-base: clamp(1rem,     0.95rem  + 0.25vw, 1.05rem);
  --text-lg:   clamp(1.1rem,   1rem     + 0.5vw,  1.25rem);
  --text-xl:   clamp(1.25rem,  1.1rem   + 0.75vw, 1.5rem);
  --text-2xl:  clamp(1.5rem,   1.25rem  + 1.25vw, 2rem);
  --text-3xl:  clamp(2rem,     1.5rem   + 2.5vw,  3rem);
  --text-hero: clamp(3.5rem,   2.5rem   + 5vw,    7rem);

  /* Spacing */
  --space-1:   0.25rem;
  --space-2:   0.5rem;
  --space-3:   0.75rem;
  --space-4:   1rem;
  --space-6:   1.5rem;
  --space-8:   2rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;
  --space-20:  5rem;
  --space-24:  6rem;
  --space-32:  8rem;

  /* Layout */
  --max-width:   1100px;
  --gutter:      clamp(1.5rem, 5vw, 4rem);

  /* Motion */
  --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:   cubic-bezier(0.45, 0, 0.15, 1);
  --duration-fast: 250ms;
  --duration-base: 500ms;
  --duration-slow: 900ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 300;
  line-height: 1.7;
  cursor: none;           /* hide default — we use custom cursor */
  overflow-x: hidden;
}

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

ul { list-style: none; }

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

/* ── Custom Cursor ──────────────────────────────────────────────── */
.cursor,
.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.cursor {
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  will-change: transform;
}

.cursor-follower {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-accent);
  opacity: 0.4;
  transition: width 400ms var(--ease-out),
              height 400ms var(--ease-out),
              opacity 400ms var(--ease-out),
              transform 80ms linear;
}

body.cursor-hover .cursor-follower {
  width: 48px;
  height: 48px;
  opacity: 0.6;
}

body.cursor-hover .cursor {
  transform: translate(-50%, -50%) scale(1.5);
}

/* White cursor on dark/terracotta surfaces */
body.cursor-on-dark .cursor {
  background: #FAF9F6;
}

body.cursor-on-dark .cursor-follower {
  border-color: #FAF9F6;
}

/* On touch devices, hide cursor elements */
@media (pointer: coarse) {
  .cursor,
  .cursor-follower { display: none; }
  body { cursor: auto; }
}

/* ── Layout Utilities ───────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(var(--space-16), 12vw, var(--space-32));
}

.label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-subtle);
}

/* ── Scroll Reveal ──────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay for siblings */
.reveal:nth-child(2) { transition-delay: 80ms; }
.reveal:nth-child(3) { transition-delay: 160ms; }
.reveal:nth-child(4) { transition-delay: 240ms; }

/* ── Navigation ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--gutter);
  transition: background var(--duration-base) var(--ease-out),
              backdrop-filter var(--duration-base) var(--ease-out);
}

.nav.scrolled {
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: var(--space-8);
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-muted);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--duration-base) var(--ease-out);
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  width: 100%;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-inline: var(--gutter);
  padding-block: var(--space-24);
  overflow: hidden;
}

/* Ambient blob */
.hero-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-blob {
  position: absolute;
  width: clamp(300px, 50vw, 700px);
  height: clamp(300px, 50vw, 700px);
  top: -15%;
  right: -10%;
  background: radial-gradient(
    ellipse at center,
    rgba(184, 112, 96, 0.1) 0%,
    rgba(184, 112, 96, 0.04) 45%,
    transparent 70%
  );
  border-radius: 50%;
  animation: blob-drift 18s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes blob-drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-30px, 40px) scale(1.04); }
  66%  { transform: translate(20px, -20px) scale(0.97); }
  100% { transform: translate(-10px, 30px) scale(1.02); }
}

/* Hero content */
.hero-content {
  position: relative;
  max-width: var(--max-width);
  width: 100%;
  margin-inline: auto;
}

@media (min-width: 768px) {
  .hero-content {
    max-width: 58%;
    margin-inline: 0;
    padding-left: 8vw;
  }
}

.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-subtle);
  margin-bottom: var(--space-6);
  transition-delay: 0ms !important;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: 0.05em;
}

.hero-name span {
  display: block;
}

.hero-name em {
  display: block;
  color: var(--color-accent);
}

.hero-tagline {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 300;
  line-height: 1.4;
  color: var(--color-muted);
  max-width: 26ch;
  margin-bottom: var(--space-16);
}

/* Hero photo */
.hero-photo-wrap {
  position: absolute;
  right: 8vw;
  top: 12svh;
  bottom: 0;
  width: clamp(300px, 42vw, 620px);
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--ease-out),
              transform 0.65s var(--ease-out);
  filter: drop-shadow(-12px 0px 40px rgba(28, 25, 23, 0.12));
}

.hero-photo-wrap.photo-entered {
  opacity: 1;
  transform: translateY(0);
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

@media (max-width: 767px) {
  .hero-photo-wrap { display: none; }
}

/* Scroll hint */
.hero-scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-subtle);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color var(--duration-fast) var(--ease-out);
}

.hero-scroll-hint:hover {
  color: var(--color-muted);
}

.scroll-line {
  display: block;
  width: 40px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: scroll-pulse 2.5s var(--ease-in-out) infinite;
}

@keyframes scroll-pulse {
  0%, 100% { transform: scaleX(1);   opacity: 0.5; }
  50%       { transform: scaleX(0.5); opacity: 1; }
}

/* ── About ──────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .about-grid {
    grid-template-columns: 120px 1fr;
    gap: var(--space-12);
    align-items: start;
  }
}

.about-label {
  padding-top: 0.35em; /* optical align with first text line */
}

.about-text {
  font-size: var(--text-lg);
  line-height: 1.75;
  color: var(--color-text);
  max-width: 58ch;
}

.about-text + .about-text {
  margin-top: var(--space-6);
  color: var(--color-muted);
}

/* ── Work ───────────────────────────────────────────────────────── */
.work {
  border-top: 1px solid var(--color-border);
}

.work-header {
  margin-bottom: var(--space-12);
}

.work-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Card shell */
.work-card {
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.work-card:first-child {
  border-top: 1px solid var(--color-border);
}

/* Shared edge-aligned padding — matches container at all widths */
:root {
  --work-pad: max(var(--gutter), calc((100vw - var(--max-width)) / 2 + var(--gutter)));
}

/* Collapsed header — the always-visible row */
.work-card-header {
  display: grid;
  grid-template-columns: 3rem 1fr auto auto;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  padding: var(--space-8) var(--work-pad);
  background: none;
  border: none;
  cursor: none;
  text-align: left;
  color: var(--color-text);
  transition: background var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
}

.work-card-header:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Open state: terracotta header */
.work-card.is-open .work-card-header {
  background: var(--color-accent);
  color: #FAF9F6;
}

.work-card-num {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-subtle);
  transition: color var(--duration-base) var(--ease-out);
}

.work-card.is-open .work-card-num {
  color: rgba(250, 249, 246, 0.35);
}

.work-card-type {
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-subtle);
  transition: color var(--duration-base) var(--ease-out);
}

.work-card.is-open .work-card-type {
  color: rgba(250, 249, 246, 0.45);
}

.work-card-title {
  grid-column: 3;
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.1;
  transition: color var(--duration-base) var(--ease-out);
}

/* Toggle icon — animated + to × */
.work-card-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
  position: relative;
}

.work-card-toggle::before,
.work-card-toggle::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--duration-base) var(--ease-out),
              opacity var(--duration-base) var(--ease-out);
}

.work-card-toggle::before {
  width: 10px;
  height: 1px;
}

.work-card-toggle::after {
  width: 1px;
  height: 10px;
}

.work-card.is-open .work-card-toggle {
  background: rgba(250, 249, 246, 0.2);
  border-color: rgba(250, 249, 246, 0.4);
  color: #FAF9F6;
  transform: rotate(45deg);
}

.work-card.is-open .work-card-type {
  color: rgba(250, 249, 246, 0.45);
}

/* Expandable body — CSS grid trick for smooth height */
.work-card-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 550ms var(--ease-out);
}

.work-card.is-open .work-card-body {
  grid-template-rows: 1fr;
}

.work-card-body-inner {
  overflow: hidden;
}

/* Panel content */
.work-card-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-10);
  align-items: end;
  background: var(--color-accent);
  color: #FAF9F6;
  padding: var(--space-12) var(--work-pad);
  padding-top: var(--space-8);
}

.work-card-text p {
  font-size: var(--text-base);
  line-height: 1.8;
  color: rgba(250, 249, 246, 0.75);
  max-width: 50ch;
  margin-bottom: var(--space-8);
}

/* Tags */
.work-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.work-card-tags li {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(250, 249, 246, 0.5);
  border: 1px solid rgba(250, 249, 246, 0.2);
  border-radius: 999px;
  padding: 0.25em 0.85em;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.work-card-tags li:hover {
  color: rgba(250, 249, 246, 0.95);
  border-color: rgba(250, 249, 246, 0.5);
}

/* Action column: big decorative number + link */
.work-card-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  min-width: 100px;
}

.work-card-big-num {
  font-family: var(--font-serif);
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  color: rgba(250, 249, 246, 0.1);
  letter-spacing: -0.04em;
  user-select: none;
}

.work-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 400;
  color: rgba(250, 249, 246, 0.75);
  border-bottom: 1px solid rgba(250, 249, 246, 0.3);
  padding-bottom: 2px;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.work-card-link:hover {
  color: #FAF9F6;
  border-color: rgba(250, 249, 246, 0.8);
}

.work-card-link span {
  transition: transform var(--duration-base) var(--ease-out);
  display: inline-block;
}

.work-card-link:hover span {
  transform: translateX(4px);
}

/* Stagger reveal */
.work-card:nth-child(1) { transition-delay: 0ms; }
.work-card:nth-child(2) { transition-delay: 60ms; }
.work-card:nth-child(3) { transition-delay: 120ms; }
.work-card:nth-child(4) { transition-delay: 180ms; }
.work-card:nth-child(5) { transition-delay: 240ms; }

@media (max-width: 600px) {
  .work-card-header {
    grid-template-columns: 2.5rem 1fr auto;
    gap: var(--space-4);
  }

  .work-card-type {
    display: none;
  }

  .work-card-title {
    grid-column: 2;
    font-size: var(--text-lg);
  }

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

  .work-card-action {
    flex-direction: row;
    align-items: center;
    min-width: unset;
  }

  .work-card-big-num {
    display: none;
  }
}

/* ── Contact ─────────────────────────────────────────────────────── */
.contact {
  border-top: 1px solid var(--color-border);
}

.contact-inner {
  max-width: 640px;
}

.contact-pre {
  margin-bottom: var(--space-4);
}

.contact-heading {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-8);
}

.contact-blurb {
  font-size: var(--text-base);
  color: var(--color-muted);
  max-width: 46ch;
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.contact-email {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 300;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-12);
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.contact-email:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.contact-links {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.contact-links a {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-muted);
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
}

.contact-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--duration-base) var(--ease-out);
}

.contact-links a:hover {
  color: var(--color-text);
}

.contact-links a:hover::after {
  width: 100%;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-8);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.footer span {
  font-size: var(--text-xs);
  color: var(--color-subtle);
  letter-spacing: 0.05em;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .nav-links {
    gap: var(--space-5);
  }
}

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

  .ambient-blob {
    animation: none;
  }

  .scroll-line {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
