/* Congruence — quiet luxury BPO site
   Type: Cormorant Garamond (display) + Geist (body) + Geist Mono (labels)
   Lead: deep charcoal #2F3E46 on cream #F8F9FA, sage + terracotta as quiet accents
*/

:root {
  --ink: #2F3E46;
  --ink-soft: #4a5a62;
  --cream: #F8F9FA;
  --cream-warm: #f1ede5;
  --paper: #ECEAE3;
  --sage: #84A98C;
  --sage-deep: #6b8d73;
  --terra: #D4A373;
  --terra-deep: #b8845a;
  --line: rgba(47, 62, 70, 0.14);
  --line-strong: rgba(47, 62, 70, 0.28);

  --serif: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --max: 1320px;
  --gutter: 40px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
img, video, canvas { height: auto; }

@media (max-width: 1024px) { :root { --gutter: 32px; } }
@media (max-width: 720px)  { :root { --gutter: 22px; } }
@media (max-width: 420px)  { :root { --gutter: 18px; } }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}
.eyebrow .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--sage);
  margin-right: 10px;
  vertical-align: middle;
  transform: translateY(-1px);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(56px, 7.6vw, 132px);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
}
.h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 4.4vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.lede {
  font-family: var(--sans);
  font-size: clamp(17px, 1.3vw, 20px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 56ch;
  font-weight: 400;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(248, 249, 250, 0.78);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px; height: 28px;
  position: relative;
}
.nav-links {
  display: flex; gap: 36px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
}
.nav-links a {
  position: relative;
  padding: 6px 0;
  transition: color .2s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--ink);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s cubic-bezier(.2,.7,.2,1);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink); color: var(--cream);
}
.btn-primary:hover {
  background: #1f2c33;
  transform: translateY(-1px);
}
.btn-primary .arr { transition: transform .25s; }
.btn-primary:hover .arr { transform: translate(3px, -3px); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- Sections ---------- */
section { padding: 120px 0; position: relative; }
section.tight { padding: 90px 0; }

.section-head {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 80px;
  align-items: end;
  margin-bottom: 64px;
}
.section-head .meta { padding-top: 4px; }
@media (max-width: 860px) {
  .section-head { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}
.reveal.d1 { transition-delay: .08s; }
.reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; }
.reveal.d4 { transition-delay: .32s; }

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  color: var(--cream);
  padding: 100px 0 40px;
}
.footer .h2 { color: var(--cream); }
.footer .lede { color: rgba(248,249,250,0.66); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 60px;
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid rgba(248,249,250,0.14);
}
.footer-col h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(248,249,250,0.5);
  margin: 0 0 18px;
}
.footer-col a, .footer-col p {
  display: block;
  font-size: 14px;
  color: rgba(248,249,250,0.82);
  margin: 0 0 10px;
  transition: color .2s;
}
.footer-col a:hover { color: var(--terra); }
.footer-bottom {
  margin-top: 80px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(248,249,250,0.4);
  text-transform: uppercase;
}
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Marquee for industries ---------- */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
}
.marquee-track {
  display: flex;
  gap: 80px;
  white-space: nowrap;
  animation: scroll 50s linear infinite;
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--ink-soft);
}
.marquee-track span { display: inline-flex; align-items: center; gap: 80px; }
.marquee-track .star {
  color: var(--terra);
  font-style: normal;
}
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Utility ---------- */
.divider {
  height: 1px; background: var(--line); width: 100%;
}
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
}

/* =========================================================================
   RESPONSIVE — mobile + tablet adjustments.
   The prototype uses many inline `style={{ gridTemplateColumns: ... }}`
   declarations. Inline styles win specificity so we reach them via attribute
   selectors with !important inside @media. Class-based rules do not need
   !important.
   ========================================================================= */

/* ---------- Tablet & smaller: shrink section rhythm ---------- */
@media (max-width: 1024px) {
  section { padding: 96px 0; }
  section.tight { padding: 72px 0; }
  .footer { padding: 80px 0 32px; }
  .footer-grid { gap: 40px; margin-top: 56px; }
  .footer-bottom { margin-top: 56px; }
  .marquee-track { gap: 56px; font-size: 24px; }
  .marquee-track span { gap: 56px; }
}

