/* Daniel Diaz, personal site.
   Sticky identity rail on the left, wide multi-column content on the right. */

:root {
  --ink:     #15181f;
  --body:    #3b4252;
  --muted:   #6b7382;
  --faint:   #98a0ae;
  --rule:    #e4e6eb;
  --bg:      #ffffff;
  --bg-alt:  #f6f7f9;
  --link:    #1b3a7a;
  --accent:  #a63228;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Light is the default. Dark is opt-in via the toggle and remembered. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9ebef; --body: #c2c8d4; --muted: #939bab; --faint: #6f7786;
  --rule: #2b303a; --bg: #12141a; --bg-alt: #191c23;
  --link: #8ab0f0; --accent: #ef8a7e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1.05rem; }
p:last-child { margin-bottom: 0; }

:where(a, button):focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }

/* ============ shell ============ */
.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 3.5rem clamp(1.25rem, 4vw, 4rem) 0;
  display: grid;
  gap: clamp(2rem, 5vw, 5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 62rem) {
  .shell { grid-template-columns: 17.5rem minmax(0, 1fr); }
  .rail { position: sticky; top: 3.5rem; }
}

/* ============ rail ============ */
.rail img.portrait {
  /* height:auto is required: the width/height attributes otherwise set a
     literal 800px height that beats aspect-ratio. */
  width: 100%; height: auto; max-width: 15rem;
  aspect-ratio: 1; object-fit: cover;
  border-radius: 5px; display: block; background: var(--bg-alt);
}
.rail h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: 2rem; line-height: 1.12; letter-spacing: -.02em;
  color: var(--ink); margin: 1.25rem 0 .35rem;
}
.rail h1 b { font-weight: 700; }
.rail .role { font-size: .95rem; color: var(--muted); margin: 0 0 1.25rem; line-height: 1.45; }
.rail .role b { color: var(--body); font-weight: 600; display: block; }

.rail ul.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.rail ul.links a {
  display: inline-block; font-size: .84rem; color: var(--body);
  border: 1px solid var(--rule); border-radius: 3px; padding: .22rem .6rem;
}
.rail ul.links a:hover { border-color: var(--muted); color: var(--ink); text-decoration: none; }

.rail .prev {
  margin: 1.5rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--rule);
  font-size: .84rem; color: var(--muted); line-height: 1.55;
}
.rail .prev b { color: var(--body); font-weight: 600; }

/* on narrow screens the rail becomes a compact header */
@media (max-width: 61.99rem) {
  .rail { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .rail img.portrait { max-width: none; }
  .rail .identity { grid-column: 2; }
  .rail h1 { margin-top: 0; }
  .rail .prev { grid-column: 1 / -1; margin-top: .5rem; }
}
@media (max-width: 30rem) {
  .rail { grid-template-columns: minmax(0, 1fr); }
  .rail img.portrait { width: 9rem; }
  .rail .identity { grid-column: 1; }
}

/* ============ main ============ */
/* Intro is a two-column band: prose at a readable measure, figure in what
   would otherwise be a dead gutter on wide screens. */
.intro {
  padding-bottom: .5rem;
  display: grid; gap: clamp(1.75rem, 3vw, 3rem);
  grid-template-columns: minmax(0, 1fr); align-items: start;
}
@media (min-width: 75rem) {
  .intro { grid-template-columns: minmax(0, 38rem) minmax(0, 1fr); }
}
.intro .text p { max-width: 62ch; }
.intro .lede {
  font-size: clamp(1.1rem, 1.6vw, 1.34rem); line-height: 1.45;
  color: var(--ink); max-width: 38rem; margin-bottom: 1.5rem;
}


section { margin-top: clamp(2.75rem, 5vw, 4rem); }

h2 {
  font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 1.5rem;
  padding-bottom: .6rem; border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.06rem; font-weight: 650; color: var(--ink); margin: 0 0 .5rem; line-height: 1.3; }

/* research: two-up on wide screens, real prose in each */
.grid-2 { display: grid; gap: 2rem clamp(2rem, 4vw, 3.5rem); grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.grid-2 > div > p { font-size: .96rem; }

/* work + news side by side */
.split { display: grid; gap: clamp(2.5rem, 4vw, 4rem); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 75rem) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.split > section { margin-top: 0; }

/* publications */
.pub { padding: .75rem 0; border-top: 1px solid var(--rule); }
.pub:first-of-type { border-top: 0; padding-top: 0; }
.pub .t { color: var(--ink); font-weight: 550; display: block; margin-bottom: .1rem; line-height: 1.35; }
.pub .meta { font-size: .85rem; color: var(--muted); }
.pub .meta em { font-style: italic; }
.pub .role {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin-right: .4rem;
}

/* news */
.news { margin: 0; }
.news div { padding: .6rem 0; border-top: 1px solid var(--rule); }
.news div:first-child { border-top: 0; padding-top: 0; }
.news dt { color: var(--faint); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.news dd { margin: .1rem 0 0; font-size: .92rem; }

.note { font-size: .85rem; color: var(--muted); margin-top: 1rem; }

footer {
  max-width: 1480px; margin: 4rem auto 0;
  padding: 1.35rem clamp(1.25rem, 4vw, 4rem) 3rem;
  border-top: 1px solid var(--rule);
  font-size: .84rem; color: var(--muted);
}
footer a { color: var(--muted); }

/* ============ theme toggle ============ */
.rail ul.links button.theme-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  font: inherit; font-size: .84rem; color: var(--body); cursor: pointer;
  background: none; border: 1px solid var(--rule); border-radius: 3px; padding: .22rem .6rem;
}
.rail ul.links button.theme-toggle:hover { border-color: var(--muted); color: var(--ink); }
.theme-toggle svg { width: .85rem; height: .85rem; flex: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .i-sun { display: none; }

/* ============ event display (click to load) ============ */
.ed { margin: 0; }
.ed-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border: 1px solid var(--rule); border-radius: 4px;
  overflow: hidden; background: #000;
}
.ed-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain;            /* poster is 1.11:1 inside a 16:9 frame */
  display: block;
}
.ed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.ed-frame.is-live .ed-poster { display: none; }

.ed-play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  background: rgba(4, 6, 12, 0.34); border: 0; cursor: pointer;
  font: inherit; color: #fff; transition: background .15s ease;
}
.ed-play:hover, .ed-play:focus-visible { background: rgba(4, 6, 12, 0.18); }
.ed-play-inner {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .95rem; font-weight: 600;
  background: rgba(10, 14, 24, .82); border: 1px solid rgba(255,255,255,.28);
  border-radius: 2rem; padding: .55rem 1.15rem;
  backdrop-filter: blur(3px);
}
.ed-play-inner svg { width: 1.05rem; height: 1.05rem; }
.ed-play-note { font-size: .78rem; color: rgba(255,255,255,.72); }
@media (prefers-reduced-motion: reduce) { .ed-play { transition: none; } }

.ed figcaption { font-size: .88rem; color: var(--body); line-height: 1.55; margin-top: .75rem; max-width: 62ch; }
.ed figcaption b { color: var(--ink); font-weight: 600; }
.ed .credit { display: block; margin-top: .4rem; font-size: .8rem; color: var(--muted); }

.pub .meta b { color: var(--body); font-weight: 650; }
.split > section > p { max-width: 62ch; }
