/* ============================================
   MONSOON LABS — Editorial Minimal Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,200;0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,300&family=JetBrains+Mono:wght@300;400;500&display=swap');

:root {
  --bg: #f4f1ec;
  --bg-deep: #ebe6dd;
  --ink: #141414;
  --ink-soft: #5a5a5a;
  --ink-faint: #a8a39c;
  --rule: #d9d4cc;
  --accent: #1e3a8a;
  --accent-soft: #c9d4e8;

  --serif: 'Fraunces', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;

  --max: 1320px;
  --gutter: clamp(1.5rem, 4vw, 4rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 1;
  background-image: radial-gradient(circle at 1px 1px, var(--ink) 1px, transparent 0);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============ TYPOGRAPHY ============ */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.eyebrow .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.6rem;
  vertical-align: middle;
  transform: translateY(-1px);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.02;
}

h1 {
  font-size: clamp(3rem, 8vw, 7.5rem);
  font-variation-settings: 'opsz' 144;
}

h2 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-variation-settings: 'opsz' 96;
}

h3 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.15;
  font-weight: 400;
}

.italic { font-style: italic; font-weight: 300; }

p { color: var(--ink-soft); }
p.lead {
  font-size: clamp(1.1rem, 1.4vw, 1.35rem);
  line-height: 1.55;
  color: var(--ink);
  font-weight: 300;
}

/* ============ NAVIGATION ============ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.5rem var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(244, 241, 236, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), padding 0.4s var(--ease);
}

nav.scrolled {
  border-bottom-color: var(--rule);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.brand-full {
  display: flex;
  align-items: center;
  height: 37px;
}

.brand-full img {
  height: 100%;
  width: auto;
  display: block;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-name em {
  font-style: italic;
  font-weight: 300;
  color: var(--ink-soft);
}

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

.nav-links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  position: relative;
  padding: 0.3rem 0;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--ink);
  transition: width 0.4s var(--ease);
}

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

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

.nav-links a.active {
  color: var(--ink);
}

.nav-cta {
  padding: 0.7rem 1.4rem !important;
  border: 1px solid var(--ink);
  border-radius: 100px;
  color: var(--ink) !important;
}

.nav-cta::after { display: none; }

.nav-cta:hover {
  background: var(--ink);
  color: var(--bg) !important;
}

.mobile-toggle {
  display: none;
  width: 28px;
  height: 18px;
  position: relative;
  flex-direction: column;
  justify-content: space-between;
  z-index: 110;
  padding: 4px 0;
}

.mobile-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.mobile-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.mobile-toggle.open span:nth-child(2) { opacity: 0; }
.mobile-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem var(--gutter) 2rem;
    gap: 2rem;

    /* Critical fix: hide completely when closed so it doesn't intercept clicks */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-20px);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0s 0.35s;
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0s;
  }

  .nav-links a {
    font-size: 1rem;
    padding: 0.5rem 0;
  }

  .nav-cta {
    margin-top: 1rem;
  }
}

/* ============ LAYOUT ============ */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  position: relative;
  z-index: 2;
}

/* ============ HERO ============ */
.hero {
  min-height: 100vh;
  padding: 9rem var(--gutter) 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  z-index: 2;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: end;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.hero-meta .meta-item {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero-meta .meta-item span {
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.3rem;
}

.hero h1 {
  margin-bottom: 2rem;
}

.hero-bottom {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}

@media (min-width: 768px) {
  .hero-bottom { grid-template-columns: 2fr 1fr; gap: 4rem; align-items: start; }
}

.hero-bottom .lead { max-width: 38ch; }

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 1rem 1.8rem;
  border-radius: 100px;
  border: 1px solid var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  transition: all 0.3s var(--ease);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-ghost { color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }

.btn .arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.btn:hover .arrow { transform: translateX(4px); }

/* ============ 3D CANVAS ============ */
.canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ============ GENERIC SECTIONS ============ */
.section-pad {
  padding: 8rem var(--gutter);
  max-width: var(--max);
  margin: 0 auto;
}

.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 5rem;
  align-items: end;
}

@media (min-width: 900px) {
  .section-head {
    grid-template-columns: auto 1fr;
    gap: 4rem;
  }
}

.section-head .eyebrow { padding-top: 0.5rem; }
.section-head h2 { max-width: 18ch; }

/* ============ FEATURE GRID ============ */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 768px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature {
  background: var(--bg);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 320px;
  transition: background 0.4s var(--ease);
}

.feature:hover { background: var(--bg-deep); }

.feature .num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.feature h3 { font-weight: 400; max-width: 14ch; }
.feature p { font-size: 0.95rem; }

/* Feature row variant (used on Why Us page) — heading on the left, copy on the right */
.feature-grid--single { grid-template-columns: 1fr !important; }

.feature.feature--row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
  min-height: auto;
}

.feature.feature--row h3 { max-width: none; }
.feature.feature--row p { font-size: 1rem; }

/* ============ PROCESS STEPS ============ */
.process-list {
  display: flex;
  flex-direction: column;
}

.process-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 2rem;
  padding: 3rem 0;
  border-top: 1px solid var(--rule);
  align-items: start;
  transition: padding 0.4s var(--ease);
}

@media (min-width: 900px) {
  .process-row {
    grid-template-columns: 80px 1fr 2fr 0.5fr;
    gap: 3rem;
    align-items: baseline;
  }
}

.process-row:last-child { border-bottom: 1px solid var(--rule); }

.process-row:hover { padding-left: 1rem; }

