/* ─────────────────────────────────────────────────────────
   RetroLab Tech — shared stylesheet
   architg.me character × light & fast × Apple breathing room
   tokens · reset · primitives · components
   ───────────────────────────────────────────────────────── */
:root {
  /* light warm-tinted background, high-contrast text */
  --bg:           #fafaf7;     /* warm off-white — subtle, not stark */
  --bg-elev:      #ffffff;     /* lifted card / surface */
  --bg-sunk:      #f4f3ee;     /* subtle warmer recess */
  --rule:         #e6e4dd;     /* hairline rules — soft warm gray */
  --rule-soft:    #ededea;
  --ink:          #0a0a0a;
  --ink-2:        #2a2a2a;
  --ink-3:        #6e6e73;
  --ink-4:        #93908b;

  /* warm gradient accents */
  --amber:        #fbbf24;
  --yellow:       #f59e0b;
  --orange:       #ea580c;
  --orange-deep:  #c2410c;
  --accent:       #ea580c;
  --accent-soft:  #fff5e8;
  /* display gradient — used on text, big numbers, key words */
  --gradient:     linear-gradient(135deg, #fbbf24 0%, #f59e0b 45%, #ea580c 100%);
  /* button gradient — darker, no amber start, white text reads cleanly */
  --gradient-btn: linear-gradient(135deg, #f59e0b 0%, #ea580c 55%, #c2410c 100%);

  /* shadows — subtle architectural lift, not heavy halos */
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.05);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.06);
  --shadow-lg:    0 24px 48px -16px rgba(0,0,0,0.10);
  --shadow-card:  0 1px 3px rgba(0,0,0,0.04), 0 8px 32px -8px rgba(0,0,0,0.06);
  --shadow-btn:   0 2px 6px rgba(234, 88, 12, 0.25);
  --shadow-btn-hover: 0 8px 18px rgba(234, 88, 12, 0.32);

  --sans:   "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --mono:   "Geist Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --max:        1240px;
  --max-narrow: 1080px;
  --gutter:     clamp(20px, 4vw, 56px);
  --line:       1.5;

  /* sharp / minimal corners */
  --r-xs:       2px;
  --r-sm:       4px;
  --r-md:       8px;
  --r-pill:     999px;

  --t-fast:     180ms cubic-bezier(.4,.0,.2,1);
  --t-med:      320ms cubic-bezier(.4,.0,.2,1);
  --t-slow:     680ms cubic-bezier(.16,1,.3,1);
}

/* reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: var(--line);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }
::selection { background: var(--orange); color: var(--bg); }

.skip {
  position: fixed; top: -40px; left: 8px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 12px;
  font-family: var(--mono); font-size: 12px; border-radius: var(--r-sm);
}
.skip:focus { top: 8px; }

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

/* mono section label — architg.me's signature pattern */
.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  margin: 0 0 24px;
  display: inline-block;
}
.label::before {
  content: "./";
  color: var(--orange);
  margin-right: 2px;
}
.label.gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}
.label.gradient::before {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* nav — borderless, subtle backdrop blur */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 250, 247, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 14px;
  background: var(--gradient);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><rect x='4' y='0' width='4' height='4'/><rect x='8' y='0' width='4' height='4'/><rect x='0' y='4' width='4' height='4'/><rect x='4' y='4' width='4' height='4'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><rect x='4' y='0' width='4' height='4'/><rect x='8' y='0' width='4' height='4'/><rect x='0' y='4' width='4' height='4'/><rect x='4' y='4' width='4' height='4'/></svg>");
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  transition: filter var(--t-fast);
}
.brand:hover::after {
  filter: brightness(1.08) saturate(1.05);
}
.nav-links {
  display: flex; gap: 32px; align-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.005em;
}
.nav-links a {
  color: var(--ink-2);
  transition: color var(--t-fast);
}
.nav-links a:hover { color: var(--orange); }
.nav-links a[aria-current="page"] { color: var(--orange); font-weight: 500; }

/* Dropdown menu (used on "our work" nav item) */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}
/* Inert dropdown trigger (no href) — still looks like a nav link */
.nav-dropdown-trigger {
  cursor: pointer;
  user-select: none;
}
.nav-dropdown > a::after {
  content: " ▾";
  font-size: 9px;
  margin-left: 3px;
  opacity: 0.6;
  transition: transform 200ms ease;
  display: inline-block;
}
.nav-dropdown:hover > a::after,
.nav-dropdown:focus-within > a::after { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 8px;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--rule);
  border-radius: 0 8px 0 8px;
  padding: 6px;
  min-width: 220px;
  box-shadow: 0 16px 40px -12px rgba(22, 0, 53, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.16,1,.3,1), visibility 0s linear 220ms;
  z-index: 200;
}
/* Invisible hover-bridge above the menu so cursor doesn't lose the dropdown
   when crossing the 8px gap between trigger and menu. */
