/* ============================================================
   TRIATO × IFIT — Portfolio CSS
   Swiss minimal / luxury editorial
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #FAFAF8;
  --ink:         #111111;
  --muted:       #888888;
  --rule:        #E5E5E2;
  --accent:      #2563EB;   /* accent blue — use sparingly */
  --white:       #ffffff;

  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sans:   'Inter', system-ui, sans-serif;

  --ease:        cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);

  --header-h:    60px;
  --section-pad: clamp(80px, 10vw, 140px);
  --gutter:      clamp(24px, 5vw, 80px);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.65;
  overflow-x: hidden;
}

body.no-cursor,
body.no-cursor * {
  cursor: none !important;
}

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

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

/* ── Custom Cursor ─────────────────────────────────────────── */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
  will-change: transform;
}

.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(17, 17, 17, 0.35);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease), height 0.3s var(--ease),
              border-color 0.3s var(--ease), transform 0.08s linear;
  will-change: transform;
}

/* Cursor hover state — expanded ring on interactive elements */
body.cursor-hover .cursor-ring {
  width: 56px;
  height: 56px;
  border-color: rgba(17, 17, 17, 0.18);
}

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

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  z-index: 100;
  background: rgba(250, 250, 248, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.scrolled {
  border-bottom-color: var(--rule);
}

.header-logo {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.header-center {
  flex: 1;
}

.header-link {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.header-link:hover {
  color: var(--ink);
}

/* ── Section Utility ───────────────────────────────────────── */
.section {
  padding: var(--section-pad) var(--gutter);
  max-width: 1440px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: clamp(48px, 6vw, 80px);
}

.section-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.section-headline {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: clamp(32px, 4vw, 56px) 0;
}

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

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

/* Stagger siblings */
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal:nth-child(5) { transition-delay: 0.32s; }

/* ── HERO ──────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
}

.hero-inner {
  padding-top: calc(var(--header-h) + clamp(40px, 6vw, 80px));
  padding-bottom: clamp(40px, 5vw, 60px);
}

.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(24px, 3vw, 40px);
}

.hero-headline {
  font-family: var(--font-serif);
  font-size: clamp(64px, 9vw, 140px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 0;
}

.hero-headline em {
  font-style: italic;
  font-weight: 300;
}

.hero-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 5vw, 80px);
  align-items: start;
}

.hero-bio {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 300;
  line-height: 1.72;
  color: var(--ink);
  max-width: 460px;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
}

.stat {}

.stat-number {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}

.stat-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-bottom {
  position: absolute;
  bottom: clamp(24px, 3vw, 40px);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-location,
.hero-scroll {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── BIO CAROUSEL ──────────────────────────────────────────── */
.bio-section {
  border-top: 1px solid var(--rule);
}

.bio-carousel-wrap {
  overflow: hidden;
  width: 100%;
}

.bio-track {
  display: flex;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.bio-slide {
  min-width: 100%;
  padding-right: clamp(0px, 10vw, 200px);
  box-sizing: border-box;
}

.bio-num {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.bio-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 300;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 24px;
  line-height: 1.2;
}

.bio-body {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.5vw, 16px);
  font-weight: 300;
  line-height: 1.75;
  color: #444;
  max-width: 680px;
}

.bio-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 48px;
}

.bio-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 14px;
  color: var(--ink);
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.bio-btn:hover:not(:disabled) {
  border-color: var(--ink);
}

.bio-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.bio-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bio-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rule);
  border: none;
  cursor: none;
  transition: background 0.25s ease, transform 0.25s ease;
  padding: 0;
}

.bio-dot.active {
  background: var(--ink);
  transform: scale(1.4);
}

/* ── CLIENT LOGOS ──────────────────────────────────────────── */
.logos-section {
  padding: clamp(48px, 6vw, 80px) var(--gutter);
  border-top: 1px solid var(--rule);
  text-align: center;
}

.logos-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}

.logos-img {
  width: 100%;
  max-width: 860px;
  opacity: 0.6;
  filter: grayscale(100%);
  transition: opacity 0.4s ease;
  display: block;
  margin: 0 auto;
}

.logos-img:hover {
  opacity: 0.85;
}

