:root {
  --char: #12100D;
  --char-warm: #221912;
  --cream: #F6F1E8;
  --cream-deep: #F1E9DA;
  --ink: #221B12;
  --ember: #E8672E;
  --ember-deep: #C2431A;
  --muted-on-dark: #9C9284;
  --muted-on-light: #6E6354;
  --hairline-dark: rgba(242, 237, 228, 0.14);
  --hairline-light: rgba(34, 27, 18, 0.14);
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  background-color: var(--char);
  color: #F2EDE4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--ember); color: var(--char); }

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

a:focus-visible,
.cta:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 4px;
  border-radius: 1px;
}

body.lit a:focus-visible,
#portfolio a:focus-visible,
#contact a:focus-visible {
  outline-color: var(--ember-deep);
}

/* ---------- nav ---------- */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px clamp(24px, 5vw, 64px);
  transition: color 0.6s ease, transform 0.45s ease, opacity 0.45s ease, padding 0.35s ease, visibility 0.45s;
  pointer-events: none;
}

nav.scrolled {
  background: var(--nav-bg, rgba(18, 16, 13, 0.92));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding-top: 15px;
  padding-bottom: 15px;
}

nav.nav-hidden {
  transform: translateY(-30%);
  opacity: 0;
  visibility: hidden;
}

nav.nav-hidden a { pointer-events: none; }

nav a { pointer-events: auto; }

.wordmark {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.dot { color: var(--ember); }

.nav-links {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
}

.nav-links a {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted-on-dark);
  transition: color 0.3s ease;
}

.nav-links a:hover { color: var(--ember); }

body.lit .nav-links a { color: var(--muted-on-light); }
body.lit .nav-links a:hover { color: var(--ember-deep); }
body.lit nav { color: var(--ink); }

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

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

#embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 64px);
}

h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.9rem, 8vw, 6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h1 em {
  font-style: italic;
  color: var(--ember);
}

.sub {
  margin-top: 28px;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--muted-on-dark);
  max-width: 34em;
}

.cta {
  display: inline-block;
  margin-top: 40px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ember);
  border-bottom: 1px solid var(--ember);
  padding-bottom: 4px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.cta:hover { color: #F2EDE4; border-color: #F2EDE4; }

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.cue-line {
  display: block;
  width: 1px;
  height: 56px;
  background: var(--muted-on-dark);
  transform-origin: top;
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 0.8; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- sections ---------- */

section {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(64px, 10vh, 116px) clamp(24px, 5vw, 64px);
  scroll-margin-top: 72px;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  margin-bottom: 28px;
}

h2 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 36px;
  max-width: 16em;
}

.prose p,
.lede {
  max-width: 38em;
  color: var(--muted-on-dark);
  transition: color 0.6s ease;
}

.prose p + p { margin-top: 1.4em; }

.lede {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  margin-bottom: 56px;
}

body.lit .prose p,
body.lit .lede { color: var(--muted-on-light); }

/* dark sections keep light text; once past the pivot the page is light */

#portfolio, #contact { color: var(--ink); }

#portfolio .kicker,
#contact .kicker { color: #B23C15; }

/* ---------- sectors ---------- */

.sectors {
  list-style: none;
  border-top: 1px solid var(--hairline-dark);
}

.sectors li {
  display: grid;
  grid-template-columns: 64px 1fr 1.2fr;
  align-items: center;
  gap: 24px;
  padding: 34px 0;
  border-bottom: 1px solid var(--hairline-dark);
  transition: padding-left 0.35s ease;
}

.sectors li:hover { padding-left: 12px; }

.sectors .num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ember);
}

.sectors .name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.2;
  transition: color 0.3s ease;
}

.sectors li:hover .name { color: var(--ember); }

.sectors .desc {
  font-size: 15px;
  color: var(--muted-on-dark);
}

/* ---------- facts ---------- */

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(40px, 8vw, 120px);
  margin-top: 60px;
}

.fact { display: flex; flex-direction: column; gap: 10px; }

.fact-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-on-dark);
}

.fact-value {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-weight: 400;
}

/* ---------- pivot ---------- */

.pivot {
  min-height: 80svh;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.pivot p {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  color: var(--ember);
  transition: color 0.8s ease;
}

body.lit .pivot p { color: var(--ember-deep); }

/* ---------- portfolio grid (template, used once cards exist) ---------- */

.portfolio-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 56px;
}

.portfolio-card a {
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  padding: 26px 26px 20px;
  transition: border-color 0.3s ease;
}

.portfolio-card a:hover { border-color: var(--ember-deep); }

.portfolio-card img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 18px;
}

.portfolio-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-on-light);
}

.portfolio-domain { color: #B23C15; }

/* ---------- contact ---------- */

.cta.big {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  letter-spacing: 0;
  color: var(--ember-deep);
  border-bottom-color: var(--ember-deep);
  padding-bottom: 6px;
}

.cta.big:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--hairline-light);
  color: var(--ink);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px clamp(24px, 5vw, 64px) 56px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-mark {
  font-family: var(--font-serif);
  font-size: 18px;
}

.footer-meta {
  font-size: 13px;
  color: var(--muted-on-light);
}

/* ---------- reveal animations ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

.sectors li.reveal:nth-child(2).in { transition-delay: 0.08s; }
.sectors li.reveal:nth-child(3).in { transition-delay: 0.16s; }
.sectors li.reveal:nth-child(4).in { transition-delay: 0.24s; }
.sectors li.reveal:nth-child(5).in { transition-delay: 0.32s; }

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

@media (max-width: 720px) {
  .sectors li {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    row-gap: 6px;
  }
  .sectors .desc {
    grid-column: 2;
  }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 12px; }
}

@media (max-width: 560px) {
  .nav-links a:not([href="#contact"]) { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cue-line { animation: none; opacity: 0.5; }
  #embers { display: none; }
}
