/* OWIS ECA proposal site.
   Palette and type follow "Art From Code" (Rudy's programmer-art page):
   night-indigo ink, paper, and four bright accents, plus violet for Game Studio. */

:root {
  color-scheme: light dark;
  --paper: #f1f2f7;
  --surface: #ffffff;
  --ink: #1b1d36;
  --muted: #595d7a;
  --line: #d8dae6;
  --blue: #2e3cc4;
  --pink: #cf356b;
  --sun: #e9a526;
  --mint: #2f9d86;
  --violet: #7046c9;
  --red: #c8102e;
  --accent: var(--blue);

  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2rem;
  --step-4: clamp(2.25rem, 1.4rem + 3.6vw, 3.5rem);

  --radius: 0.875rem;
  --radius-sm: 0.5rem;
  --shadow: 0 1px 2px rgb(27 29 54 / 0.06), 0 8px 24px rgb(27 29 54 / 0.08);
  --space-section: clamp(2.5rem, 2rem + 2vw, 4rem);
  --measure: 68ch;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13142a;
    --surface: #1c1e38;
    --ink: #e8e9f6;
    --muted: #a4a8c6;
    --line: #34375c;
    --blue: #97a3ff;
    --pink: #ff7fa9;
    --sun: #f5c35a;
    --mint: #5fd1b6;
    --violet: #c3a6ff;
    --red: #ff6b6b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

.accent-blue   { --accent: var(--blue); }
.accent-pink   { --accent: var(--pink); }
.accent-sun    { --accent: var(--sun); }
.accent-mint   { --accent: var(--mint); }
.accent-violet { --accent: var(--violet); }
.accent-red    { --accent: var(--red); }
.accent-ink    { --accent: var(--ink); }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}

a { color: var(--blue); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

/* ── Header and navigation ─────────────────────────────────────────────── */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { margin: 0; font-family: var(--font-display); font-weight: 800; }
.brand a { color: var(--ink); text-decoration: none; }
.nav-list { display: flex; flex-wrap: wrap; gap: 0.375rem; list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--step--1);
  text-decoration: none;
  transition: border-color 150ms, background-color 150ms;
}
.nav-link:hover { border-color: var(--accent); }
.nav-link[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: var(--accent);
  font-weight: 700;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: var(--space-section) clamp(1rem, 4vw, 3rem) calc(var(--space-section) * 0.75);
  max-width: 78rem;
  margin: 0 auto;
}
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: -0.05rem;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; }
h1 { margin: 0 0 1rem; font-size: var(--step-4); font-weight: 800; letter-spacing: -0.02em; }
.lead { margin: 0 0 1.25rem; font-size: var(--step-1); color: var(--muted); max-width: 40ch; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.chips li {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  font-size: var(--step--1);
}
.download { margin: 0; font-size: var(--step--1); }

/* ── Generated art ─────────────────────────────────────────────────────── */
.art {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.art canvas { display: block; width: 100%; aspect-ratio: 16 / 9; }
.art-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0.875rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--step--1);
}
.redraw, .art-btn {
  flex: none;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms;
}
.redraw:hover, .art-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.redraw:active, .art-btn:active { transform: translateY(1px); }

