/* ============================================================
   ELLIOTT TEELING — Immersive site pages
   Editorial/atlas layouts for Home, About, Skills, CV, Contact,
   Maps, Projects index. Reuses styles.css tokens + the .pj-
   motion vocabulary. Scoped under .ex- to avoid collisions.
   ============================================================ */

/* ── Shared building blocks ─────────────────────────────────── */
.ex-wrap { max-width: 1300px; margin: 0 auto; padding: 0 clamp(1.25rem, 5vw, 5rem); position: relative; }
.ex-wrap--narrow { max-width: 1040px; }
.ex-section { position: relative; padding: clamp(4rem, 8vw, 7rem) 0; }

.ex-kicker {
  font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--accent-2);
  display: inline-flex; align-items: center; gap: .7rem;
  margin-bottom: 1.1rem;
}
.ex-kicker::before { content: ""; width: 26px; height: 1px; background: var(--accent-2); }
.ex-kicker .num { color: var(--text-faint); }
.ex-h {
  font-size: clamp(1.9rem, 4.2vw, 3.1rem); line-height: 1.04;
  letter-spacing: -.02em; margin-bottom: 1rem; text-wrap: balance;
}
.ex-lead { font-size: 1.1rem; color: var(--text-muted); max-width: 60ch; }
.ex-watermark {
  position: absolute; top: clamp(1rem, 4vw, 3rem); right: clamp(1.25rem,5vw,5rem);
  font-family: var(--font-serif); font-size: clamp(4rem, 13vw, 10rem); line-height: 1;
  font-weight: 600; color: var(--text); opacity: .035;
  pointer-events: none; user-select: none; z-index: 0;
}

/* reveal (project-page parity, also driven by existing .fade-up) */
.ex-reveal { opacity: 0; transform: translateY(28px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); will-change: transform, opacity; }
.ex-reveal.in { opacity: 1; transform: none; }
.ex-stagger > * { transition-delay: var(--d, 0ms); }

