/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5
 * macrostructure: Portfolio Grid · genre: atmospheric · tone: technical
 * hero: H1 Marquee · polish: HP3 Cursor-spotlight (extended into custom canvas grid+light engine)
 * enrichment: real screenshots (E8-style), tier: none custom-built (no invented imagery)
 * nav: N5 Floating pill · footer: Ft5 Statement
 * theme: custom (amber-anchor dark) · accent: warm amber ~63° · studied: no
 * contrast: pass (40–41) · nav: N5 · footer: Ft5 · slop: pass (42–45)
 * honest: pass (46) · chrome: pass (47) · tokens: pass (48) · responsive: pass (49)
 * mobile: pass (34, 49, 50–57)
 */

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

/* ---------- page-wide reactive field — the connective layer ---------- */

.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
}

/* ---------- intro — fast, skippable brand sting ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-paper);
}
.intro__count {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}
.intro.is-leaving {
  transition: transform 420ms var(--ease-in-out), opacity 420ms var(--ease-in-out);
  transform: translateY(-100%);
  opacity: 0;
}
.intro.is-done { display: none; }

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100%;
  background: var(--color-paper-2);
  color: var(--color-ink);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  z-index: var(--z-tooltip);
  transition: top var(--dur-short) var(--ease-out);
}
.skip-link:focus-visible {
  top: var(--space-md);
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: inherit;
}

/* ---------- nav — N5 floating pill ---------- */

.nav {
  position: sticky;
  top: var(--space-md);
  z-index: var(--z-sticky-nav);
  max-width: min(44rem, calc(100% - var(--space-lg)));
  margin: var(--space-md) auto 0;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-lg);
  border-radius: 999px;
  border: var(--rule-hair) solid var(--color-rule);
  background: color-mix(in oklch, var(--color-paper-2) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 1px 2px oklch(20% 0.01 63 / 0.2);
}

.nav__wordmark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--color-ink);
  white-space: nowrap;
}
.nav__wordmark:hover { color: var(--color-accent); }

.nav__links {
  display: flex;
  gap: var(--space-md);
  margin-inline-end: auto;
}
.nav__link {
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-short) var(--ease-out);
}
.nav__link:hover { color: var(--color-ink); }

.nav__cta { white-space: nowrap; }

@media (max-width: 40rem) {
  .nav__links { display: none; }
  .nav { max-width: calc(100% - var(--space-lg)); justify-content: space-between; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  height: 44px;
  padding-inline: var(--space-lg);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: var(--rule-hair) solid transparent;
  transition: background-color var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out),
              transform 100ms var(--ease-out);
}
.btn--sm { height: 36px; padding-inline: var(--space-md); }

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}
.btn--primary:hover { background: color-mix(in oklch, var(--color-accent) 88%, white); }
.btn--primary:active { transform: translateY(1px); }

.btn--ghost, .btn--sm {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-rule-2);
}
.btn--ghost:hover, .btn--sm:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.btn--ghost:active, .btn--sm:active { transform: translateY(1px); }

.btn:focus-visible { outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .btn[data-magnetic] { transition: transform 150ms var(--ease-out), background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out); }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  min-height: clamp(60vh, 78dvh, 88dvh);
  display: flex;
  align-items: center;
  padding: var(--space-3xl) var(--space-lg) calc(var(--space-3xl) * 1.3);
  overflow: hidden;
  overflow-x: clip;
}

.hero__body {
  max-width: 56rem;
  margin-inline: auto;
  text-align: left;
}

.hero__wordmark {
  margin: 0 0 var(--space-lg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4.5rem, 16vw, 12rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow-wrap: anywhere;
  min-width: 0;
  color: var(--color-ink);
}
.hero__wordmark .kchar {
  display: inline;
  font-variation-settings: "wght" 800;
  will-change: font-variation-settings;
}

.hero__tagline {
  margin: 0 0 var(--space-xl);
  max-width: 46ch;
  font-size: var(--text-md);
  color: var(--color-ink-2);
}

.hero__actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .hero__wordmark .kchar { font-variation-settings: "wght" 800 !important; }
}

/* ---------- section head (no eyebrow, single column) ---------- */

.section__head {
  display: block;
  max-width: 46rem;
  margin: 0 auto var(--space-2xl);
  padding-inline: var(--space-lg);
}
.section__title {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}
.section__sub {
  margin: 0;
  max-width: 60ch;
  color: var(--color-muted);
  font-size: var(--text-base);
}

.work, .bots { padding: var(--space-3xl) var(--space-lg); }

/* ---------- work grid ---------- */

.work__grid {
  max-width: 72rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl) var(--space-lg);
}