.nav-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.16,1,.3,1), visibility 0s linear 0s;
}
.nav-dropdown-menu a {
  display: block;
  padding: 9px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 0 4px 0 4px;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-dropdown-menu a:hover {
  background: rgba(234, 88, 12, 0.08);
  color: var(--orange);
}

/* Mega-menu variant — multi-column with category labels and item descriptions.
   Right-anchored so triggers near the right edge of the nav don't clip. */
.nav-dropdown-menu.is-mega {
  left: auto;
  right: 0;
  transform: translateY(-6px);
  min-width: 460px;
  padding: 18px 20px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
}
.nav-dropdown:hover .nav-dropdown-menu.is-mega,
.nav-dropdown:focus-within .nav-dropdown-menu.is-mega {
  transform: translateY(0);
}
/* Single-section variant: one full-width category label, items in a 2-col grid below.
   Used when one bucket (e.g. "case studies") has many items and per-column labels would feel forced. */
.nav-dropdown-menu.is-mega.is-mega-single {
  grid-template-columns: 1fr;
  min-width: 560px;
}
.is-mega-single .nav-mega-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  margin-top: 4px;
}
.nav-mega-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
}
.nav-dropdown-menu.is-mega a {
  display: block;
  padding: 8px 8px 10px;
  white-space: normal;
  border-radius: 0 4px 0 4px;
}
.nav-mega-title {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  letter-spacing: 0;
}
.nav-mega-desc {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-3);
}
.nav-dropdown-menu.is-mega a:hover {
  background: rgba(234, 88, 12, 0.06);
  color: inherit;
}
.nav-dropdown-menu.is-mega a:hover .nav-mega-title {
  color: var(--orange);
}

.nav-links .cta {
  color: var(--bg);
  background: var(--ink);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-weight: 500;
  font-size: 12.5px;
  transition: background var(--t-fast);
}
.nav-links .cta:hover { background: var(--orange); color: var(--ink); }
.nav-links .cta[aria-current="page"] { color: var(--bg) !important; background: var(--orange) !important; }
.nav-links .cta[aria-current="page"]:hover { background: var(--orange-deep) !important; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  /* Hide desktop horizontal nav; show hamburger button */
  .nav-links { display: none; }
  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-right: -8px; /* optical alignment with brand */
    background: transparent;
    color: var(--ink);
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 14px;
  }
  .menu-icon > span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transform-origin: center;
  }
  /* Closed: 3 horizontal lines */
  .menu-icon > span:nth-child(1) { top: 0; }
  .menu-icon > span:nth-child(2) { top: 6px; }
  .menu-icon > span:nth-child(3) { top: 12px; }
  /* Two-stage transitions:
     - Closing → opening: lines first slide to center (top), THEN rotate
     - Opening → closing: lines first rotate back, THEN slide apart
     This avoids the awkward "lines crossing through each other" look. */
  .menu-icon > span:nth-child(1),
  .menu-icon > span:nth-child(3) {
    transition: top 240ms cubic-bezier(.16,1,.3,1) 80ms,
                transform 240ms cubic-bezier(.16,1,.3,1);
  }
  .menu-icon > span:nth-child(2) {
    transition: opacity 140ms ease 60ms, transform 200ms ease;
  }
  /* Active state: morph to X */
  .menu-btn.is-active .menu-icon > span:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
    transition: top 240ms cubic-bezier(.16,1,.3,1),
                transform 240ms cubic-bezier(.16,1,.3,1) 80ms;
  }
  .menu-btn.is-active .menu-icon > span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 100ms ease, transform 200ms ease;
  }
  .menu-btn.is-active .menu-icon > span:nth-child(3) {
    top: 6px;
    transform: rotate(-45deg);
    transition: top 240ms cubic-bezier(.16,1,.3,1),
                transform 240ms cubic-bezier(.16,1,.3,1) 80ms;
  }
  /* Drawer state: opened via JS adding .is-open. Fullscreen flyout below the topbar. */
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: fixed;
    top: 64px; left: 0; right: 0;
    height: calc(100vh - 64px); /* explicit — flex-column auto-height collapses to content */
    background: var(--bg);
    padding: 24px var(--gutter) 48px;
    overflow-y: auto;
    overscroll-behavior: contain;
    font-size: 16px;
    z-index: 40;
    border-top: 1px solid var(--rule);
  }
  /* In drawer: each .nav-dropdown is a column so trigger sits above its inline-expanded menu */
  .nav-links.is-open .nav-dropdown {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-links.is-open > a:not(.cta),
  .nav-links.is-open > .nav-dropdown > a {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 16px;
    color: var(--ink);
  }
  /* Contact CTA inside drawer: proper centered pill, separated from list */
  .nav-links.is-open > a.cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin-top: 28px;
    padding: 12px 28px;
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--r-pill);
    font-family: var(--mono);
    font-size: 14px;
    letter-spacing: 0.005em;
    border: 0;
    transition: background var(--t-fast);
  }
  .nav-links.is-open > a.cta:hover { background: var(--orange); color: var(--ink); }
  .nav-links.is-open > a.cta[aria-current="page"] { background: var(--orange); color: var(--bg); }
  /* In drawer: dropdowns become inline, COLLAPSED by default — toggle via tap */
  .nav-links.is-open .nav-dropdown-menu,
  .nav-links.is-open .nav-dropdown-menu.is-mega {
    position: static !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: transparent;
    border: 0;
    box-shadow: none;
    margin: 0;
    grid-template-columns: 1fr;
    min-width: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Collapsed state */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 0 0 16px;
    transition: max-height 380ms cubic-bezier(.16,1,.3,1),
                opacity 200ms ease,
                padding 280ms ease;
  }
  /* Expanded state — parent .nav-dropdown.is-expanded reveals the panel */
  .nav-links.is-open .nav-dropdown.is-expanded > .nav-dropdown-menu,
  .nav-links.is-open .nav-dropdown.is-expanded > .nav-dropdown-menu.is-mega {
    max-height: 1400px;
    opacity: 1;
    padding: 4px 0 14px 16px;
    transition: max-height 480ms cubic-bezier(.16,1,.3,1),
                opacity 320ms ease 100ms,
                padding 280ms ease;
  }
  /* Chevron: visible, larger, rotates 180° when expanded */
  .nav-links.is-open .nav-dropdown > a::after {
    display: inline-block;
    content: " ▾";
    font-size: 11px;
    margin-left: 8px;
    opacity: 0.5;
    transition: transform 280ms cubic-bezier(.16,1,.3,1);
  }
  .nav-links.is-open .nav-dropdown.is-expanded > a::after { transform: rotate(180deg); }
  /* Mega-menu items inside expanded panel: stack with breathing room */
  .nav-links.is-open .nav-dropdown-menu.is-mega a { padding: 10px 0; white-space: normal; }
  .nav-links.is-open .nav-mega-label {
    font-size: 11px; opacity: 0.6; margin-top: 8px; padding: 0;
  }
  /* Lock body scroll when drawer is open */
  body.is-nav-open { overflow: hidden; }
}

