/* ============================================================
   Maze Technologies · landing page
   Monochrome · editorial · cinematic.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg:        #0a0a0b;
  --bg-soft:   #101012;
  --fg:        #ecebe6;
  --fg-dim:    #8d8d88;

  /* Hairlines. Dark uses translucent white; light must use translucent ink. */
  --line:        #ffffff14;  /* section dividers   */
  --line-2:      #ffffff0a;  /* faint separators   */
  --line-strong: #ffffff14;  /* control outlines   */

  /* Theme-dependent surface behaviour */
  --grain-opacity: 0.04;
  --grain-blend:   normal;
  --maze-opacity:  0.06;
  --nav-mix:       72%;
  --nav-shadow:    none;

  /* Type rendering: light-on-dark blooms, so it is thinned. Light must not be. */
  --smoothing:      antialiased;
  --smoothing-moz:  grayscale;
  --display-weight: 300;

  --selection-bg: var(--fg);
  --selection-fg: var(--bg);
  --btn-hover-bg: transparent;

  --max:   1180px;
  --pad:   clamp(1.25rem, 5vw, 4rem);
  --serif: "Fraunces", Georgia, serif;
  --sans:  "Inter", system-ui, -apple-system, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, monospace;
  --ease:  cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Light theme -------------------------------------------
   Warm paper, not clinical white. Strictly monochrome.
   fg 15.7:1 and fg-dim 4.9:1 against the paper, both AA.        */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:        #f3f1ec;
  --bg-soft:   #eae7e0;
  --fg:        #191814;
  --fg-dim:    #6b6862;

  --line:        #0000001a;
  --line-2:      #0000000f;
  --line-strong: #00000033;

  --grain-opacity: 0.03;
  --grain-blend:   multiply;
  --maze-opacity:  0.11;   /* ink on paper does not bloom, so it needs more */
  --nav-mix:       88%;
  --nav-shadow:    0 1px 0 #0a0a0b0a, 0 10px 28px -20px #0a0a0b2e;

  --smoothing:      auto;
  --smoothing-moz:  auto;
  --display-weight: 350;   /* dark type on paper optically loses weight */

  --selection-bg: #15151a1f;
  --selection-fg: var(--fg);
  --btn-hover-bg: #0a0a0b0f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: var(--smoothing);
  -moz-osx-font-smoothing: var(--smoothing-moz);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .45s var(--ease), color .45s var(--ease);
}

::selection { background: var(--selection-bg); color: var(--selection-fg); }

a { color: inherit; text-decoration: none; }
em { font-style: italic; }

/* Suppress every transition for one frame while the theme flips,
   otherwise each element eases at its own duration and it smears. */
.theme-switching, .theme-switching *,
.theme-switching *::before, .theme-switching *::after {
  transition: none !important;
}

/* ---- Fine grain ------------------------------------------- */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  filter: saturate(0);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Shared bits ------------------------------------------ */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 1.4rem;
}

.section-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }

.section-title {
  font-family: var(--serif);
  font-weight: var(--display-weight);
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 15ch;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 0.95rem 1.6rem;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  transition: background .5s var(--ease), color .5s var(--ease),
              border-color .5s var(--ease), transform .5s var(--ease);
}
.btn--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--solid:hover { background: var(--btn-hover-bg); color: var(--fg); }
.btn--ghost:hover { border-color: var(--fg); }
.btn--lg { padding: 1.15rem 2rem; font-size: 0.9rem; }
.btn:active { transform: translateY(1px); }

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.35rem var(--pad);
  transition: padding .4s var(--ease), background .4s var(--ease),
              border-color .4s var(--ease), box-shadow .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  padding-top: 0.85rem; padding-bottom: 0.85rem;
  background: var(--bg); /* fallback where color-mix is unsupported */
  background: color-mix(in srgb, var(--bg) var(--nav-mix), transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-2);
  box-shadow: var(--nav-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav.scrolled { background: var(--bg); }
}

.brand { display: inline-flex; align-items: center; gap: 0.7rem; }
.brand__mark { display: block; width: 30px; height: 30px; color: var(--fg); }
.brand__mark svg { width: 100%; height: 100%; display: block; }
.brand__mark--sm { width: 24px; height: 24px; }
.brand__word {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 400;
  letter-spacing: 0.005em;
}
.brand__word-dim { color: var(--fg-dim); font-weight: 300; }
@media (max-width: 560px) {
  .brand__word-dim { display: none; }
  .nav { padding-left: 1.1rem; padding-right: 1.1rem; }
  .nav__cta { padding: 0.45rem 0.85rem; font-size: 0.72rem; }
}

