/* ─────────────────────────────────────────────────────────────────
   Tal Pais — homepage stylesheet
   Editorial / scientific. Cream paper, ink, rust accent.
   ───────────────────────────────────────────────────────────────── */

:root {
  --paper:        #f4ede0;
  --paper-2:      #ecdfc8;
  --ink:          #1a1814;
  --ink-soft:     #4d463b;
  --ink-fade:     #8b8378;
  --rule:         #cdbfa4;
  --accent:       #b3543a;
  --accent-soft:  #e9c9bb;

  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body:    "Newsreader", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --max-w:        1280px;
  --gutter:       clamp(20px, 5vw, 80px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "onum";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* paper grain — subtle SVG noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' 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.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.55;
  mix-blend-mode: multiply;
}

/* ── shared atoms ───────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-fade);
  margin: 0 0 1.6em;
}

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

a { color: var(--accent); }

/* ── masthead ───────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter) 18px;
  background: rgba(244, 237, 224, 0.84);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-fade);
}
@media (max-width: 540px) {
  .brand-sub { display: none; }
}

.nav {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color 0.25s ease;
}
.nav a:hover { color: var(--ink); }
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.6, 0, 0.1, 1);
}
.nav a:hover::after,
.nav a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}
.nav a.active { color: var(--ink); }

/* ── hero ───────────────────────────────────────────── */

.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(80px, 14vh, 180px) var(--gutter) clamp(70px, 11vh, 140px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 3fr);
  gap: clamp(28px, 4vw, 80px);
  align-items: start;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144;
  font-size: clamp(64px, 13.5vw, 184px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin: 0 0 0.38em;
  color: var(--ink);
}

.lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 60;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.35;
  letter-spacing: -0.005em;
  margin: 0 0 1em;
  max-width: 30ch;
  color: var(--ink);
}
.lead em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}

.byline {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
  max-width: 38ch;
  color: var(--ink-soft);
}

.hero-aside {
  border-left: 1px solid var(--rule);
  padding-left: clamp(16px, 2vw, 28px);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.aside-note {
  margin: 0 0 1.1em;
}
.aside-note:last-child { margin-bottom: 0; }
.aside-label {
  display: inline-block;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-right: 0.6em;
  font-size: 11px;
}

/* ── ornament ───────────────────────────────────────── */

.ornament {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 60;
  font-size: 22px;
  letter-spacing: 0.4em;
  color: var(--rule);
  padding: clamp(28px, 5vh, 60px) var(--gutter);
  user-select: none;
}

/* ── section header (shared) ───────────────────────── */

.section-header {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(36px, 6vh, 64px);
  display: grid;
  grid-template-columns: minmax(60px, 90px) 1fr;
  column-gap: clamp(20px, 3vw, 48px);
  row-gap: 6px;
  align-items: baseline;
}
.section-header .eyebrow {
  margin: 0;
  align-self: start;
  padding-top: 0.45em;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 100;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
.section-lead {
  grid-column: 2;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.5;
  margin: 0.7em 0 0;
  max-width: 52ch;
  color: var(--ink-soft);
}
@media (max-width: 720px) {
  .section-header { grid-template-columns: 1fr; }
  .section-lead { grid-column: 1; }
}

/* ── projects ──────────────────────────────────────── */

.projects {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(48px, 7vh, 100px) 0 clamp(48px, 7vh, 100px);
}
.project-list {
  list-style: none;
  margin: 0;
  padding: 0 var(--gutter);
}
.project {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 4vh, 44px) 0 clamp(32px, 4vh, 48px);
  transition: background 0.4s ease;
}
.project:last-child { border-bottom: 1px solid var(--rule); }

.project-link,
.project.upcoming {
  display: grid;
  gap: clamp(20px, 3vw, 56px);
  align-items: start;
}
.project-link {
  /* live cards have a thumbnail column */
  grid-template-columns: minmax(80px, 130px) 1fr auto;
  text-decoration: none;
  color: inherit;
}
.project.upcoming {
  /* upcoming cards: no thumbnail, just two columns */
  grid-template-columns: minmax(80px, 130px) 1fr;
}

.project-thumb {
  width: 144px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-2);
  align-self: center;
  transition: transform 0.4s cubic-bezier(0.2, 0, 0.1, 1);
}
.project-thumb svg {
  display: block;
  width: 100%;
  height: auto;
}
.project-link:hover .project-thumb {
  transform: scale(1.04);
}

@media (max-width: 720px) {
  .project-link {
    grid-template-columns: 1fr;
  }
  .project.upcoming {
    grid-template-columns: 1fr;
  }
  .project-thumb {
    width: 100%;
    max-width: 240px;
    align-self: start;
    margin-top: 4px;
  }
}

.project-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-fade);
  padding-top: 0.6em;
  transition: color 0.3s ease;
}

.project-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 80;
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 0.45em;
  color: var(--ink);
  transition: color 0.3s ease;
}

.project-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-fade);
  margin: 0 0 1em;
}

.project-desc {
  margin: 0 0 1.1em;
  max-width: 60ch;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}

.project-cta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.project-cta .arrow {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.project-link:hover .project-num    { color: var(--accent); }
.project-link:hover .project-title  { color: var(--accent); }
.project-link:hover .arrow          { transform: translateX(6px); }
.project:has(.project-link:hover)   { background: rgba(179, 84, 58, 0.04); }

.project.upcoming { opacity: 0.62; }
.project.upcoming .project-title { font-weight: 400; }

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--paper-2);
  color: var(--ink-soft);
  padding: 3px 10px;
  border-radius: 99px;
  margin-left: 12px;
  vertical-align: middle;
  transform: translateY(-3px);
  border: 1px solid rgba(26, 24, 20, 0.08);
}

/* ── about ─────────────────────────────────────────── */

.about {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(48px, 7vh, 100px) 0;
}
.about-grid {
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(60px, 90px) 1fr;
  gap: clamp(20px, 3vw, 48px);
}
.about-body {
  grid-column: 2;
  font-size: 19px;
  line-height: 1.62;
  max-width: 60ch;
  margin: 0 0 1.1em;
}
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-body { grid-column: 1; }
}
.about-first::first-letter {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: 5.6em;
  line-height: 0.82;
  float: left;
  padding: 0.06em 0.14em 0 0;
  color: var(--accent);
}

/* ── colophon ──────────────────────────────────────── */

.colophon {
  border-top: 1px solid var(--rule);
  margin-top: clamp(60px, 10vh, 120px);
  padding: 32px var(--gutter) 40px;
}
.colophon-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-fade);
}
.colophon-grid p { margin: 0; }
.colophon a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--ink-fade);
  padding-bottom: 1px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.colophon a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.colophon em {
  font-family: var(--font-body);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ── stagger reveal on hero ────────────────────────── */

.stagger {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.95s cubic-bezier(0.2, 0, 0, 1) forwards;
  animation-delay: calc(var(--i, 0) * 130ms + 80ms);
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .stagger { opacity: 1; transform: none; animation: none; }
  html { scroll-behavior: auto; }
}
