/* ==========================================================================
   MisinfoAgents · AAAI-27 tutorial site
   Colors are tokens on :root; dark mode redefines them below.
   ========================================================================== */

:root {
  /* Neutrals: slate, to match the dark header */
  --paper: #ffffff;
  --paper-alt: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --rule: #e2e8f0;

  /* Tutorial parts: berry, indigo, deep cyan — jewel tones that sit well on slate */
  --p1: #a8327a;         /* Part I · Generation */
  --p2: #4354cf;         /* Part II · Propagation */
  --p3: #0a7183;         /* Part III · Intervention */
  --p1-tint: #f6eaf2;
  --p2-tint: #eceefa;
  --p3-tint: #e6f1f3;

  --accent: #4f46e5;
  --focus: #4f46e5;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px -14px rgb(15 23 42 / 0.18);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 6px;
  --maxw: 1120px;
  --narrow: 780px;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f172a;
    --paper-alt: #131c31;
    --card: #1e293b;
    --ink: #e2e8f0;
    --ink-soft: #cbd5e1;
    --muted: #94a3b8;
    --rule: #334155;

    --p1: #ec8cc6;
    --p2: #8e9cf7;
    --p3: #5cc6d6;
    --p1-tint: #322a43;
    --p2-tint: #232c4b;
    --p3-tint: #1b3346;

    --accent: #a5b4fc;
    --focus: #a5b4fc;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -14px rgb(0 0 0 / 0.6);
  }
}

/* ---------- Language ----------
   Each string sits next to its translation: data-l="en" / data-l="zh".
   English is the default; html.zh (set by ?lang=zh or the nav button) shows Chinese. */
html:not(.zh) [data-l="zh"], html.zh [data-l="en"] { display: none !important; }
html.zh {
  --sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Newsreader", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", serif;
}
html.zh .prose p, html.zh .questions li, html.zh .person p, html.zh .part li,
html.zh .part-note, html.zh .audience p { line-height: 1.8; }
/* Chinese glyphs read larger than Latin at the same size; a smaller h2 also leaves
   room so each comma-separated phrase of a heading fits on its own line */
html.zh h2 { letter-spacing: 0; font-size: clamp(1.5rem, 2.9vw, 2.05rem); }
.nw { display: inline-block; }  /* keep a Chinese phrase together when the heading wraps */
html.zh .break-row td { font-style: normal; }  /* no synthetic italics for Chinese */
html.zh .role { text-spacing-trim: trim-start; }  /* no gap before a full-width "（" that starts a line */
html.zh .nav-logo-meta { letter-spacing: 0.04em; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-family: var(--serif); font-size: clamp(1.75rem, 3.4vw, 2.2rem); line-height: 1.2; margin-bottom: 24px; text-wrap: balance; }
h3 { font-size: 1.05rem; line-height: 1.35; }
p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.container.narrow { max-width: var(--narrow); }
.muted { color: var(--muted); }

/* ---------- Nav + Hero ----------
   Dark header styled after the NeurIPS 2025 Human-AI Alignment tutorial page:
   slate-900 → slate-800 gradient, Inter, indigo accents, amber links, glass cards. */
.site-nav, .hero, .cta, .site-footer {
  --h-bg-0: #0f172a;            /* slate-900 */
  --h-bg-1: #1e293b;            /* slate-800 */
  --h-text: #e5e7eb;            /* gray-200 */
  --h-text-soft: #d1d5db;       /* gray-300 */
  --h-white: #ffffff;
  --h-indigo-300: #a5b4fc;
  --h-indigo-400: #818cf8;
  --h-amber: #fecc66;
  --h-slate-600: #475569;
  --h-card: rgb(30 41 59 / 0.5);
  --h-card-hover: rgb(51 65 85 / 0.7);
  --h-card-border: rgb(51 65 85 / 0.7);
  font-family: "Inter", var(--sans);
  -webkit-font-smoothing: antialiased;
}
.site-nav .container, .hero .container { max-width: 72rem; padding: 0 16px; }
.site-nav :focus-visible, .hero :focus-visible { outline-color: var(--h-indigo-300); }