/* ── THE MATCH ─────────────────────────────────────────────── */
.match-section {
  border-top: 1px solid var(--rule);
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.match-item {
  display: flex;
  gap: 24px;
  padding: clamp(32px, 4vw, 56px) 0;
  border-bottom: 1px solid var(--rule);
}

.match-item:nth-child(odd) {
  padding-right: clamp(32px, 4vw, 56px);
  border-right: 1px solid var(--rule);
}

.match-item:nth-child(even) {
  padding-left: clamp(32px, 4vw, 56px);
}

/* Remove bottom border from last two items */
.match-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.match-num {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-top: 2px;
  flex-shrink: 0;
  width: 24px;
}

.match-content {
  flex: 1;
}

.match-requirement {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}

.match-arrow {
  display: block;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1;
}

.match-answer {
  font-family: var(--font-sans);
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 300;
  line-height: 1.68;
  color: var(--ink);
}

/* ── WORK / PROJECT GRID ───────────────────────────────────── */
.work-section {
  border-top: 1px solid var(--rule);
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

/* Alternating heights for visual rhythm */
.project-card {
  position: relative;
  overflow: hidden;
  background: #e8e8e5;
  aspect-ratio: 4 / 3;
  cursor: none;
}

/* Make first card in each pair taller */
.project-card:nth-child(4n+1),
.project-card:nth-child(4n+2) {
  aspect-ratio: unset;
}

.project-card:nth-child(4n+1) {
  aspect-ratio: 3 / 4;
}

.project-card:nth-child(4n+2) {
  aspect-ratio: 4 / 3;
}

.project-card:nth-child(4n+3) {
  aspect-ratio: 4 / 3;
}

.project-card:nth-child(4n+4) {
  aspect-ratio: 3 / 4;
}

.project-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
  display: block;
}

.project-card:hover .project-card-img {
  transform: scale(1.04);
}

/* Overlay */
.project-card-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: clamp(20px, 2.5vw, 32px);
  background: linear-gradient(to top, rgba(10,10,10,0.82) 0%, transparent 100%);
  transform: translateY(100%);
  transition: transform 0.45s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card:hover .project-card-overlay {
  transform: translateY(0);
}

.overlay-name {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
}

.overlay-tag {
  display: inline-block;
  padding: 3px 10px;
  background: #ffffff;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #111111;
  align-self: flex-start;
}

/* Reveal animation for cards */
.project-card.reveal {
  transform: translateY(40px);
}

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg);
  width: 100%;
  max-height: 92vh;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  position: relative;
  transform: translateY(40px);
  transition: transform 0.5s var(--ease-out);
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: rgba(17,17,17,0.07);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  z-index: 10;
  color: var(--ink);
  transition: background 0.2s var(--ease);
}

.modal-close:hover {
  background: rgba(17,17,17,0.14);
}

.modal-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: 92vh;
  overflow: hidden;
}

.modal-image-col {
  position: relative;
  overflow: hidden;
  background: #e8e8e5;
  min-height: 400px;
}


.modal-detail-col {
  padding: clamp(32px, 4vw, 56px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-category {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.modal-role {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
}

.skill-pill {
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.modal-headline {
  font-family: var(--font-serif);
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 300;
  font-style: italic;
  line-height: 1.35;
  color: var(--ink);
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

.modal-body {
  font-family: var(--font-sans);
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 300;
  line-height: 1.72;
  color: var(--ink);
}

.modal-ifit-block {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-ifit-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.modal-ifit-text {
  font-family: var(--font-sans);
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 300;
  line-height: 1.72;
  color: var(--ink);
}

/* ── Carousel ──────────────────────────────────────────────── */
.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f0f0ee;
}

.carousel-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.85);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a1a;
  transition: background 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}

.carousel:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(255,255,255,1); }

.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

.carousel-btn:disabled { opacity: 0 !important; pointer-events: none; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  background: #fff;
}

.carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ccc;
  border: none;
  cursor: none;
  padding: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dot.active {
  background: #111;
  transform: scale(1.3);
}

.carousel-dots:empty,
.carousel-dots.hide { display: none; }

/* ── CTA ───────────────────────────────────────────────────── */
.cta-section {
  border-top: 1px solid var(--rule);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-bottom: clamp(40px, 5vw, 80px);
  width: 100%;
}

.cta-eyebrow {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.cta-headline {
  font-family: var(--font-serif);
  font-size: clamp(48px, 7vw, 100px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.cta-headline em {
  font-style: italic;
}

.cta-body {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 300;
  line-height: 1.65;
  color: var(--muted);
  max-width: 460px;
}

.cta-button {
  display: inline-block;
  padding: 14px 36px;
  border: 1px solid var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
  margin-top: 8px;
}

.cta-button:hover {
  background: var(--ink);
  color: var(--white);
}

.cta-links {
  display: flex;
  gap: 32px;
  margin-top: -8px;
}

.cta-links a {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.cta-links a:hover {
  color: var(--ink);
}

.footer-line {
  margin-top: auto;
  padding-top: clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--rule);
  width: 100%;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding-bottom: 32px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Cursor hidden on touch */
  .cursor-dot,
  .cursor-ring {
    display: none;
  }

  /* Hero */
  .hero-body {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero-bio {
    max-width: 100%;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* Match */
  .match-grid {
    grid-template-columns: 1fr;
  }

  .match-item:nth-child(odd) {
    padding-right: 0;
    border-right: none;
  }

  .match-item:nth-child(even) {
    padding-left: 0;
  }

  /* Remove "no border" from last two on desktop; add it for last one on mobile */
  .match-item:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--rule);
  }

  .match-item:last-child {
    border-bottom: none;
  }

  /* Work grid — 1 col on mobile */
  .project-grid {
    grid-template-columns: 1fr;
  }

  /* Reset all aspect ratios to 4/3 on mobile */
  .project-card,
  .project-card:nth-child(4n+1),
  .project-card:nth-child(4n+2),
  .project-card:nth-child(4n+3),
  .project-card:nth-child(4n+4) {
    aspect-ratio: 4 / 3;
  }

  /* Always show overlay on mobile */
  .project-card-overlay {
    transform: translateY(0);
  }

  /* Modal — stacked on mobile */
  .modal-inner {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow-y: auto;
  }

  .modal-image-col {
    min-height: 240px;
    max-height: 300px;
  }

  .modal-detail-col {
    overflow-y: unset;
  }

  /* Section headline */
  .section-headline {
    font-size: clamp(28px, 8vw, 40px);
  }

  .br-desktop {
    display: none;
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: 20px;
    --section-pad: 60px;
  }

  .hero-stats {
    gap: 16px 24px;
  }

  .cta-links {
    gap: 20px;
  }
}
