/* ============================================================
   toprock labs — styles.css
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --color-dark:       #141414;
  --color-warm-white: #f5f2ee;
  --color-text-light: #ffffff;
  --color-text-dark:  #1a1a1a;
  --color-accent:     #c8b89a;
  --color-muted:      #9a9a8e;

  --ease-out-expo:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-slow:    900ms;
  --duration-medium:  600ms;
  --duration-fast:    300ms;

  --max-width: 1100px;
  --h-pad: 10vw;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-dark);
  color: var(--color-text-light);
  font-family: 'Neue Montreal', 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: calc(var(--max-width) + var(--h-pad) * 2);
  margin: 0 auto;
  padding: 0 var(--h-pad);
}

/* ── Typography ────────────────────────────────────────────── */
.serif {
  font-family: 'Instrument Serif', Georgia, serif;
}

/* ── Cursor Glow ───────────────────────────────────────────── */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(200, 184, 154, 0.15);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform var(--duration-fast) var(--ease-out-expo),
              width var(--duration-fast) var(--ease-out-expo),
              height var(--duration-fast) var(--ease-out-expo),
              opacity var(--duration-medium) var(--ease-in-out-soft);
  opacity: 0;
}

.cursor-glow.is-visible {
  opacity: 1;
}

.cursor-glow.is-hovering {
  width: 100px;
  height: 100px;
}

/* ── ============================================================
   SECTION 1 — HERO (dark)
   ============================================================ */

#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  background-color: var(--color-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Grain texture overlay */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem var(--h-pad);
  position: relative;
  z-index: 10;
}

.wordmark {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.nav-logo {
  height: 220px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-medium) var(--ease-out-expo);
}

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

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--color-text-light);
  transition: transform var(--duration-fast) var(--ease-out-expo),
              opacity var(--duration-fast) var(--ease-out-expo);
}

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

/* Hero Content */
.hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--h-pad);
  max-width: calc(var(--max-width) + var(--h-pad) * 2);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 3;
}

.hero-headline {
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-text-light);
  max-width: 16ch;
}

/* Word-by-word reveal */
.hero-headline .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
  white-space: nowrap;
}

.hero-headline .word.revealed {
  opacity: 1;
  transform: translateY(0);
}

.hero-sub {
  margin-top: 2rem;
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.hero-sub.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: var(--h-pad);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  animation: fade-in 1s var(--ease-out-expo) 2s forwards;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.8));
  animation: scroll-travel 2s var(--ease-in-out-soft) 2.5s infinite;
}

@keyframes scroll-travel {
  0%   { top: -60%; }
  100% { top: 140%; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* ── ============================================================
   SECTION 2 — TRANSITION ZONE
   ============================================================ */

#transition-zone {
  height: 30vh;
  background: linear-gradient(to bottom, var(--color-dark), var(--color-warm-white));
}

/* ── ============================================================
   SECTIONS 3 & 4 — LIGHT
   ============================================================ */

.section-light {
  background-color: var(--color-warm-white);
  color: var(--color-text-dark);
}

/* ── Section 3: Values ─────────────────────────────────────── */

#about {
  padding: 8rem 0 10rem;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4rem 3rem;
}

.value-item {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.value-number {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--color-accent);
}

.value-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-text-dark);
}

.value-body {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #4a4a40;
}

/* ── Section 4: Who We Build For ───────────────────────────── */

#clients {
  padding: 6rem 0 10rem;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
}

.who-content {
  max-width: 720px;
}

.who-headline {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-text-dark);
  margin-bottom: 2rem;
}

.who-body {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.75;
  color: #4a4a40;
  margin-bottom: 3rem;
}

.who-types {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  line-height: 2;
}

/* ── ============================================================
   SECTION 5 — PORTFOLIO
   ============================================================ */

.section-portfolio {
  padding: 8rem 0 10rem;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
}

.portfolio-header {
  margin-bottom: 5rem;
}

.portfolio-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 1rem;
  border-left: 2px solid var(--color-accent);
  padding-left: 0.75rem;
}

.portfolio-headline {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-text-dark);
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Project Card */
.project-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(26, 26, 26, 0.1);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 300ms var(--ease-out-expo),
              box-shadow 300ms var(--ease-out-expo);
  text-decoration: none;
  color: inherit;
  max-width: 900px;
}

.project-card:hover {
  transform: scale(1.015);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1);
}

.project-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.project-preview {
  background: linear-gradient(140deg, var(--brand-from), var(--brand-to));
  min-height: 360px;
  position: relative;
}

.project-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 13, 23, 0.12), rgba(8, 13, 23, 0.38)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.08), transparent 30%);
  z-index: 1;
  pointer-events: none;
}

