/* ============================================================
   Autoflow Solutions — styles
   Warm beige / near-black. Minimal, confident, restrained.
   ============================================================ */

:root {
  /* Palette */
  --bg:            #EAE2D3; /* warm beige */
  --bg-2:          #F0E9DE; /* slightly lighter beige for alternate sections */
  --ink:           #1A1815; /* near-black text + UI */
  --ink-soft:      #554F45; /* muted text — passes WCAG AA on --bg (~6:1) */
  --line:          rgba(26, 24, 21, 0.14);
  --line-strong:   rgba(26, 24, 21, 0.28);
  --accent:        #964325; /* warm terracotta — used sparingly; ~5.2:1 on --bg (WCAG AA) */

  /* Type */
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

  /* Layout */
  --wrap:  1120px;
  --pad:   clamp(1.25rem, 5vw, 3rem);
  --header-h: 72px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; }

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

/* ---------- Utilities ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-block: clamp(5rem, 12vw, 9rem);
  border-top: 1px solid var(--line);
}

.section__label {
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.section__label::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent);
  display: inline-block;
  flex: none;
}

.section__head { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section__title { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 3rem); }

/* Accessibility helpers */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-family: var(--font-head);
  font-size: 0.9rem;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

:where(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ============================================================
   Header / nav
   ============================================================ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease), backdrop-filter 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom-color: var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.wordmark__mark {
  width: 14px;
  height: 14px;
  background: var(--ink);
  box-shadow: 5px 5px 0 -1px var(--accent);
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a {
  text-decoration: none;
  position: relative;
  padding-block: 0.25rem;
}
.site-nav a:not(.site-nav__cta)::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.site-nav a:not(.site-nav__cta):hover::after { transform: scaleX(1); }
.site-nav__cta {
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 1.05rem;
  border-radius: 100px;
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.site-nav__cta:hover { background: var(--accent); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--header-h);
  overflow: hidden;
}

/* Scrim: fades the beige over the copy so the headline stays legible
   against the dark cluster. Horizontal on desktop (cluster sits right),
   vertical on narrow screens (cluster sits above the copy). */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    var(--bg) 30%,
    color-mix(in srgb, var(--bg) 70%, transparent) 52%,
    transparent 78%
  );
}
@media (max-width: 1199px) {
  /* Copy drops to the lower portion; the cluster gets the upper area to itself. */
  .hero { justify-content: flex-end; padding-bottom: clamp(6rem, 16vh, 9rem); }
  .hero::before {
    background: linear-gradient(
      0deg,
      var(--bg) 34%,
      color-mix(in srgb, var(--bg) 55%, transparent) 66%,
      transparent 92%
    );
  }
}

.hero__stage {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__canvas {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
.hero__stage.is-ready .hero__canvas { opacity: 1; }

/* Skeleton / fallback — centered cluster, gently pulsing until ready */
.hero__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 1;
  transition: opacity 0.8s var(--ease);
}
.hero__fallback svg { animation: skeleton-pulse 2.4s var(--ease) infinite; }
.hero__stage.is-ready .hero__fallback,
.hero__stage.is-fallback .hero__fallback svg { animation: none; }
.hero__stage.is-ready .hero__fallback { opacity: 0; pointer-events: none; }

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50%      { opacity: 0.85; transform: translateY(-6px); }
}

.hero__content {
  position: relative;
  z-index: 2;
  pointer-events: none; /* let mouse-parallax read through; links re-enabled below */
}
.hero__content a { pointer-events: auto; }
/* Left-aligned lead column; cluster takes the right on desktop. */
.hero__lead { max-width: 36rem; }

.hero__eyebrow {
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}
.hero__title {
  font-size: clamp(2.5rem, 1.5rem + 5.5vw, 5.25rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero__sub {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 32rem;
}

/* Interaction hint — only meaningful on precise-pointer (draggable) devices,
   and fades out once the visitor first touches the cube. */
.hero__hint {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .hero__hint { display: inline-flex; }
}
.hero__hint-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
  animation: hint-pulse 1.8s var(--ease) infinite;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1); }
}
body.hero-touched .hero__hint {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

/* Scroll cue */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.5rem, 4vh, 2.75rem);
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.scroll-cue__line {
  width: 1px;
  height: 44px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
}
.scroll-cue__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  animation: scroll-cue 2.2s var(--ease) infinite;
}
@keyframes scroll-cue {
  0%   { transform: translateY(-100%); }
  55%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ============================================================
   About
   ============================================================ */
.about { background: var(--bg-2); }
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 2fr);
  gap: clamp(1.5rem, 4vw, 4rem);
}
.about__title {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.5rem);
  margin-bottom: 1.75rem;
  max-width: 22ch;
}
.about__body p {
  color: var(--ink-soft);
  max-width: 58ch;
}
.about__body p + p { margin-top: 1.1rem; }

/* ============================================================
   Work
   ============================================================ */
.work__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.app-card {
  display: flex;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}
.app-card__icon { flex: none; }
.app-card__icon svg {
  border-radius: 21px;
  box-shadow: 0 10px 30px -12px rgba(26, 24, 21, 0.5);
}
.app-card__tag {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.app-card__name {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}
.app-card__desc {
  color: var(--ink-soft);
  font-size: 0.975rem;
  margin-bottom: 1.25rem;
}
.app-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink);
}
.app-card__arrow { transition: transform 0.25s var(--ease); }
.app-card__link:hover { color: var(--accent); }
.app-card__link:hover .app-card__arrow { transform: translate(2px, -2px); }

/* ============================================================
   Approach
   ============================================================ */
.approach__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem);
  counter-reset: step;
}
.approach-step { counter-increment: step; position: relative; }
.approach-step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
}
.approach-step__icon {
  display: block;
  margin: 0.75rem 0 1.1rem;
}
.approach-step__title {
  font-size: 1.25rem;
  margin-bottom: 0.55rem;
}
.approach-step__text {
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 32ch;
}

/* ============================================================
   Contact
   ============================================================ */
.contact { background: var(--bg-2); text-align: center; }
.contact__inner { max-width: 44rem; }
.contact .section__label { justify-content: center; }
.contact__title {
  font-size: clamp(2.25rem, 1.5rem + 4vw, 4rem);
  margin-bottom: 1.25rem;
}
.contact__lead {
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: 34ch;
  margin: 0 auto 2.5rem;
}
.contact__email {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 2vw, 2.25rem);
  text-decoration: none;
  letter-spacing: -0.01em;
  padding-bottom: 0.15em;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.35s var(--ease), color 0.35s var(--ease);
}
.contact__email:hover { background-size: 100% 2px; color: var(--accent); }
.contact__company {
  margin-top: 1.75rem;
  font-family: var(--font-head);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.site-footer__email { text-decoration: none; }
.site-footer__email:hover { color: var(--ink); }

/* ============================================================
   Scroll-reveal
   ============================================================ */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .about__grid { grid-template-columns: 1fr; }
  .app-card { flex-direction: column; }
  .app-card__icon svg { width: 72px; height: 72px; }
  .site-nav a:not(.site-nav__cta) { display: none; } /* keep nav minimal on mobile */
}

/* ============================================================
   Reduced motion — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hero__canvas { opacity: 1; transition: none; }
  .scroll-cue__line::after { display: none; }
}
