/*
  UCL AI Safety Society — styles
  Design inspirations: LessWrong (clean typography), Lighthaven (warm gradients), Gwern (scholarly clarity)
*/

:root {
  --bg: #0b0e10;
  --bg-soft: #0f1317;
  --elev: #12171c;
  --text: #e6ebef;
  --text-dim: #a9b4bf;
  --muted: #6c7a89;
  --brand: #74d2ff;
  --brand-2: #b7f0ff;
  --accent: #ffe08a;
  --ok: #7be495;
  --warn: #ffd166;
  --danger: #ff6b6b;
  --ring: rgba(116, 210, 255, 0.5);
  --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.25);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --max: 1120px;
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f7f9fb;
  --elev: #ffffff;
  --text: #121417;
  --text-dim: #4a5562;
  --muted: #7a8694;
  --brand: #0077ff;
  --brand-2: #5ab1ff;
  --accent: #ffb800;
  --ring: rgba(0, 119, 255, 0.3);
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 10px 30px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1.6;
}

.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus { left: 1rem; top: 1rem; width: auto; height: auto; z-index: 1000; background: var(--elev); color: var(--text); padding: .5rem .75rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); }

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 92%, black);
  backdrop-filter: saturate(120%) blur(12px);
  border-bottom: 1px solid color-mix(in oklab, var(--bg) 84%, white);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: 0.2px; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: radial-gradient(120% 120% at 30% 30%, var(--brand-2), var(--brand)); color: #001018; font-weight: 700; }
.brand-text { font-variant-ligatures: none; }

.nav-toggle { display: none; }
.nav-list { list-style: none; display: flex; gap: .75rem; padding: 0; margin: 0; align-items: center; }
.nav a { color: var(--text); text-decoration: none; padding: .5rem .7rem; border-radius: 10px; }
.nav a:hover { background: color-mix(in oklab, var(--bg) 84%, white); }
.nav a.cta { background: linear-gradient(180deg, var(--brand), var(--brand-2)); color: #031521; font-weight: 700; }

.theme-toggle { background: transparent; border: 1px solid color-mix(in oklab, var(--bg) 80%, white); color: var(--text); border-radius: 10px; cursor: pointer; transition: transform .2s ease, border-color .2s ease; 
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; line-height: 1; font-size: 1.05rem;
}
.theme-toggle:hover { border-color: var(--brand); }
.theme-toggle:active { transform: rotate(-20deg) scale(0.95); }

/* Hero */
.hero { position: relative; overflow: clip; border-bottom: 1px solid color-mix(in oklab, var(--bg) 82%, white); }
.hero-inner { padding: 6rem 0 4rem; padding-inline: .25rem; }
.hero h1 { font-family: "Source Serif 4", ui-serif, Georgia, serif; font-size: clamp(2rem, 3.4vw + 1rem, 3.2rem); line-height: 1.1; margin: 0 0 1rem; letter-spacing: -0.01em; }
.hero-lede { max-width: 64ch; color: var(--text-dim); font-size: 1.1rem; margin: 0 0 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-gradient { position: absolute; inset: -20% -10% auto -10%; height: 420px; z-index: -1; filter: blur(40px) saturate(140%);
  background: radial-gradient(50% 70% at 20% 40%, color-mix(in oklab, var(--brand) 70%, transparent), transparent 60%),
              radial-gradient(40% 60% at 80% 20%, color-mix(in oklab, var(--accent) 55%, transparent), transparent 60%),
              radial-gradient(45% 60% at 60% 70%, color-mix(in oklab, var(--brand-2) 50%, transparent), transparent 60%);
}

/* Sections */
.section { padding: 4rem 0; scroll-margin-top: 80px; }
.section-title { font-family: "Source Serif 4", ui-serif, Georgia, serif; font-size: 1.9rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
.section-sub { margin: .25rem 0 2rem; color: var(--text-dim); }

.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .header-inner { height: auto; padding: .75rem 0; flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; }
}

/* Cards, prose */
.card { background: var(--elev); border: 1px solid color-mix(in oklab, var(--bg) 78%, white); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card-title { margin: 0 0 .5rem; font-weight: 700; }
.card .meta { color: var(--muted); font-size: .9rem; }
.card-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.cards { display: grid; gap: 1rem; }
.event .clamp { display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.prose h3 { margin: .2rem 0 .5rem; font-size: 1.1rem; }
.prose p { margin: 0 0 1rem; }
.prose ul { margin: .5rem 0 1rem 1.2rem; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding-left: 1.4rem; margin: .4rem 0; }
.checklist li::before { content: "✔"; position: absolute; left: 0; color: var(--ok); }

.bullet { padding-left: 1.2rem; }

.links { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.links a[aria-disabled="true"] { opacity: .65; pointer-events: none; }
.dim { opacity: .65; pointer-events: none; }

/* Buttons */
.btn { --btn-bg: color-mix(in oklab, var(--bg) 70%, white); --btn-fg: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none; color: var(--btn-fg); background: var(--btn-bg); border: 1px solid color-mix(in oklab, var(--bg) 75%, white); border-radius: 999px; padding: .6rem .95rem; font-weight: 600; box-shadow: var(--shadow); }
.btn:hover { border-color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 10px 28px rgba(0,0,0,0.18); }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn.primary { --btn-bg: linear-gradient(180deg, var(--brand), var(--brand-2)); color: #031521; }
.btn.ghost { background: transparent; }
.btn.small { padding: .4rem .7rem; font-size: .9rem; }
.btn.whatsapp { --btn-bg: linear-gradient(180deg, #22c55e, #16a34a); color: #072b18; }
.btn.whatsapp:hover { border-color: #22c55e; }

/* Form frame */
.form-frame { padding: 1rem; }
.form-frame .help { margin: .6rem 0 0; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid color-mix(in oklab, var(--bg) 82%, white); background: color-mix(in oklab, var(--bg) 96%, black); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 2rem 0; }
.foot-links { list-style: none; display: flex; gap: .75rem; margin: 0; padding: 0; }
.foot-links a { color: var(--text-dim); text-decoration: none; }
.foot-links a:hover { color: var(--text); }
.foot-brand { display: flex; align-items: center; gap: .5rem; color: var(--text-dim); }

/* Utilities */
.more { margin-top: 1rem; }
.tiny { font-size: .85rem; }

/* Mobile nav */
@media (max-width: 700px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; color: var(--text); background: transparent; border: 1px solid color-mix(in oklab, var(--bg) 80%, white); padding: .4rem .6rem; border-radius: 8px; }
  .nav-list { display: none; width: 100%; margin-top: .5rem; }
  .nav-list.open { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

  /* Mobile refinements */
  .container { padding: 0 1rem; }
  .hero-inner { padding: 4rem 0 3rem; }
  .hero-inner { padding-inline: .35rem; }
  .hero h1 { font-size: clamp(1.75rem, 6.2vw + 0.5rem, 2.3rem); }
  .hero-lede { font-size: 1rem; }
  .hero-gradient { height: 300px; inset: -12% -25% auto -25%; filter: blur(36px) saturate(130%); }
  .hero-actions { flex-direction: column; gap: .6rem; }
  .hero-actions .btn { width: 100%; }
  .section { padding: 3rem 0; }
  .card { padding: .9rem; border-radius: 12px; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
}

@media (max-width: 480px) {
  .brand-text { font-size: .95rem; }
  .section-title { font-size: 1.6rem; }
  .prose h3 { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .theme-toggle, .btn { transition: none; }
}