/* buttons — clean, sharp, decisive */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-pill);
  letter-spacing: -0.005em;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn:hover {
  background: var(--bg);
  color: var(--ink);
  transform: translateY(-1px);
}
.btn .arrow { transition: transform var(--t-fast); display: inline-block; }
.btn:hover .arrow { transform: translateX(3px); }

.btn.gradient {
  background: var(--gradient-btn);
  border: 1px solid transparent;
  color: #ffffff;
  font-weight: 600;
  padding: 13px 24px;
  box-shadow: var(--shadow-btn);
}
.btn.gradient:hover {
  background: var(--gradient-btn);
  color: #ffffff;
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover);
}
.btn.gradient .arrow { color: #ffffff; }

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

.btn.text {
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 8px 0;
  border-radius: 0;
  font-weight: 500;
  font-size: 15px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn.text::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 1px;
  background: var(--ink);
  transition: background var(--t-fast);
}
.btn.text:hover {
  color: var(--orange);
  transform: none;
}
.btn.text:hover::after {
  background: var(--orange);
}

/* hairline section divider — architg.me-style horizontal rule */
.divider {
  height: 1px;
  background: var(--rule);
  margin: 0;
}
.divider.thicker { height: 1px; background: var(--ink); opacity: .12; }

/* footer — light, dense, mono-accented */
footer.foot {
  border-top: 1px solid var(--rule);
  padding: 64px 0 32px;
  background: var(--bg);
}
.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 48px;
}
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
.foot h4 {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; }
.foot ul a { color: var(--ink-2); transition: color var(--t-fast); }
.foot ul a:hover { color: var(--orange); }
.foot .brand-block { max-width: 32ch; }
.foot .brand-block .brand { font-size: 18px; }
.foot .brand-block p { color: var(--ink-3); font-size: 13px; line-height: 1.55; margin-top: 14px; }
.foot-base {
  margin-top: 56px;
  display: flex; justify-content: space-between; gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
  letter-spacing: 0.02em;
}
.foot-base a { color: var(--ink-3); transition: color var(--t-fast); }
.foot-base a:hover { color: var(--orange); }

/* FAQ block — accordion-style Q&A, used on common-questions.html */
.faq-section {
  margin-top: clamp(40px, 6vh, 64px);
  padding-top: clamp(32px, 4vh, 48px);
  border-top: 1px solid var(--rule);
}
.faq-section h3 {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
  font-weight: 500;
}
.faq-item {
  border-top: 1px solid var(--rule);
}
.faq-item:last-child { border-bottom: 1px solid var(--rule); }
.faq-item summary {
  list-style: none;
  padding: 20px 0;
  display: grid;
  grid-template-columns: 1fr 28px;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  transition: color var(--t-fast);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--orange); }
.faq-item .toggle {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink-3);
  text-align: right;
  transition: transform var(--t-med), color var(--t-fast);
}
.faq-item[open] .toggle {
  color: var(--orange);
  transform: rotate(45deg);
}
.faq-item .answer {
  padding: 0 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 70ch;
}
.faq-item .answer p { margin: 0 0 12px; }
.faq-item .answer p:last-child { margin-bottom: 0; }
.faq-item .answer b { color: var(--ink); font-weight: 600; }
.faq-item .answer ul { margin: 8px 0 12px 20px; padding: 0; }
.faq-item .answer li { margin-bottom: 6px; }

/* reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--t-slow), transform var(--t-slow); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
