/* ==========================================================================
   State Creative — style.css
   Calm, typographic, motion-first. Inspired by quiet studio sites.
   ========================================================================== */

:root {
  --paper: #f6f4f0;
  --ink: #141414;
  --muted: #77736c;
  --line: rgba(20, 20, 20, 0.14);
  --ray: #cfcfcf;

  --bg: var(--paper);
  --fg: var(--ink);

  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);   /* expo-out */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1440px;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: clamp(1.125rem, 1rem + 0.4vw, 1.375rem);
  --fs-lg: clamp(1.75rem, 1.2rem + 2.2vw, 3.25rem);
  --fs-xl: clamp(2.75rem, 1.4rem + 5.6vw, 7rem);
}

/* Dark state — contact section takes over the whole page colour */
body.is-dark {
  --bg: var(--ink);
  --fg: var(--paper);
  --muted: #9a958d;
  --line: rgba(246, 244, 240, 0.18);
  --ray: #4a4a4a;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  font-family: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.9s var(--ease-out), color 0.9s var(--ease-out);
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 300; }
ul { list-style: none; margin: 0; padding: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.label {
  display: inline-flex;
  gap: 0.75em;
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.9s var(--ease-out);
}

:focus-visible {
  outline: 1.5px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- Animated underline link ---------- */

.u {
  position: relative;
  display: inline-block;
}
.u::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.08em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.7s var(--ease-out);
}
.u:hover::after,
.u:focus-visible::after { transform: scaleX(1); transform-origin: left center; }

/* Underline that is visible by default and re-draws on hover */
.u--on::after { transform: scaleX(1); transform-origin: left center; }
.u--on:hover::after { animation: redraw 0.9s var(--ease-out); }
@keyframes redraw {
  0%   { transform: scaleX(1); transform-origin: right center; }
  45%  { transform: scaleX(0); transform-origin: right center; }
  46%  { transform: scaleX(0); transform-origin: left center; }
  100% { transform: scaleX(1); transform-origin: left center; }
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: transform 0.8s var(--ease-out);
}
.site-header.is-hidden { transform: translateY(-100%); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.brand-mark {
  width: 22px; height: 22px;
  transition: transform 0.9s var(--ease-out);
}
.brand:hover .brand-mark { transform: rotate(90deg); }

.nav ul { display: flex; gap: clamp(16px, 3vw, 40px); }
.nav a { font-size: var(--fs-sm); font-weight: 400; }

/* ---------- Hero ---------- */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 120px 0 56px;
}
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
}

.hero-title {
  font-size: var(--fs-xl);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-copy {
  margin-top: clamp(28px, 4vw, 48px);
  max-width: 30em;
  color: var(--muted);
  transition: color 0.9s var(--ease-out);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-top: clamp(28px, 4vw, 48px);
  font-size: var(--fs-sm);
  font-weight: 400;
}
.clock { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.clock::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3fae6a;
  box-shadow: 0 0 0 0 rgba(63, 174, 106, 0.5);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63, 174, 106, 0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(63, 174, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 174, 106, 0); }
}
.clock time { font-variant-numeric: tabular-nums; color: var(--fg); }

.hero-emblem {
  justify-self: center;
  width: 100%;
  max-width: 560px;
  will-change: transform;
}

/* Masked line reveal */
.line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.line > span { display: block; }

/* ---------- Emblem ---------- */