/* ── Immersive page hero (interior pages) ───────────────────── */
.ex-hero {
  position: relative; overflow: hidden;
  background: var(--forest); color: var(--bone);
  padding: clamp(4.5rem, 10vw, 8rem) 0 clamp(3.5rem, 7vw, 5.5rem);
}
[data-theme="dark"] .ex-hero { background: linear-gradient(165deg, #16271F, #0F1714); }
.ex-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='600'%3E%3Cg fill='none' stroke='%237C9885' stroke-width='1' opacity='0.5'%3E%3Cpath d='M-50 300 C 220 230, 440 380, 680 300 S 1120 200, 1320 300'/%3E%3Cpath d='M-50 340 C 240 270, 460 420, 700 340 S 1130 240, 1320 340'/%3E%3Cpath d='M-50 380 C 260 310, 480 460, 720 380 S 1140 280, 1320 380'/%3E%3Cpath d='M-50 180 C 220 110, 440 250, 680 170 S 1120 90, 1320 180'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover; background-position: center;
  animation: ex-hero-drift 30s ease-in-out infinite alternate;
}
@keyframes ex-hero-drift { from { transform: scale(1) translateX(0); } to { transform: scale(1.06) translateX(-1.5%); } }
.ex-hero__grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(245,242,235,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,242,235,.06) 1px, transparent 1px);
  background-size: 70px 70px;
  -webkit-mask-image: radial-gradient(120% 130% at 20% 0%, #000, transparent 75%);
  mask-image: radial-gradient(120% 130% at 20% 0%, #000, transparent 75%);
}
.ex-hero .ex-wrap { position: relative; z-index: 1; }
.ex-hero__index {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .3em;
  color: var(--sage-light); margin-bottom: 1.1rem;
  display: flex; align-items: center; gap: .8rem;
}
.ex-hero__index::before { content: ""; width: 40px; height: 1px; background: var(--terracotta-l); }
.ex-hero h1 {
  color: var(--bone); font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1; letter-spacing: -.025em; margin: 0 0 1rem; text-wrap: balance;
}
.ex-hero h1 .accent { color: var(--sage-light); font-style: italic; }
.ex-hero__sub { font-size: 1.12rem; color: rgba(245,242,235,.84); max-width: 60ch; line-height: 1.6; }
.ex-hero__sub strong { color: var(--bone); }
.ex-hero__meta { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-top: 2rem; }
.ex-hero__meta .m { display: flex; flex-direction: column; gap: .15rem; }
.ex-hero__meta .m dt { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(245,242,235,.55); }
.ex-hero__meta .m dd { font-size: .95rem; color: var(--bone); font-weight: 500; }

/* ── HOME: layered cinematic hero ───────────────────────────── */
.ex-home-hero { position: relative; min-height: clamp(560px, 86vh, 900px); display: flex; align-items: center; overflow: hidden; background: var(--forest-darker); color: var(--bone); }
.ex-home-hero__layers { position: absolute; inset: 0; z-index: 0; }
.ex-home-hero__contours { position: absolute; inset: -8%; opacity: .7; }
.ex-home-hero__contours svg { width: 100%; height: 100%; }
.ex-home-hero__scrim { position: absolute; inset: 0; z-index: 1; background: radial-gradient(130% 90% at 75% 10%, rgba(124,152,133,.22), transparent 55%), linear-gradient(180deg, transparent 40%, rgba(12,20,16,.55) 100%); }
.ex-home-hero__grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: linear-gradient(rgba(245,242,235,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(245,242,235,.05) 1px, transparent 1px);
  background-size: 78px 78px;
  -webkit-mask-image: radial-gradient(110% 110% at 50% 50%, #000, transparent 80%);
  mask-image: radial-gradient(110% 110% at 50% 50%, #000, transparent 80%);
}
.ex-home-hero .ex-wrap { position: relative; z-index: 2; width: 100%; }
.ex-home-hero__inner { max-width: 60rem; }
.ex-home-hero .eyebrow { color: var(--sage-light); margin-bottom: 1.5rem; }
.ex-home-hero .eyebrow::before { background: var(--sage-light); }
.ex-home-hero h1 {
  color: var(--bone); font-size: clamp(3rem, 9vw, 6.6rem);
  line-height: .96; letter-spacing: -.03em; margin: 0 0 1.4rem; text-wrap: balance;
}
.ex-home-hero h1 .accent { color: var(--sage-light); font-style: italic; }
.ex-home-hero__sub { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: rgba(245,242,235,.86); max-width: 56ch; margin-bottom: 2.2rem; line-height: 1.6; }
.ex-home-hero__sub strong { color: var(--bone); }
.ex-home-hero__ctas { display: flex; gap: .85rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.ex-home-hero__ctas .btn-outline { color: var(--bone); border-color: rgba(245,242,235,.4); }
.ex-home-hero__ctas .btn-outline:hover { color: var(--bone); border-color: var(--bone); background: rgba(245,242,235,.08); }
.ex-home-hero__ctas .btn-ghost { color: rgba(245,242,235,.78); }
.ex-home-hero__ctas .btn-ghost:hover { color: var(--bone); }
.ex-home-hero__chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.ex-home-hero__chips .hero-chip { color: var(--sage-light); border-color: rgba(124,152,133,.45); }
/* corner coordinate readout */
.ex-coord-readout {
  position: absolute; bottom: 1.2rem; right: clamp(1.25rem,5vw,5rem); z-index: 2;
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .12em;
  color: rgba(245,242,235,.55); text-align: right; line-height: 1.7;
}
.ex-coord-readout .live { color: var(--terracotta-l); }

/* ── Bento grid — uniform, even cells (no gaps) ──────────────── */
/* Every cell is the same size and every row the same height, so the
   grid always tiles cleanly. Per-grid column count via --cols. */
.ex-bento {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
}
.ex-bento > * { min-width: 0; }
/* legacy span classes collapse to a single equal cell — keeps markup working */
.ex-cell, .ex-cell--lg, .ex-cell--wide, .ex-cell--tall, .ex-cell--full {
  grid-column: auto; grid-row: auto;
}
@media (max-width: 920px) { .ex-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ex-bento { grid-template-columns: 1fr; } }

/* project card (bento) */
.ex-pcard {
  position: relative; display: flex; flex-direction: column;
  height: 100%; min-height: 300px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s;
  will-change: transform;
}
.ex-pcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.ex-pcard__media { position: absolute; inset: 0; z-index: 0; }
.ex-pcard__media img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9) brightness(.92); transition: transform .7s var(--ease), filter .4s; }
.ex-pcard:hover .ex-pcard__media img { transform: scale(1.06); filter: saturate(1) brightness(1); }
.ex-pcard__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,20,16,.15) 0%, rgba(12,20,16,.35) 45%, rgba(12,20,16,.9) 100%); }
.ex-pcard__body { position: relative; z-index: 1; margin-top: auto; padding: 1.4rem; color: var(--bone); text-shadow: 0 1px 10px rgba(8,14,11,.6); }
.ex-pcard__idx {
  display: flex; align-items: center; gap: .55em;
  font-family: var(--font-mono); font-size: .64rem; font-weight: 600;
  letter-spacing: .16em; color: #F3C9AE; margin-bottom: .65rem;
  text-shadow: 0 1px 6px rgba(8,14,11,.95), 0 0 2px rgba(8,14,11,.9);
}
.ex-pcard__idx::before {
  content: ""; flex: 0 0 auto; width: 16px; height: 2px; border-radius: 2px;
  background: var(--terracotta); box-shadow: 0 0 7px rgba(197,106,56,.75);
}
.ex-pcard__title { font-family: var(--font-serif); font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.1; color: var(--bone); margin-bottom: .4rem; }
.ex-cell--lg .ex-pcard__title { font-size: clamp(1.4rem, 2.6vw, 2.1rem); }
.ex-pcard__desc { font-size: .85rem; color: rgba(245,242,235,.8); margin-bottom: .8rem; max-width: 48ch; }
.ex-pcard__tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.ex-pcard__tags .tag { background: rgba(245,242,235,.1); border-color: rgba(245,242,235,.22); color: var(--sage-light); }
.ex-pcard__go { position: absolute; top: 1.1rem; right: 1.1rem; z-index: 1; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(245,242,235,.3); display: flex; align-items: center; justify-content: center; color: var(--bone); background: rgba(12,20,16,.35); backdrop-filter: blur(4px); transition: background .3s, transform .3s var(--ease); }
.ex-pcard:hover .ex-pcard__go { background: var(--terracotta); border-color: var(--terracotta); transform: rotate(-45deg); }
.ex-pcard__go svg { width: 17px; height: 17px; }