.project-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform: scale(1.01);
  transition: transform 400ms var(--ease-out-expo),
              filter 400ms var(--ease-out-expo);
}

.project-arrow {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.45);
  z-index: 2;
  transition: transform 300ms var(--ease-out-expo),
              color 300ms var(--ease-out-expo);
}

.project-card:hover .project-arrow {
  transform: translate(3px, -3px);
  color: rgba(255, 255, 255, 0.9);
}

.project-card:hover .project-thumbnail-image {
  transform: scale(1.04);
  filter: saturate(1.05);
}

.project-info {
  background: #ffffff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

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

.project-tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  border: 1px solid rgba(154, 154, 142, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}

.project-name {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-text-dark);
  line-height: 1.15;
}

.project-desc {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1rem;
  line-height: 1.8;
  color: #4a4a40;
}

.project-url {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin-top: 0.25rem;
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.project-card:hover .project-url {
  color: var(--color-text-dark);
}

@media (max-width: 768px) {
  .project-card {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .project-preview {
    min-height: 220px;
  }

  .project-info {
    padding: 2rem;
  }
}

/* ── ============================================================
   SECTION 6 — CTA (dark return)
   ============================================================ */

.section-dark {
  background-color: var(--color-dark);
  color: var(--color-text-light);
}

#contact {
  padding: 10rem 0 12rem;
  position: relative;
  overflow: hidden;
}

/* Large watermark behind CTA — adds depth to the flat dark section */
#contact::before {
  content: 'tl';
  position: absolute;
  right: -0.05em;
  bottom: -0.25em;
  font-size: clamp(18rem, 30vw, 26rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.025);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.cta-content {
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  z-index: 1;
}

.cta-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--color-muted);
  border-left: 2px solid var(--color-accent);
  padding-left: 0.75rem;
}

.cta-headline {
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-text-light);
}

.cta-sub {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.cta-phone {
  display: inline-block;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-accent);
  transition: opacity var(--duration-fast) var(--ease-in-out-soft);
  position: relative;
}

.cta-phone::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-medium) var(--ease-out-expo);
}

.cta-phone:hover::after {
  transform: scaleX(1);
}

.cta-phone:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 6px;
  border-radius: 2px;
}

/* Phone digit characters */
.phone-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms var(--ease-out-expo),
              transform 200ms var(--ease-out-expo);
}

.phone-char.revealed {
  opacity: 1;
  transform: translateY(0);
}

.cta-email {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.02em;
  margin-top: 0.25rem;
}

.cta-email a {
  position: relative;
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.cta-email a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-medium) var(--ease-out-expo);
}

.cta-email a:hover {
  color: rgba(255, 255, 255, 0.6);
}

.cta-email a:hover::after {
  transform: scaleX(1);
}

/* ── ============================================================
   SECTION 6 — FOOTER
   ============================================================ */

footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.5rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-wordmark {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}

.footer-copy {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
}

.footer-email {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.footer-email:hover {
  color: rgba(255, 255, 255, 0.75);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
}

.footer-social a {
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.footer-social a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ── ============================================================
   NAV ENTRANCE
   ============================================================ */

.nav-enter {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 700ms var(--ease-out-expo),
              transform 700ms var(--ease-out-expo);
}

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

/* ── ============================================================
   SCROLL REVEAL
   ============================================================ */

[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms var(--ease-out-expo),
              transform 700ms var(--ease-out-expo);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children when parent has data-reveal-stagger */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms var(--ease-out-expo),
              transform 700ms var(--ease-out-expo);
}

[data-reveal-stagger].is-revealed > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal-stagger].is-revealed > *:nth-child(2) { transition-delay: 120ms; }
[data-reveal-stagger].is-revealed > *:nth-child(3) { transition-delay: 240ms; }

[data-reveal-stagger].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* ── ============================================================
   MOBILE NAV (full-screen overlay)
   ============================================================ */

.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--color-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-medium) var(--ease-in-out-soft);
}

.mobile-nav.is-open {
  opacity: 1;
  pointer-events: all;
}

.mobile-nav a {
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-text-light);
  transition: color var(--duration-fast) var(--ease-in-out-soft);
}

.mobile-nav a:hover {
  color: var(--color-accent);
}

/* ── ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --h-pad: 6vw;
  }

  /* Nav */
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Values: single column */
  .values-grid {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* CTA phone */
  .cta-phone {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  /* Reduce scroll reveal movement */
  [data-reveal] {
    transform: translateY(12px);
  }

  /* Cursor follower: hidden on touch */
  .cursor-glow {
    display: none;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .values-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-headline .word,
  .hero-sub,
  [data-reveal],
  [data-reveal-stagger] > *,
  .phone-char {
    opacity: 1 !important;
    transform: none !important;
  }
}