.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--h-bg-0);
  border-bottom: 1px solid var(--h-card-border);
}
/* AAAI-27 logo + full conference name on the left, links on the right */
.nav-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.nav-logo {
  flex: none; margin-right: auto; display: flex; align-items: center; gap: 10px;
  color: var(--h-white); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.nav-logo:hover { color: var(--h-indigo-300); }
.nav-logo img { display: block; height: 30px; width: auto; }
.nav-logo-text { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; line-height: 1.25; }
.nav-logo-meta {
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--h-text-soft);
}
.nav-logo:hover .nav-logo-meta { color: var(--h-indigo-300); }
.nav-links { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 6px 10px; font-size: 0.9rem; color: var(--h-text-soft);
  text-decoration: none; border-radius: 6px; transition: color .2s, background-color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--h-white); background: var(--h-card-hover); }
.nav-lang {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border: 1px solid var(--h-slate-600); border-radius: 999px;
  background: transparent; color: var(--h-text); cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 500; line-height: 1.2;
  transition: border-color .2s, color .2s;
}
.nav-lang:hover { color: var(--h-white); border-color: var(--h-indigo-300); }
.nav-lang svg { display: block; width: 15px; height: 15px; }
.nav-toggle {
  display: none; background: none; border: 0; padding: 10px; cursor: pointer;
  flex-direction: column; gap: 4px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--h-text); border-radius: 1px; }

.hero {
  /* Montréal skyline under a dark slate scrim so white text stays legible */
  --h-scrim: linear-gradient(180deg, rgb(15 23 42 / 0.72) 0%, rgb(15 23 42 / 0.5) 45%, rgb(15 23 42 / 0.8) 100%);
  color: var(--h-text);
  background-color: var(--h-bg-0);
  background-image: var(--h-scrim), url("../assets/img/hero-montreal.jpg");
  background-size: cover;
  background-position: center 55%;
  padding: 36px 0 80px;
  /* Fill the first screen below the 60px nav (+1px border); extra room shows more of the photo */
  min-height: calc(100vh - 61px);
  min-height: calc(100svh - 61px);
}
.hero h1, .hero h3 { letter-spacing: normal; }
.hero-venue, .hero h1 { text-shadow: 0 2px 14px rgb(15 23 42 / 0.45); }

.hero-head { text-align: center; margin-bottom: 80px; }
.hero-venue {
  display: block; font-size: 1.875rem; line-height: 2.25rem; font-weight: 600; letter-spacing: 0.025em;
  color: var(--h-indigo-300); text-decoration: none; transition: color .2s;
}
.hero-venue:hover { color: var(--h-white); }
.hero-venue .sep { margin: 0 0.35em; opacity: 0.55; font-weight: 400; }
.hero h1 {
  margin-top: 12px; font-family: "Inter", var(--sans); font-weight: 800;
  font-size: clamp(1.875rem, 3.9vw, 2.75rem); line-height: 1.25; color: var(--h-white);
}
.hero h1 .t { display: block; white-space: nowrap; }
html.zh .hero h1 { letter-spacing: 0.02em; }

.speaker, .detail {
  background-color: var(--h-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--h-card-border);
  border-radius: 12px; padding: 24px;
}
.speakers {
  list-style: none; margin: 0 0 80px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.speaker {
  height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center;
  text-decoration: none; transition: transform .3s, background-color .3s;
}
.speaker:hover { color: inherit; transform: scale(1.05); background-color: var(--h-card-hover); }
.speaker img {
  width: 128px; height: 128px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--h-slate-600); margin-bottom: 16px;
}
.speaker h3 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; color: var(--h-white); margin-bottom: 4px; }
.speaker p { margin: 0; font-size: 0.875rem; line-height: 1.25rem; color: var(--h-indigo-300); }

.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.detail { display: flex; align-items: center; gap: 16px; }
.detail svg { width: 32px; height: 32px; flex-shrink: 0; color: var(--h-indigo-400); }
.detail h3 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; color: var(--h-white); }
.detail p { margin: 0; font-size: 1rem; line-height: 1.5rem; color: var(--h-text-soft); }