/* a "static info" bento tile (non-image) */
.ex-tile {
  position: relative; height: 100%; min-height: 160px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 1.4rem; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.ex-tile:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.ex-tile--accent { background: var(--forest); color: var(--bone); border-color: var(--forest); }
[data-theme="dark"] .ex-tile--accent { background: linear-gradient(150deg,#1E3329,#0F1714); }
.ex-tile--accent .ex-tile__k { color: var(--terracotta-l); }
.ex-tile__k { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin-bottom: .8rem; }
.ex-tile__big { font-family: var(--font-serif); font-size: clamp(2rem, 4vw, 3rem); line-height: 1; letter-spacing: -.02em; }
.ex-tile--accent .ex-tile__big { color: var(--bone); }
.ex-tile__lab { font-size: .85rem; color: var(--text-muted); margin-top: .4rem; }
.ex-tile--accent .ex-tile__lab { color: rgba(245,242,235,.8); }
.ex-tile__icon { width: 38px; height: 38px; color: var(--accent); margin-bottom: .8rem; }
.ex-tile__icon svg { width: 100%; height: 100%; }

/* ── Stat band (animated counters) ──────────────────────────── */
.ex-statband { background: var(--forest-darker); color: var(--bone); position: relative; overflow: hidden; }
.ex-statband::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='300'%3E%3Cg fill='none' stroke='%237C9885' stroke-width='1' opacity='0.4'%3E%3Cpath d='M-50 150 C 200 100, 400 200, 650 130 S 1100 60, 1300 150'/%3E%3Cpath d='M-50 190 C 220 140, 420 240, 660 170 S 1110 100, 1300 190'/%3E%3C/g%3E%3C/svg%3E"); background-size: cover; animation: ex-hero-drift 26s ease-in-out infinite alternate; }
.ex-statband .ex-wrap { position: relative; z-index: 1; }
.ex-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
.ex-stat { padding: .5rem 0; border-left: 2px solid rgba(124,152,133,.4); padding-left: 1.2rem; }
.ex-stat__n { font-family: var(--font-serif); font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -.02em; color: var(--bone); display: flex; align-items: baseline; gap: .2rem; }
.ex-stat__n .u { font-family: var(--font-mono); font-size: .9rem; color: var(--terracotta-l); }
.ex-stat__l { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sage-light); margin-top: .6rem; }

/* ── Editorial split (about / generic two-col) ──────────────── */
.ex-split { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.75rem, 5vw, 4rem); align-items: start; }
.ex-split--reverse { grid-template-columns: 1fr 1.4fr; }
@media (max-width: 920px) { .ex-split, .ex-split--reverse { grid-template-columns: 1fr; gap: 2rem; } }
.ex-prose p { font-size: 1.02rem; line-height: 1.75; color: var(--text-muted); margin-bottom: 1.1rem; }
.ex-prose p strong { color: var(--text); }
.ex-prose .drop::first-letter {
  font-family: var(--font-serif); font-size: 3.4rem; font-weight: 600;
  float: left; line-height: .82; padding: .1rem .6rem .1rem 0; color: var(--accent);
}
.ex-portrait {
  position: relative; aspect-ratio: 4/5; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--forest); border: 1px solid var(--forest-deep);
  display: flex; align-items: center; justify-content: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='500'%3E%3Cg fill='none' stroke='%237C9885' stroke-width='1.2' opacity='0.4'%3E%3Cpath d='M-20 140 C 120 100, 200 200, 420 130'/%3E%3Cpath d='M-20 200 C 120 160, 200 260, 420 190'/%3E%3Cpath d='M-20 260 C 120 220, 200 320, 420 250'/%3E%3Cpath d='M-20 330 C 120 290, 200 390, 420 320'/%3E%3Cpath d='M-20 400 C 120 360, 200 460, 420 390'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}
