:root {
  --bg: #0E0E0E;
  --bg-elev: #161616;
  --fg: #F2EFEA;
  --fg-dim: #9A938A;
  --fg-faint: #5A544D;
  --accent: #E84C2B;
  --rule: rgba(242, 239, 234, 0.14);
  --rule-strong: rgba(242, 239, 234, 0.38);

  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --max-w: 1280px;
  --pad-x: clamp(1.25rem, 4.5vw, 4.5rem);
  --gutter: max(var(--pad-x), calc((100vw - var(--max-w)) / 2));

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

:root[data-theme="light"] {
  --bg: #F2EFEA;
  --bg-elev: #EAE6DF;
  --fg: #0E0E0E;
  --fg-dim: #5A544D;
  --fg-faint: #9A938A;
  --accent: #C53A1D;
  --rule: rgba(14, 14, 14, 0.14);
  --rule-strong: rgba(14, 14, 14, 0.38);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  line-height: 1.55;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 240ms var(--ease), color 240ms var(--ease);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ============================================================
   Grain overlay
   ============================================================ */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.45;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}

:root[data-theme="light"] .grain {
  opacity: 0.35;
  mix-blend-mode: multiply;
}

/* Accessibility helper */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  padding: clamp(1.25rem, 2.5vw, 2rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  opacity: 0;
  animation: rise 900ms var(--ease) 150ms forwards;
}

.meta-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
  animation: breathe 2.6s ease-in-out infinite;
}

/* ============================================================
   Theme toggle
   ============================================================ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 0.375rem 0.5rem;
  border-radius: 999px;
  transition: color 180ms var(--ease);
  opacity: 0;
  animation: rise 900ms var(--ease) 400ms forwards;
}

.theme-toggle:hover { color: var(--fg); }

.theme-toggle__track {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--rule-strong);
  border-radius: 999px;
  transition: background 240ms var(--ease);
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 240ms var(--ease), background 240ms var(--ease);
}

:root[data-theme="light"] .theme-toggle__thumb { transform: translateX(16px); }

:root[data-theme="dark"] [data-theme-light] { display: none; }
:root[data-theme="light"] [data-theme-dark] { display: none; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding: clamp(3rem, 8vw, 7rem) var(--gutter) clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 auto clamp(1.75rem, 4vw, 3rem);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  opacity: 0;
  animation: rise 900ms var(--ease) 350ms forwards;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent);
  animation: pulse 2.2s ease-out infinite;
}

.pulse--small {
  width: 6px;
  height: 6px;
}

.hero__logo {
  margin: 0 auto;
  line-height: 0;
  max-width: min(440px, 34vw);
  opacity: 0;
  animation: rise 1100ms var(--ease) 450ms forwards;
}

.hero-logo {
  width: 100%;
  height: auto;
  display: block;
}

:root[data-theme="dark"] .hero-logo--light-only { display: none; }
:root[data-theme="light"] .hero-logo--dark-only { display: none; }

.hero__tagline {
  margin: clamp(1.25rem, 2.5vw, 2rem) 0 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-style: normal;
  font-size: clamp(1.15rem, 1.9vw, 1.65rem);
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--fg-dim);
  font-variation-settings: "opsz" 72, "SOFT" 100;
  opacity: 0;
  animation: rise 900ms var(--ease) 700ms forwards;
}

.hero__tagline em {
  font-style: italic;
  color: var(--accent);
}

.hero__tagline-punct {
  color: var(--accent);
}

/* Marquee */
.hero__marquee {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.85rem 0;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  opacity: 0;
  animation: fade 900ms var(--ease) 900ms forwards;
}

.marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  white-space: nowrap;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  letter-spacing: -0.01em;
  color: var(--fg);
  animation: scroll 28s linear infinite;
  padding-right: 2.5rem;
}

.marquee-track .dot {
  font-style: normal;
  color: var(--accent);
  font-size: 0.7em;
  transform: translateY(-1px);
}