.emblem { display: block; width: 100%; height: auto; overflow: visible; color: var(--fg); }
.emblem .rays {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(var(--spin, 0deg));
}
.emblem .rays line { stroke: var(--ray); transition: stroke 0.9s var(--ease-out); }

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(14px, 2vw, 22px) 0;
  transition: border-color 0.9s var(--ease-out);
}
.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.marquee-track span {
  display: inline-flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
  padding-right: clamp(20px, 3vw, 40px);
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.marquee-track i {
  width: 0.28em; height: 0.28em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

/* ---------- Sections ---------- */

.section { padding: clamp(96px, 14vw, 200px) 0; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 24px;
  margin-bottom: clamp(40px, 6vw, 80px);
}
.section-title {
  font-size: var(--fs-lg);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

/* Services */
.services { border-top: 1px solid var(--line); }
.service {
  position: relative;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.service-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 56px minmax(0, 1.3fr) minmax(0, 1fr) 40px;
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 3.4vw, 44px) 0;
  transition: color 0.6s var(--ease-out), padding 0.8s var(--ease-out);
}
.service-num {
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color 0.6s var(--ease-out);
}
.service h3 {
  font-size: var(--fs-lg);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.service p {
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 28em;
  transition: color 0.6s var(--ease-out);
}
.service-arrow {
  justify-self: end;
  width: 22px; height: 22px;
  opacity: 0;
  transform: translateX(-12px) rotate(-45deg);
  transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out);
}
.service::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fg);
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 0.7s var(--ease-out);
}

@media (hover: hover) {
  .service:hover::before { transform: scaleY(1); transform-origin: top center; }
  .service:hover .service-row { color: var(--bg); padding-left: 24px; padding-right: 24px; }
  .service:hover .service-num,
  .service:hover p { color: var(--bg); }
  .service:hover .service-arrow { opacity: 1; transform: none; }
}

/* About / statement */
.statement {
  font-size: var(--fs-lg);
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 22em;
}
.statement .w {
  opacity: 0.16;
  transition: opacity 0.6s var(--ease-out);
}
.statement .w.on { opacity: 1; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: clamp(64px, 9vw, 128px);
  border-top: 1px solid var(--line);
  transition: border-color 0.9s var(--ease-out);
}
.fact { padding-top: 24px; }
.fact strong {
  display: block;
  font-weight: 300;
  font-size: var(--fs-lg);
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.fact span { font-size: var(--fs-sm); color: var(--muted); }

/* Contact */
.contact { padding-bottom: 0; }
.contact-title {
  font-size: var(--fs-lg);
  letter-spacing: -0.025em;
  margin-bottom: clamp(16px, 2vw, 24px);
}
.contact-mail {
  font-size: clamp(2rem, 0.6rem + 6.4vw, 7.5rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  word-break: break-word;
}
.contact-mail::after { height: 2px; bottom: 0.02em; }

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(20px, 3vw, 48px);
  margin-top: clamp(48px, 6vw, 80px);
  font-size: var(--fs-sm);
  font-weight: 400;
}
.socials a { display: inline-flex; align-items: center; gap: 6px; }
.socials svg { width: 11px; height: 11px; transition: transform 0.6s var(--ease-out); }
.socials a:hover svg { transform: translate(2px, -2px); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(96px, 12vw, 160px);
  padding: 28px 0 32px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
  transition: border-color 0.9s var(--ease-out), color 0.9s var(--ease-out);
}
.to-top { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); }
.to-top svg { width: 11px; height: 11px; transition: transform 0.6s var(--ease-out); }
.to-top:hover svg { transform: translateY(-3px); }