.nav__links { display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 2.4rem); }
.nav__links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  transition: color .3s var(--ease);
}
.nav__links a:hover { color: var(--fg); }
.nav__cta {
  color: var(--fg) !important;
  border: 1px solid var(--line-strong);
  padding: 0.5rem 1rem; border-radius: 100px;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav__cta:hover { border-color: var(--fg); }
.nav__links a:not(.nav__cta) { display: none; }
@media (min-width: 720px) { .nav__links a:not(.nav__cta) { display: inline; } }

/* Theme switch: a half-filled circle, echoing the round logomark. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
  padding: 0; background: none; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 100px;
  color: var(--fg-dim);
  transition: color .3s var(--ease), border-color .3s var(--ease), transform .5s var(--ease);
}
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle:hover { color: var(--fg); border-color: var(--fg); }
:root[data-theme="light"] .theme-toggle { transform: rotate(180deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 8rem var(--pad) 4rem;
  max-width: var(--max); margin: 0 auto;
  z-index: 2;
}
.hero__maze {
  position: absolute;
  right: clamp(-8rem, -6vw, -2rem); top: 50%;
  transform: translateY(-50%);
  width: min(58vw, 620px); aspect-ratio: 1;
  color: var(--fg);
  opacity: var(--maze-opacity);
  pointer-events: none;
  z-index: -1;
  transition: opacity .45s var(--ease);
}
.hero__maze svg { width: 100%; height: 100%; }
.hero__maze .draw {
  stroke-dasharray: 1200; stroke-dashoffset: 1200;
  animation: draw 3.4s var(--ease) forwards 0.3s;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero__title {
  font-family: var(--serif);
  font-weight: var(--display-weight);
  font-size: clamp(2.9rem, 9vw, 6.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0.6rem 0 1.8rem;
}
.hero__title span { display: block; }
.hero__title em { color: var(--fg); font-style: italic; }
.hero__lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--fg-dim);
  max-width: 42ch;
  line-height: 1.55;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.6rem; }

.hero__scroll {
  position: absolute; bottom: 2.2rem; left: var(--pad);
  display: flex; align-items: center; gap: 0.8rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--fg-dim);
}
.hero__scroll-line {
  display: block; width: 46px; height: 1px; background: var(--fg-dim);
  transform-origin: left; animation: scrollLine 2.4s var(--ease) infinite;
}
@keyframes scrollLine {
  0%, 100% { transform: scaleX(0.35); opacity: 0.5; }
  50%      { transform: scaleX(1);    opacity: 1; }
}

/* ============================================================
   Story
   ============================================================ */
.story {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) var(--pad);
  position: relative; z-index: 2;
  border-top: 1px solid var(--line-2);
}
.story__lead {
  font-family: var(--serif);
  font-weight: var(--display-weight);
  font-size: clamp(1.5rem, 3.6vw, 2.5rem);
  line-height: 1.28;
  letter-spacing: -0.01em;
  max-width: 24ch;
  margin-bottom: 1.6rem;
}
.story__lead:last-of-type { color: var(--fg-dim); }
.story__accent { color: var(--fg); display: inline; }

/* ============================================================
   Services
   ============================================================ */
.services {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(4rem, 10vw, 7rem) var(--pad);
  position: relative; z-index: 2;
  border-top: 1px solid var(--line-2);
}
.service-list { list-style: none; }
.service {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.2rem, 4vw, 3.5rem);
  padding: clamp(1.8rem, 4vw, 2.6rem) 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
  transition: opacity .4s var(--ease);
}
.service:last-child { border-bottom: 1px solid var(--line); }
.service__no {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--fg-dim); letter-spacing: 0.1em; padding-top: 0.5rem;
}
.service__body h3 {
  font-family: var(--serif); font-weight: var(--display-weight);
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  letter-spacing: -0.015em; line-height: 1.1;
  margin-bottom: 0.7rem;
  transition: transform .5s var(--ease);
}
.service__body p { color: var(--fg-dim); max-width: 52ch; }
.service:hover .service__body h3 { transform: translateX(8px); }

/* ============================================================
   Approach
   ============================================================ */
.approach {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(4rem, 10vw, 7rem) var(--pad);
  position: relative; z-index: 2;
  border-top: 1px solid var(--line-2);
}
.steps {
  display: grid; grid-template-columns: 1fr; gap: 2.5rem;
}
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); gap: clamp(2rem, 4vw, 3.5rem); } }
.step { padding-top: 1.6rem; border-top: 1px solid var(--line); }
.step__no {
  font-family: var(--mono); font-size: 0.8rem; color: var(--fg-dim);
  letter-spacing: 0.1em; display: block; margin-bottom: 1.6rem;
}
.step h3 {
  font-family: var(--serif); font-weight: var(--display-weight);
  font-size: clamp(1.35rem, 2.6vw, 1.7rem); letter-spacing: -0.01em;
  margin-bottom: 0.7rem;
}
.step p { color: var(--fg-dim); font-size: 0.98rem; }

/* ============================================================
   CTA
   ============================================================ */
.cta {
  position: relative; z-index: 2;
  padding: clamp(6rem, 16vw, 12rem) var(--pad);
  text-align: center;
  border-top: 1px solid var(--line-2);
}
.cta__inner { max-width: 720px; margin: 0 auto; }
.cta__title {
  font-family: var(--serif); font-weight: var(--display-weight);
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  line-height: 1; letter-spacing: -0.03em;
  margin: 0.5rem 0 1.4rem;
}
.cta__lede { color: var(--fg-dim); font-size: 1.1rem; margin-bottom: 2.6rem; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  padding: 2.2rem var(--pad);
  border-top: 1px solid var(--line);
}
.footer__brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--serif); font-size: 1rem; color: var(--fg);
}
.footer__note { font-family: var(--mono); font-size: 0.72rem; color: var(--fg-dim); letter-spacing: 0.04em; }

/* ============================================================
   Reveal-on-scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero__maze .draw { stroke-dashoffset: 0; }
}