.process-row .num {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.process-row h3 {
  font-weight: 400;
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  font-style: italic;
  font-weight: 300;
}

.process-row p {
  font-size: 0.98rem;
  max-width: 50ch;
}

.process-row .duration {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
}

@media (max-width: 899px) {
  .process-row .duration { text-align: left; }
}

/* ============ FOOTER ============ */
footer {
  background: var(--ink);
  color: var(--bg);
  padding: 6rem var(--gutter) 2rem;
  margin-top: 4rem;
  position: relative;
  z-index: 2;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid rgba(244, 241, 236, 0.15);
}

@media (min-width: 768px) {
  .footer-top { grid-template-columns: 2fr 1fr 1fr; }
}

.footer-cta h2 {
  color: var(--bg);
  max-width: 14ch;
  margin-bottom: 1.5rem;
}

.footer-cta a.btn {
  border-color: var(--bg);
  color: var(--bg);
}

.footer-cta a.btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.footer-col a {
  color: var(--bg);
  font-size: 0.95rem;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
}
.footer-col a:hover { opacity: 1; color: var(--accent-soft); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom .small {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============ ANIMATIONS ============ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

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

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger.in > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.in > *:nth-child(3) { transition-delay: 0.2s; }
.reveal-stagger.in > *:nth-child(4) { transition-delay: 0.3s; }
.reveal-stagger.in > *:nth-child(5) { transition-delay: 0.4s; }
.reveal-stagger.in > *:nth-child(6) { transition-delay: 0.5s; }

@keyframes float-in {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.float-in { animation: float-in 1.2s var(--ease) both; }

/* ============ FORM ============ */
.form {
  display: grid;
  gap: 2rem;
  max-width: 640px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  transition: border-color 0.3s ease;
}

.field:focus-within { border-bottom-color: var(--ink); }

.field label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input, .field textarea, .field select {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 0.3rem 0;
  font-weight: 300;
}

.field textarea { resize: vertical; min-height: 100px; }

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23141414' stroke-width='1.5' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  padding-right: 2rem;
}

/* ============ CONTACT BLOCKS ============ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
}

@media (min-width: 900px) {
  .contact-grid { grid-template-columns: 1.4fr 1fr; gap: 6rem; }
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.contact-block h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.7rem;
  font-weight: 400;
}

.contact-block p, .contact-block a {
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 300;
  line-height: 1.5;
}

.contact-block a:hover { color: var(--accent); }

/* ============ NUMBER MARKS ============ */
.numbered {
  position: absolute;
  top: 6rem;
  right: var(--gutter);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  z-index: 3;
}

/* ============================================
   MOBILE REFINEMENTS — < 768px
   ============================================ */
@media (max-width: 768px) {
  /* Typography */
  h1 {
    font-size: clamp(2.4rem, 11vw, 3.6rem);
    line-height: 1.05;
  }
  h2 {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
    line-height: 1.05;
  }
  p.lead {
    font-size: 1rem;
    line-height: 1.55;
  }

  /* Nav: tighten and ensure logo doesn't crowd the edge */
  nav {
    padding: 1rem var(--gutter);
  }
  .brand-full {
    height: 32px;
  }

  /* Hero — give it more breathing room from nav, less from bottom */
  .hero {
    min-height: auto;
    padding: 7rem var(--gutter) 3rem;
  }

  /* Hero meta — stack each item, don't flex-wrap */
  .hero-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2.5rem;
  }
  .hero-meta .meta-item {
    width: 100%;
  }

  /* Hide the page-number indicator on mobile — it overlaps the meta row */
  .numbered { display: none; }

  /* Hero bottom — buttons and lead, remove the extra top padding */
  .hero-bottom {
    margin-top: 2rem;
    padding-top: 2rem;
    gap: 1.5rem;
  }
  .hero-bottom .lead { max-width: none; }

  .cta-row {
    margin-top: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .cta-row .btn {
    justify-content: center;
    width: 100%;
  }

  /* Section padding */
  .section-pad {
    padding: 4rem var(--gutter);
  }

  .section-head {
    margin-bottom: 2.5rem;
    gap: 1rem;
  }

  /* Feature grid — already stacks via grid-template-columns: 1fr default */
  .feature {
    padding: 2rem 1.5rem;
    min-height: auto;
    gap: 1rem;
  }

  /* Why Us "feature--row" blocks — stack cleanly on mobile */
  .feature.feature--row {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 2.5rem 1.5rem;
  }

  /* Process rows — fully stack on mobile, no awkward 60px column */
  .process-row {
    grid-template-columns: 1fr !important;
    padding: 2rem 0;
    gap: 0.5rem;
  }
  .process-row:hover { padding-left: 0; }
  .process-row h3 {
    font-size: 1.6rem;
    margin-top: 0.3rem;
  }
  .process-row .num {
    font-size: 0.75rem;
  }
  .process-row p {
    margin-top: 0.5rem;
  }
  .process-row .duration {
    text-align: left;
    margin-top: 0.5rem;
    color: var(--ink-faint);
  }

  /* Footer — tighten everything */
  footer {
    padding: 3.5rem var(--gutter) 2rem;
    margin-top: 2rem;
  }
  .footer-top {
    gap: 2rem;
    padding-bottom: 2.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  /* Form — keep inputs at 16px+ to prevent iOS auto-zoom on focus */
  .field input, .field textarea, .field select {
    font-size: 16px;
  }
  .form { gap: 1.5rem; }

  /* Contact info gaps */
  .contact-info { gap: 2rem; }

  /* Editorial quote section */
  section .reveal[style*="text-align: center"] {
    padding: 0;
  }
}

/* Extra-small screens — < 380px (older iPhones) */
@media (max-width: 380px) {
  :root {
    --gutter: 1.25rem;
  }
  h1 { font-size: 2.2rem; }
  .brand-full { height: 28px; }
}