/* ==========================================================================
   Motion — only when JS is running and motion is welcome
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {

  /* -- Hero entrance (waits for .is-ready on <html>) -- */
  .js .hero .line > span { transform: translateY(105%); }
  .js .hero-copy,
  .js .hero-meta { opacity: 0; transform: translateY(16px); }
  .js .site-header .wrap { opacity: 0; }

  .is-ready .hero .line > span {
    transform: none;
    transition: transform 1.5s var(--ease-out);
    transition-delay: calc(0.15s + var(--i, 0) * 0.09s);
  }
  .is-ready .hero-copy,
  .is-ready .hero-meta {
    opacity: 1; transform: none;
    transition: opacity 1.2s var(--ease-out), transform 1.4s var(--ease-out), color 0.9s var(--ease-out);
  }
  .is-ready .hero-copy { transition-delay: 0.55s; }
  .is-ready .hero-meta { transition-delay: 0.7s; }
  .is-ready .site-header .wrap { opacity: 1; transition: opacity 1.2s var(--ease-out) 0.9s; }

  /* -- Emblem draws itself -- */
  .js .emblem .d,
  .js .emblem .ray { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .js .emblem .solid { opacity: 0; }
  .js .emblem .glyph { opacity: 0; transform: translateY(14px); }

  .is-ready .emblem .d,
  .is-ready .emblem .ray { animation: draw 1.3s var(--ease-out) both; }
  .is-ready .emblem .part-x .d { animation-duration: 1.5s; animation-delay: 0.1s; animation-timing-function: var(--ease-in-out); }
  .is-ready .emblem .part-x .d + .d { animation-delay: 0.28s; }
  .is-ready .emblem .ray {
    animation-duration: 0.9s;
    animation-timing-function: var(--ease-out);
    animation-delay: calc(0.55s + var(--i) * 0.016s);
  }
  .is-ready .emblem .dot { animation-delay: 1.1s; }
  .is-ready .emblem .part-hat .d     { animation-delay: 0.8s; }
  .is-ready .emblem .part-bulb .d    { animation-delay: 0.95s; }
  .is-ready .emblem .part-laptop .d  { animation-delay: 1.1s; }
  .is-ready .emblem .part-glasses .d { animation-delay: 1.25s; }
  .is-ready .emblem .part-rules .d   { animation-delay: 1.9s; }
  .is-ready .emblem .solid { animation: fade 0.8s var(--ease-out) 1.5s forwards; }
  .is-ready .emblem .glyph {
    animation: rise 1.1s var(--ease-out) forwards;
    animation-delay: calc(0.85s + var(--i) * 0.05s);
  }
  .is-ready .emblem .g-bot { animation-delay: calc(1.15s + var(--i) * 0.03s); }

  /* -- Scroll reveals -- */
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 1.2s var(--ease-out), transform 1.4s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 0.08s);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  .js [data-reveal="lines"] { opacity: 1; transform: none; }
  .js [data-reveal="lines"] .line > span {
    transform: translateY(105%);
    transition: transform 1.4s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 0.08s);
  }
  .js [data-reveal="lines"].is-in .line > span { transform: none; }

  /* service rows: rule draws, then content rises */
  .js .service[data-reveal] { opacity: 1; transform: none; border-bottom-color: transparent; }
  .js .service[data-reveal]::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: var(--line);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.6s var(--ease-out), background-color 0.9s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 0.08s);
  }
  .js .service[data-reveal].is-in::after { transform: scaleX(1); }
  .js .service[data-reveal] .service-row > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out), color 0.6s var(--ease-out);
    transition-delay: calc(0.12s + var(--d, 0) * 0.08s);
  }
  .js .service[data-reveal].is-in .service-row > * { opacity: 1; transform: none; }
  .js .service[data-reveal].is-in .service-row > .service-arrow { opacity: 0; transform: translateX(-12px) rotate(-45deg); }
  @media (hover: hover) {
    .js .service[data-reveal].is-in:hover .service-row > * { transition-delay: 0s; }
    .js .service[data-reveal].is-in:hover .service-row > .service-arrow { opacity: 1; transform: none; }
  }
}

/* opacity hides round line-caps that would otherwise show as dots before drawing */
@keyframes draw {
  0%   { stroke-dashoffset: 1; opacity: 0; }
  1%   { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes fade { to { opacity: 1; } }
@keyframes rise { to { opacity: 1; transform: none; } }

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

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero { padding-top: 104px; align-items: flex-start; }
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-emblem { order: -1; max-width: min(78vw, 400px); }

  .section-head { grid-template-columns: 1fr; }

  .service-row { grid-template-columns: 40px minmax(0, 1fr); gap: 8px 16px; }
  .service p { grid-column: 2; }
  .service-arrow { display: none; }
}

@media (max-width: 600px) {
  .site-header .wrap { height: 64px; }
  .brand-text { display: none; }
  .nav ul { gap: 20px; }

  .facts { grid-template-columns: 1fr; gap: 0; border-top: 0; }
  .fact { border-top: 1px solid var(--line); padding: 20px 0; }
}