/* Same breakpoints as the reference (Tailwind lg / md / sm) */
@media (max-width: 1023px) {
  .speakers { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .hero { padding: 28px 0 48px; background-image: var(--h-scrim), url("../assets/img/hero-montreal-sm.jpg"); }
  .hero-head, .speakers { margin-bottom: 64px; }
  .hero-venue { font-size: 1rem; line-height: 1.5rem; }
  .hero h1 { font-size: 1.75rem; text-wrap: balance; }
  .hero h1 .t { display: inline; white-space: normal; }
  html.zh .hero h1 .t { display: block; }
  .details { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .speakers { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .speaker { transition: none; } .speaker:hover { transform: none; } }

/* ---------- Sections ---------- */
.block { padding: 60px 0; }
.block.alt { background: var(--paper-alt); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section-label {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.section-label::before { content: ""; width: 22px; height: 2px; background: var(--accent); }

.prose p { color: var(--ink-soft); }
.prose em { font-style: normal; font-weight: 600; color: var(--ink); }

.questions { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.questions li {
  padding: 2px 0 2px 18px; border-left: 3px solid var(--c);
  color: var(--ink-soft);
}
.q-1 { --c: var(--p1); }
.q-2 { --c: var(--p2); }
.q-3 { --c: var(--p3); }

.audience { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 36px; }
.audience > div { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.audience h3 { margin-bottom: 8px; }
.audience p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Outline */
.parts { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: none; }
.part {
  --c: var(--p1); --tint: var(--p1-tint);
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 35%, var(--card))) top / 100% 4px no-repeat, var(--card);
  border: 1px solid var(--rule); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 26px 24px 24px; display: flex; flex-direction: column;
}
.part-2 { --c: var(--p2); --tint: var(--p2-tint); }
.part-3 { --c: var(--p3); --tint: var(--p3-tint); }
.part-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.part-num { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--c); letter-spacing: 0.06em; text-transform: uppercase; }
.part-time { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }
.part h3 { font-family: var(--serif); font-size: 1.4rem; line-height: 1.2; margin-bottom: 14px; }
.part ul { list-style: none; padding: 0; margin: 0 0 16px; }
.part li { position: relative; padding: 7px 0 7px 18px; border-top: 1px solid var(--rule); font-size: 0.95rem; }
.part li::before { content: ""; position: absolute; left: 0; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.part-note { margin: auto 0 0; font-size: 0.9rem; color: var(--muted); }

/* Schedule */
/* Program: left-aligned like the other sections; table sized to its content */
.schedule { width: auto; min-width: min(100%, 600px); margin-top: 16px; border-collapse: collapse; font-size: 0.96rem; text-align: left; }
.schedule th {
  text-align: left; font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  padding: 0 12px 10px 0; border-bottom: 2px solid var(--ink);
}
.schedule td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.schedule td.t { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.schedule td.t, .schedule th:first-child { padding-right: 40px; }
.schedule .len { text-align: right; padding-left: 40px; padding-right: 0; white-space: nowrap; }
.schedule td.len { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.break-row td { color: var(--muted); font-style: italic; background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--paper-alt) 6px 12px); }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 3px; margin-right: 8px;
  vertical-align: 2px; white-space: nowrap;
}
.tag { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.tag-1 { background: var(--p1-tint); color: var(--p1); }
.tag-2 { background: var(--p2-tint); color: var(--p2); }
.tag-3 { background: var(--p3-tint); color: var(--p3); }

/* Organizers */
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.person {
  display: grid; grid-template-columns: 96px 1fr; gap: 20px; align-items: start;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
}
.person img, .avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.avatar {
  display: grid; place-items: center; background: var(--paper-alt); border: 1px solid var(--rule);
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--muted);
}
.person h3 { font-family: var(--serif); font-size: 1.3rem; }
.person h3 a { text-decoration: none; }
.person h3 a:hover { color: var(--accent); text-decoration: underline; }
.person h3 .name-en { margin-left: 6px; font-family: var(--sans); font-size: 0.68em; font-weight: 500; color: var(--muted); }
.person .role { font-size: 0.88rem; color: var(--accent); margin: 2px 0 10px; font-weight: 500; }
.person p:last-child { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }

/* Reading list */
.rl-head { margin: 40px 0 6px; font-size: 1.1rem; }
.refs { margin: 0; padding: 0 0 0 1.6em; }
.refs li { padding: 10px 0 10px 6px; border-bottom: 1px solid var(--rule); font-size: 0.93rem; color: var(--ink-soft); }
.refs li::marker { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.refs cite { display: block; margin-bottom: 3px; font-style: normal; font-weight: 500; color: var(--ink); }
.refs .venue { color: var(--muted); font-style: italic; }
.authors-toggle {
  margin-left: 2px; padding: 0 8px; cursor: pointer;
  font: inherit; font-size: 0.8rem; line-height: 1.6; color: var(--p3);
  background: none; border: 1px solid var(--rule); border-radius: 999px;
}
.authors-toggle:hover { border-color: var(--p3); }

/* Materials */
.materials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.mat { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.mat h3 { margin-bottom: 6px; }
.mat p { font-size: 0.9rem; color: var(--muted); }
.status {
  margin-top: auto; align-self: flex-start; font-family: var(--mono); font-size: 0.74rem;
  padding: 3px 8px; border-radius: 3px; border: 1px dashed var(--rule); color: var(--muted);
}
.status-live { border-style: solid; border-color: var(--p3); color: var(--p3); text-decoration: none; }
.status-live:hover { background: var(--p3); color: var(--paper); }

.cite-head { margin: 48px 0 12px; }
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; padding: 20px 22px; overflow-x: auto;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.6; color: var(--ink-soft);
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; cursor: pointer;
  font-family: var(--mono); font-size: 0.74rem; padding: 4px 10px; border-radius: 4px;
  background: var(--paper-alt); color: var(--ink); border: 1px solid var(--rule);
}
.copy-btn:hover { border-color: var(--ink); }

/* Footer */
/* Call to action (styled after the reference tutorial page) */
.cta {
  text-align: center; color: var(--h-text);
  background-color: var(--h-bg-0);
  background-image:
    radial-gradient(ellipse 55% 90% at 50% 0%, rgb(99 102 241 / 0.20), transparent 70%),
    linear-gradient(145deg, var(--h-bg-0) 0%, var(--h-bg-1) 100%);
  padding: 72px 0;
}
.cta h2 {
  margin: 0 0 20px; font-family: "Inter", var(--sans); font-weight: 700;
  font-size: 1.875rem; line-height: 2.25rem; letter-spacing: normal; color: var(--h-white);
}
.cta p { max-width: 42rem; margin: 0 auto 32px; font-size: 1.125rem; line-height: 1.75rem; color: var(--h-text-soft); }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 16px; }
.cta-btn {
  display: inline-block; padding: 12px 32px; border-radius: 8px; border: 1px solid transparent;
  font-size: 1.125rem; font-weight: 600; text-decoration: none;
  transition: background-color .3s, border-color .3s, color .3s, transform .3s;
}
.cta-btn-primary {
  background: #4f46e5; color: var(--h-white);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}
.cta-btn-primary:hover { background: #6366f1; color: var(--h-white); transform: translateY(-2px); }
.cta-btn-ghost { color: var(--h-text); border-color: var(--h-slate-600); }
.cta-btn-ghost:hover { color: var(--h-white); border-color: var(--h-indigo-300); transform: translateY(-2px); }
.cta :focus-visible, .site-footer :focus-visible { outline-color: var(--h-indigo-300); }
@media (prefers-reduced-motion: reduce) { .cta-btn:hover { transform: none; } }

/* Footer: continues the dark CTA band */
.site-footer {
  padding: 32px 0; font-size: 0.9rem; color: #9ca3af;
  background: var(--h-bg-1); border-top: 1px solid var(--h-card-border);
}
.site-footer a { color: var(--h-indigo-300); text-decoration-color: currentColor; }
.site-footer a:hover { color: var(--h-white); }
.site-footer .muted { color: #9ca3af; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-inner p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .parts { grid-template-columns: 1fr; }
  .people { grid-template-columns: 1fr; }
}

/* Full name + links + language button need ~1095px (English) / ~912px (Chinese);
   below that show the AAAI-27 mark only */
@media (max-width: 1139px) and (min-width: 761px) {
  html:not(.zh) .nav-logo-text { display: none; }
}
@media (max-width: 959px) and (min-width: 761px) {
  html.zh .nav-logo-text { display: none; }
}

@media (max-width: 374px) {
  .nav-logo { font-size: 0.72rem; }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .nav-toggle { display: flex; }
  .nav-inner { gap: 8px; height: auto; min-height: 60px; padding-top: 6px; padding-bottom: 6px; }
  .nav-logo { flex: 1 1 auto; min-width: 0; gap: 8px; font-size: 0.8rem; }
  .nav-logo-text { white-space: normal; line-height: 1.25; }
  .nav-logo-meta { display: none; }
  .nav-lang { padding: 4px 8px; }
  .nav-lang svg { display: none; }
  .nav-toggle { padding: 8px; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: #0f172a; border-bottom: 1px solid rgb(51 65 85 / 0.7);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 8px; }
  .block { padding: 44px 0; }
  .cta { padding: 56px 0; }
  .cta h2 { font-size: 1.5rem; line-height: 2rem; }
  .schedule td.t, .schedule th:first-child { padding-right: 14px; }
  .schedule .len { padding-left: 14px; }
  .audience, .materials { grid-template-columns: 1fr; }
  .person { grid-template-columns: 64px 1fr; gap: 16px; padding: 18px; }
  .person img, .avatar { width: 64px; height: 64px; font-size: 1.2rem; }
}