/* ---------- Tablet portrait & smaller ---------- */
@media (max-width: 768px) {
  section { padding: 72px 0; }
  section.tight { padding: 56px 0; }
  .section-head { margin-bottom: 40px; }
  .nav-inner { height: 64px; }
  .nav-links { gap: 22px; font-size: 13px; }
  .brand { font-size: 19px; gap: 10px; }
  .footer { padding: 64px 0 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
  .marquee { padding: 20px 0; }
  .marquee-track { gap: 40px; font-size: 20px; }
  .marquee-track span { gap: 40px; }
  .btn { padding: 12px 18px; font-size: 13px; }
}

/* ---------- Phone landscape & smaller: collapse nav links ---------- */
@media (max-width: 640px) {
  section { padding: 60px 0; }
  .nav-links { display: none; }
  .nav-inner { height: 60px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  h1, h2, h3 { letter-spacing: -0.005em; }
  .display { font-size: clamp(40px, 11vw, 72px); line-height: 0.98; }
  .h2 { font-size: clamp(28px, 7vw, 44px); }
  .lede { font-size: 16px; }
}

/* ---------- Phone portrait ---------- */
@media (max-width: 420px) {
  section { padding: 52px 0; }
  .nav-inner { height: 56px; }
  .brand { font-size: 18px; }
  .brand-mark, .brand svg { width: 24px; height: 24px; }
  .marquee-track { font-size: 18px; gap: 32px; }
  .marquee-track span { gap: 32px; }
}

/* ---------- Inline grid layouts → single column on mobile ---------------
   Targets the inline `gridTemplateColumns` patterns React renders. We must
   use !important because inline styles win specificity wars otherwise.
   Patterns covered:
     "1fr 1fr"               (footer top, manifesto stats grid w/ 1fr 1fr 1fr,
                              category cards, contact form 2-col rows)
     "1fr 1fr 1fr"           (industries tiers, manifesto stats, services bullets)
     "repeat(2|3, 1fr)"      (services hub Why panel, etc.)
     "280px 1fr"             (manifesto split)
     "minmax(280px, 360px) 1fr"  (services tabs / detail)
     "1fr 1.2fr"             (contact page: copy / form)
     "120px 1fr"             (contact rows)
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 260px 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns: 320px 1fr"],
  [style*="grid-template-columns: minmax(280px"],
  [style*="grid-template-columns: minmax(280px, 360px)"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

/* Contact page label/value rows: stack at small sizes */
@media (max-width: 520px) {
  [style*="grid-template-columns: 120px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
}

/* ---------- Reduce oversized gaps/paddings on inline-styled containers --- */
@media (max-width: 1024px) {
  /* Section heads, big two-column splits */
  [style*="gap: 100px"],
  [style*="gap:100px"]  { gap: 56px !important; }
  [style*="gap: 80px"],
  [style*="gap:80px"]   { gap: 40px !important; }
  [style*="gap: 60px"],
  [style*="gap:60px"]   { gap: 32px !important; }

  /* Card / panel padding */
  [style*="padding: 72px 56px"] { padding: 48px 36px !important; }
  [style*="padding: 48px 36px"] { padding: 36px 28px !important; }
  [style*="padding: 48px"] { padding: 36px !important; }
  [style*="padding: \"40px 0\""],
  [style*="padding: 40px 0"] { padding: 32px 0 !important; }
}

@media (max-width: 768px) {
  [style*="gap: 100px"], [style*="gap:100px"] { gap: 32px !important; }
  [style*="gap: 80px"],  [style*="gap:80px"]  { gap: 28px !important; }
  [style*="gap: 60px"],  [style*="gap:60px"]  { gap: 24px !important; }
  [style*="gap: 48px"],  [style*="gap:48px"]  { gap: 24px !important; }

  [style*="padding: 72px 56px"] { padding: 32px 22px !important; }
  [style*="padding: 48px 36px"] { padding: 28px 22px !important; }
  [style*="padding: 48px"] { padding: 24px !important; }

  /* The hero band has paddingTop/paddingBottom: 120px inline */
  [style*="padding-top: 120px"] { padding-top: 64px !important; }
  [style*="padding-bottom: 120px"] { padding-bottom: 64px !important; }
  [style*="padding-top: 140px"] { padding-top: 64px !important; }
  [style*="padding-bottom: 140px"] { padding-bottom: 64px !important; }
  [style*="margin-top: 100px"] { margin-top: 48px !important; }
  [style*="margin-top: 80px"]  { margin-top: 40px !important; }
  [style*="margin-top: 60px"]  { margin-top: 32px !important; }
}

/* ---------- Hero meta strip: wrap and shrink dividers ----------------- */
@media (max-width: 768px) {
  /* The hero meta row has display:flex, gap:40 inline. Allow it to wrap and
     reduce the gap so the four mono-cap chunks don't push past the screen. */
  section [class*="reveal d4"][style*="display: flex"][style*="gap: 40"] {
    flex-wrap: wrap !important;
    gap: 12px 18px !important;
    margin-top: 48px !important;
  }
  /* The "—" separators clutter wrapped lines. Hide on small screens. */
  section [class*="reveal d4"][style*="display: flex"] > span[style*="opacity: 0.4"] {
    display: none !important;
  }
}

/* ---------- Service tabs: scale the active label down on mobile -------- */
@media (max-width: 768px) {
  /* Inactive tabs use fontSize: 28; active uses fontSize: 36. Override both. */
  button[style*="font-size: 36px"][style*="font-family: var(--serif)"] { font-size: 26px !important; }
  button[style*="font-size: 28px"][style*="font-family: var(--serif)"] { font-size: 22px !important; }
}

/* ---------- Tier callouts / why-cards: relax min-height on mobile ----- */
@media (max-width: 768px) {
  [style*="min-height: 280px"] { min-height: 0 !important; }
  [style*="min-height: 260px"] { min-height: 0 !important; }
  [style*="min-height: 480px"] { min-height: 0 !important; }
  [style*="min-height: 600px"] { min-height: 0 !important; }
  [style*="min-height: 420px"] { min-height: 0 !important; }
}

/* ---------- Contact form internals -------------------------------------- */
@media (max-width: 720px) {
  /* Card padding for the form */
  .reveal[style*="padding: 48px"][style*="border-radius: 4px"] {
    padding: 28px 22px !important;
  }
  /* Two-column "name + company" inside the form */
  form [style*="grid-template-columns: 1fr 1fr"][style*="gap: 24px"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
}

/* ---------- Service detail panel: bullets list 3-up → 1-up ------------- */
@media (max-width: 640px) {
  ul[style*="grid-template-columns: 1fr 1fr 1fr"][style*="margin: 40px 0 0"],
  ul[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* ---------- Big decorative numerals/roman: scale down on mobile -------- */
@media (max-width: 768px) {
  /* PracticeBlock has a 320px tall roman numeral background mark */
  [style*="font-size: 320px"] { font-size: 180px !important; right: -10px !important; top: -20px !important; }
  /* ServicePanel tag (01/02/...) */
  [style*="font-size: 80px"][style*="font-family: var(--serif)"] { font-size: 56px !important; }
}
@media (max-width: 480px) {
  [style*="font-size: 320px"] { font-size: 140px !important; }
}

/* ---------- Decorative orbs that float off-canvas: keep them inside ---- */
@media (max-width: 768px) {
  /* services.html: the right-side decorative orbs are sized 220 / 70 px and
     positioned at right: -120 / right: 80. They overflow on phones, but
     body has overflow-x: hidden so they're already clipped. We just scale
     them down so their visible portion isn't dominating the hero. */
  [style*="right: -120px"][style*="top: 120px"] { transform: scale(0.55) !important; transform-origin: top right !important; }
  [style*="right: 80px"][style*="top: 360px"]   { transform: scale(0.55) !important; transform-origin: top right !important; }
  /* contact.html decorative orbs at left -100 / left 80 */
  [style*="left: -100px"][style*="top: 100px"] { transform: scale(0.55) !important; transform-origin: top left !important; }
  [style*="left: 80px"][style*="top: 320px"]   { transform: scale(0.55) !important; transform-origin: top left !important; }
}

/* ---------- ClosingCTA giant ring SVG: rein it in ----------------------- */
@media (max-width: 768px) {
  svg[width="800"][height="800"][style*="right: -200px"] {
    width: 480px !important; height: 480px !important;
    right: -160px !important; top: -160px !important;
  }
}

/* ---------- Form labels / fields: keep tap targets reasonable ---------- */
@media (max-width: 640px) {
  input, textarea, select, button { font-size: 16px; } /* prevents iOS zoom-on-focus */
  input[type="range"] { width: 100% !important; }
}

/* ---------- Hero 3D stage: hide on mobile -------------------------------
   The hero's primary orb (420px) anchored at right 78% of the viewport
   ends up directly behind the headline once the viewport narrows past
   ~800px. Since the orb shares the headline's dark color, the words
   become unreadable. The 3D stage is purely decorative — hiding it on
   small screens leaves a clean typographic hero. The "92vh" min-height
   substring uniquely identifies the hero section among all sections.
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
  section[style*="92vh"] > div[style*="position: absolute"][style*="overflow: hidden"] {
    display: none !important;
  }
  /* Also reduce the hero section's min-height since the giant 820px floor
     is sized for desktop with the orb visual. */
  section[style*="92vh"] {
    min-height: 0 !important;
  }
}

/* Extra safety: a soft cream halo behind display headlines so any future
   decoration that ends up behind text won't render it unreadable. */
@media (max-width: 768px) {
  h1.display {
    text-shadow: 0 0 24px var(--cream), 0 0 48px var(--cream);
  }
}

/* ---------- Reduced motion: respect the OS preference -----------------
   Stops the marquee scroll, removes the reveal transition (content shows
   immediately instead of sliding/fading in), and shortens generic
   transitions. The hero orb animation is JS-driven, so hero3d.jsx also
   checks prefers-reduced-motion separately to halt the rAF loop.
   ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .marquee-track { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