.ex-portrait img { width: 100%; height: 100%; object-fit: cover; }
.ex-portrait__ph { color: var(--sage-light); width: 64px; height: 64px; }
.ex-portrait__tag { position: absolute; left: 1rem; bottom: 1rem; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; color: var(--bone); background: rgba(12,20,16,.5); border: 1px solid rgba(245,242,235,.2); padding: .3rem .6rem; border-radius: 6px; backdrop-filter: blur(4px); }

/* ── Timeline (education / journey) ─────────────────────────── */
.ex-timeline { position: relative; margin-top: 2rem; }
.ex-timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--sage), var(--accent-2)); opacity: .5; }
.ex-tl { position: relative; padding-left: 2.2rem; padding-bottom: 1.6rem; }
.ex-tl::before { content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.ex-tl:hover::before { background: var(--accent-2); border-color: var(--accent-2); }
.ex-tl__date { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; color: var(--accent-2); }
.ex-tl__role { font-weight: 600; font-size: 1.05rem; margin: .15rem 0; color: var(--text); }
.ex-tl__org { color: var(--accent); font-size: .9rem; font-weight: 500; margin-bottom: .4rem; }
.ex-tl__desc { font-size: .9rem; color: var(--text-muted); }

/* ── CV sticky index layout ─────────────────────────────────── */
.ex-cv-layout { display: grid; grid-template-columns: 200px 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.ex-cv-index { position: sticky; top: 92px; display: flex; flex-direction: column; gap: .2rem; }
.ex-cv-index a { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--text-muted); padding: .5rem .6rem; border-radius: var(--radius); border-left: 2px solid transparent; transition: color .2s, border-color .2s, background .2s; }
.ex-cv-index a:hover { color: var(--accent); background: var(--accent-subtle); }
.ex-cv-index a.active { color: var(--accent); border-left-color: var(--accent-2); }
@media (max-width: 860px) { .ex-cv-layout { grid-template-columns: 1fr; } .ex-cv-index { position: static; flex-direction: row; flex-wrap: wrap; margin-bottom: 1.5rem; } }

/* ── Contact split with cartographic panel ──────────────────── */
.ex-contact-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(1.75rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 920px) { .ex-contact-grid { grid-template-columns: 1fr; } }
.ex-contact-aside { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--forest); color: var(--bone); padding: clamp(1.75rem, 3vw, 2.5rem); }
[data-theme="dark"] .ex-contact-aside { background: linear-gradient(160deg,#1E3329,#0F1714); border: 1px solid var(--border); }
.ex-contact-aside::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='500' height='600'%3E%3Cg fill='none' stroke='%237C9885' stroke-width='1' opacity='0.5'%3E%3Ccircle cx='250' cy='300' r='60'/%3E%3Ccircle cx='250' cy='300' r='120'/%3E%3Ccircle cx='250' cy='300' r='180'/%3E%3Ccircle cx='250' cy='300' r='240'/%3E%3C/g%3E%3C/svg%3E"); background-size: cover; animation: slow-spin 120s linear infinite; transform-origin: center; }
.ex-contact-aside > * { position: relative; z-index: 1; }
.ex-contact-aside h2 { color: var(--bone); margin-bottom: .8rem; }
.ex-contact-aside p { color: rgba(245,242,235,.82); }

/* ── Section progress dots (interior pages, top) ────────────── */
.ex-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none; }
.ex-progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .1s linear; }

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ex-hero::before, .ex-statband::before, .ex-home-hero__contours .contour-group, .ex-contact-aside::before { animation: none !important; }
  .ex-reveal { opacity: 1; transform: none; transition: none; }
}