/* ============================================================
   Manifesto
   ============================================================ */
.manifesto {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.manifesto__rail {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-top: 0.35rem;
}

.manifesto__rail .manifesto__tag:first-child {
  color: var(--accent);
}

.manifesto__quote {
  margin: 0;
  max-width: 56ch;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.35rem, 2.2vw, 1.95rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 72, "SOFT" 100;
}

.manifesto__quote p + p {
  margin-top: 1.1em;
}

.manifesto__quote em {
  font-style: italic;
  color: var(--accent);
}

.manifesto__quote strong {
  font-weight: 500;
  font-style: italic;
}

.manifesto__lead {
  margin-top: 0;
  text-indent: -0.05em;
}

.dropcap {
  float: left;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 5.4em;
  line-height: 0.82;
  margin: 0.08em 0.1em -0.04em -0.04em;
  color: var(--fg);
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

.highlight {
  background: linear-gradient(180deg, transparent 62%, color-mix(in oklab, var(--accent) 38%, transparent) 62%, color-mix(in oklab, var(--accent) 38%, transparent) 94%, transparent 94%);
  padding: 0 0.05em;
}

.manifesto__signature {
  grid-column: 2;
  margin-top: clamp(2rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.sig-line {
  width: clamp(120px, 18vw, 200px);
  height: 14px;
  color: var(--fg-faint);
}

/* ============================================================
   Contact
   ============================================================ */
.contact {
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: end;
}

.label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 1rem;
}

.contact__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin: 0;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.contact__title-alt {
  font-style: italic;
  color: var(--accent);
}

.contact__email {
  justify-self: end;
  text-align: right;
}

.mail {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.2vw, 2.75rem);
  letter-spacing: -0.02em;
  padding-bottom: 0.25em;
  font-variation-settings: "opsz" 96;
}

.mail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--rule-strong);
  transform: scaleX(1);
  transform-origin: right;
  transition: transform 500ms var(--ease);
}

.mail:hover::after,
.mail:focus-visible::after {
  transform: scaleX(0);
  transform-origin: left;
}

.mail__arrow {
  display: inline-block;
  transition: transform 400ms var(--ease);
  color: var(--accent);
}

.mail:hover .mail__arrow,
.mail:focus-visible .mail__arrow {
  transform: translate(6px, -6px) rotate(-12deg);
}

.contact__hint {
  margin: 0.875rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: clamp(1.5rem, 3vw, 2rem) var(--gutter) clamp(2rem, 3vw, 2.5rem);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  letter-spacing: 0.04em;
}

.footer-col .label {
  margin-bottom: 0;
  color: var(--fg-faint);
}

.footer-col--status span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 14px color-mix(in oklab, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 0%, transparent); }
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
  .site-header {
    grid-template-columns: auto auto;
    row-gap: 0.75rem;
  }

  .header-meta {
    display: none;
  }

  .hero__line--2 {
    margin-left: clamp(1rem, 6vw, 4rem);
  }

  .manifesto {
    grid-template-columns: 1fr;
  }

  .manifesto__rail {
    flex-direction: row;
    gap: 1rem;
  }

  .manifesto__signature {
    grid-column: 1;
  }

  .contact__grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .contact__email {
    justify-self: start;
    text-align: left;
  }

  .site-footer {
    grid-template-columns: 1fr 1fr;
    row-gap: 1.25rem;
  }
}

@media (max-width: 460px) {
  .hero__title { font-size: clamp(2.6rem, 14vw, 4.5rem); }
  .manifesto__quote { font-size: 1.25rem; }
  .dropcap { font-size: 4.4em; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .hero__line span,
  .hero__line em { transform: none; opacity: 1; }

  .marquee-track { animation: none; transform: none; }
  .brand, .header-meta, .theme-toggle, .hero__eyebrow, .hero__marquee { opacity: 1; }
}

/* ============================================================
   Focus visible
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

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