/* Live game (assets/breakout.js): Pause/Play and a sound toggle that starts off */
.art-controls { display: flex; flex: none; flex-wrap: wrap; gap: 0.5rem; }
.art-controls[hidden] { display: none; }
.art-btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.art-btn .icon { width: 1.15em; height: 1.15em; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.art-btn[data-sound="on"] { background: var(--accent); color: var(--surface); }
.art-btn[data-sound="on"]:hover { background: color-mix(in srgb, var(--accent) 82%, var(--ink)); }
.art-btn[data-sound="loading"] { cursor: progress; opacity: 0.75; }
.art-btn[data-sound="failed"] { border-style: dashed; color: var(--muted); }
.art-btn[data-sound] span:is(.when-off, .when-loading, .when-on, .when-failed),
.art-btn[data-sound]:not([data-sound="on"]) .icon .when-on,
.art-btn[data-sound="on"] .icon .when-off,
.art-btn[data-playing="true"] .when-paused,
.art-btn[data-playing="false"] .when-playing { display: none; }
.art-btn[data-sound="off"] span.when-off,
.art-btn[data-sound="loading"] span.when-loading,
.art-btn[data-sound="on"] span.when-on,
.art-btn[data-sound="failed"] span.when-failed { display: inline; }

.art--photo img { display: block; width: 100%; height: auto; }

.presenter {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  max-width: 38rem;
}
.presenter img {
  flex: none;
  width: clamp(7rem, 5rem + 6vw, 10rem);
  height: clamp(7rem, 5rem + 6vw, 10rem);
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}
.presenter p { margin: 0; font-size: var(--step--1); color: var(--muted); }
.presenter strong { color: var(--ink); font-family: var(--font-display); font-size: var(--step-1); }

/* ── Body layout: table of contents + prose ────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, var(--measure));
  gap: clamp(1.5rem, 4vw, 4rem);
  justify-content: center;
  padding: 0 clamp(1rem, 4vw, 3rem) var(--space-section);
}
.toc { position: sticky; top: 1.5rem; align-self: start; font-size: var(--step--1); }
.toc-title { margin: 0 0 0.5rem; font-weight: 700; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.25rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--blue); text-decoration: underline; }

.prose h2 {
  margin: var(--space-section) 0 0.75rem;
  padding-left: 0.875rem;
  border-left: 0.3rem solid var(--accent);
  font-size: var(--step-3);
  scroll-margin-top: 1rem;
}
.prose > h2:first-child, .prose > section:first-child > h2 { margin-top: 0; }
.prose h3 { font-size: var(--step-1); margin: 1.5rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose strong { font-weight: 700; }

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: var(--step--1); }
th, td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper) 60%, var(--surface)); }

/* ── Course cards (overview page) ──────────────────────────────────────── */
.courses { margin-bottom: var(--space-section); }
.courses h2 { margin-top: 0; }
.group-title { margin: 1.5rem 0 0.75rem; font-size: var(--step-1); color: var(--muted); }
.card-grid.card-grid--featured { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.card-grid.card-grid--extra { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.card-grid--extra .card { border-top-width: 0.2rem; }
.card-grid--extra .card h3 { font-size: var(--step-0); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 0 1rem;
  border: 1px solid var(--line);
  border-top: 0.35rem solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card canvas { display: block; width: 100%; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); }
.card-number, .card h3, .card p { margin-inline: 1rem; }
.card-number { margin-top: 0.875rem; color: var(--muted); font-size: var(--step--1); font-weight: 700; }
.card h3 { margin-block: 0.25rem 0.5rem; font-size: var(--step-1); }
.card-hook { margin-block: 0 0.75rem; font-size: var(--step--1); }
.card-meta { margin-block: auto 0; color: var(--muted); font-size: var(--step--1); }
.card--blue   { --accent: var(--blue); }
.card--pink   { --accent: var(--pink); }
.card--sun    { --accent: var(--sun); }
.card--mint   { --accent: var(--mint); }
.card--violet { --accent: var(--violet); }
.card--red    { --accent: var(--red); }

.card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }

/* ── Examples and resources ────────────────────────────────────────────── */
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.example a {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.example img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.example-title { display: block; padding: 0.5rem 0.75rem; font-family: var(--font-display); font-weight: 600; border-top: 3px solid var(--accent); }
.example a:hover .example-title { text-decoration: underline; }
.example p { margin: 0.5rem 0 0; font-size: var(--step--1); color: var(--muted); }
.resource-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.resource-list li { padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); }
.resource-list .note { display: block; color: var(--muted); font-size: var(--step--1); }

/* ── Shipped games strip (overview, About the instructor) ──────────────── */
.shipped { margin: 0 0 1.5rem; }
.shipped figcaption { margin: 0 0 0.75rem; font-family: var(--font-display); font-weight: 600; }
.shipped-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.shipped-grid li { margin: 0; font-size: var(--step--1); }
.shipped-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 0.35rem;
}
.game-title { display: block; font-weight: 700; }
.game-meta { display: block; color: var(--muted); line-height: 1.35; }

/* ── Pager and footer ──────────────────────────────────────────────────── */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--space-section);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.pager a { display: grid; text-decoration: none; font-family: var(--font-display); font-weight: 600; }
.pager a span { color: var(--muted); font-family: var(--font-body); font-size: var(--step--1); font-weight: 400; }
.pager-next { text-align: right; }
.site-footer {
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--step--1);
  text-align: center;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 60rem) {
  .hero { grid-template-columns: 1fr; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem 1rem; background: var(--surface); }
}
@media (max-width: 36rem) {
  .art-bar { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-link, .redraw, .art-btn, .card { transition: none; }
  .card:hover { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .example a { transition: box-shadow 150ms; }
  .example a:hover { box-shadow: var(--shadow); }
}
@media print {
  .site-header, .toc, .art-bar, .pager, .download, .skip { display: none; }
  .hero, .layout { display: block; padding: 0; }
  .card:hover { transform: none; box-shadow: none; }
}