.work-card {
  opacity: 0;
  transform: translateY(8px);
}
.work-card.is-visible {
  animation: reveal var(--dur-long) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes reveal { to { opacity: 1; transform: none; } }

.work-card__figure {
  margin: 0 0 var(--space-md);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1000 / 703;
}
.work-card__figure img { width: 100%; height: 100%; object-fit: cover; }

.work-card__title {
  margin: 0 0 var(--space-2xs);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-ink);
}
.work-card__desc {
  margin: 0 0 var(--space-sm);
  color: var(--color-muted);
  font-size: var(--text-sm);
  max-width: 46ch;
}
.work-card__link {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
  transition: border-color var(--dur-short) var(--ease-out);
}
.work-card__link:hover { border-color: var(--color-accent); }

@media (prefers-reduced-motion: reduce) {
  .work-card { opacity: 1; transform: none; animation: none; }
}

/* ---------- bot demo ---------- */

.bot-demo {
  max-width: 42rem;
  margin-inline: auto;
  padding: var(--space-md) var(--space-lg);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: color-mix(in oklch, var(--color-paper-2) 88%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  min-height: 12rem;
}

.bot-demo__line {
  display: flex;
  gap: var(--space-sm);
  align-items: baseline;
  margin: 0;
  padding-block: var(--space-sm);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  line-height: 1.5;
  color: var(--color-ink-2);
}
.bot-demo__line:last-child { border-bottom: none; }

.bot-demo__who {
  flex: 0 0 auto;
  font-weight: 600;
}
.bot-demo__who::after { content: ":"; opacity: 0.6; }
.bot-demo__who--bot { color: var(--color-accent); }
.bot-demo__who--user { color: var(--color-muted); }

.bot-demo__caret {
  display: inline-block;
  width: 0.55ch;
  margin-inline-start: 1px;
  animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .bot-demo__caret { animation: none; }
}

/* ---------- footer — Ft5 statement ---------- */

.footer {
  padding: var(--space-3xl) var(--space-lg) var(--space-2xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.footer__statement {
  max-width: 32ch;
  margin: 0 auto var(--space-xl);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.footer__meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.footer__wordmark {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-ink-2);
}
.footer__link {
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
}
.footer__link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- responsive ---------- */

@media (max-width: 40rem) {
  .footer__meta { flex-direction: column; gap: var(--space-2xs); }
}

@media (min-width: 60rem) {
  .work { padding-inline: var(--space-3xl); }
}

/* ---------- floating CTA + contact modal ---------- */

.fab {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: var(--z-sticky);
  height: 48px;
  padding-inline: var(--space-lg);
  border-radius: 999px;
  border: none;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 16px oklch(10% 0.02 63 / 0.4);
  transition: background-color var(--dur-short) var(--ease-out), transform 100ms var(--ease-out);
}
.fab:hover { background: color-mix(in oklch, var(--color-accent) 88%, white); }
.fab:active { transform: translateY(1px); }
.fab:focus-visible { outline-offset: 3px; }

@media (max-width: 30rem) {
  .fab { right: var(--space-md); bottom: var(--space-md); padding-inline: var(--space-md); font-size: var(--text-xs); height: 44px; }
}

.contact-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-height: min(85dvh, 40rem);
  width: min(30rem, calc(100vw - var(--space-lg) * 2));
  padding: 0;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-paper-2);
  color: var(--color-ink);
  overflow-y: auto;
}
.contact-modal::backdrop {
  background: oklch(10% 0.01 63 / 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.contact-modal[open] { animation: modal-in var(--dur-long) var(--ease-out); }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .contact-modal[open] { animation: none; }
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
}
.contact-form__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.contact-form__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
}
.contact-form__close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: var(--rule-hair) solid var(--color-rule-2);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.contact-form__close:hover { color: var(--color-ink); border-color: var(--color-accent); }
.contact-form__close:focus-visible { outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: var(--space-2xs); }
.field__label { font-size: var(--text-sm); color: var(--color-muted); }
.field__input {
  font: inherit;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-rule-2);
  outline: 2px solid transparent;
  outline-offset: 2px;
  padding-block: var(--space-xs);
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.field__input::placeholder { color: var(--color-muted); }
@media (hover: hover) and (pointer: fine) {
  .field__input:hover { background: color-mix(in oklch, var(--color-paper-3) 70%, transparent); }
}
.field__input:focus-visible { border-color: var(--color-accent); outline-color: var(--color-focus); }
.field__input--area { resize: vertical; min-height: 4rem; font-size: var(--text-base); }
.field__input:user-invalid { border-color: var(--color-error); }

.contact-form__status {
  margin: 0;
  min-height: 1lh;
  font-size: var(--text-sm);
}
.contact-form__status[data-state="error"] { color: var(--color-error); }
.contact-form__status[data-state="success"] { color: var(--color-accent); }

.contact-form__submit { align-self: flex-start; }
.contact-form__submit[disabled] { opacity: 0.55; cursor: not-allowed; }
