/* christiancalle.com: one stylesheet for every page.
   Colors take a cue from obangsaek, the five traditional Korean colors:
   blue, red and yellow on white and ink. */

:root {
  --paper: #f7f8fb;
  --surface: #ffffff;
  --ink: #18202e;
  --muted: #566073;
  --line: #dde2ec;
  --blue: #2f55d4;
  --red: #d33a3a;
  --yellow: #f2c200;
  --on-accent: #ffffff;
  --shadow-blue: #2f55d4;
  --shadow-red: #d33a3a;
  --shadow-yellow: #f2c200;
  --radius: 10px;
  --wrap: 1080px;
  --measure: 66ch;
  --head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121826;
    --surface: #1a2234;
    --ink: #e9edf5;
    --muted: #a5afc2;
    --line: #2c3650;
    --blue: #8ba5ff;
    --red: #ff7a7a;
    --yellow: #ffd84d;
    --on-accent: #121826;
    --shadow-blue: #3f63de;
    --shadow-red: #c23b3b;
    --shadow-yellow: #c9a300;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121826;
  --surface: #1a2234;
  --ink: #e9edf5;
  --muted: #a5afc2;
  --line: #2c3650;
  --blue: #8ba5ff;
  --red: #ff7a7a;
  --yellow: #ffd84d;
  --on-accent: #121826;
  --shadow-blue: #3f63de;
  --shadow-red: #c23b3b;
  --shadow-yellow: #c9a300;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--body);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 {
  font-family: var(--head);
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }

p { margin: 0 0 1em; max-width: var(--measure); }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }

.skip {
  position: absolute; left: 16px; top: -60px;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px;
  z-index: 10;
}
.skip:focus { top: 12px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-block: 18px;
}
.wordmark {
  font: 800 1.25rem/1 var(--head); letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 700;
}
.site-nav a:hover { background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -3px 0 var(--blue); border-radius: 8px 8px 0 0; }

main { display: block; }

section { padding-block: clamp(48px, 8vw, 88px); }
section + section { border-top: 1px solid var(--line); }

.lede { font-size: 1.3rem; line-height: 1.45; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 0.95rem; }

/* The hard offset shadow: the site's one bold device, used on the
   portrait and the game screens. */
.tile-img {
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--shadow-blue);
  background: #000;
}
.tone-red .tile-img { box-shadow: 8px 8px 0 var(--shadow-red); }
.tone-yellow .tile-img { box-shadow: 8px 8px 0 var(--shadow-yellow); }

/* Hero */
.hero { padding-block: clamp(40px, 7vw, 80px); }
.hero .wrap {
  display: grid; gap: clamp(28px, 5vw, 64px);
  grid-template-columns: minmax(0, 1fr) minmax(180px, 300px);
  align-items: center;
}
.hero .tile-img { aspect-ratio: 1; object-fit: cover; width: 100%; }
@media (max-width: 720px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero figure { order: -1; max-width: 200px; }
}
figure { margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px; border: 2px solid var(--blue);
  font: 700 1rem/1.2 var(--body); text-decoration: none; cursor: pointer;
  background: var(--blue); color: var(--on-accent);
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--blue); }
.btn.play { background: var(--red); border-color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* Now: two side-by-side items */
.pair { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.pair > div { padding-top: 16px; border-top: 4px solid var(--blue); }
.pair > div:nth-child(2) { border-top-color: var(--red); }

/* Timeline (a real sequence, so years lead each row) */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.timeline > li {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 4px 24px;
  padding-block: 18px; border-bottom: 1px solid var(--line);
}
.timeline > li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline h3 { margin-bottom: 0.25em; }
.timeline p { margin-bottom: 0; }
.timeline ul { margin: 0.5em 0 0; padding-left: 1.2em; max-width: var(--measure); }
.timeline ul li { margin-bottom: 0.25em; }
@media (max-width: 560px) { .timeline > li { grid-template-columns: 1fr; } }

/* Feature rows on the Work page */
.feature {
  display: grid; gap: clamp(20px, 4vw, 48px); align-items: start;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  padding-block: 32px;
}
.feature + .feature { border-top: 1px solid var(--line); }
.feature img { border-radius: var(--radius); }
.feature .tools { color: var(--muted); font-size: 0.95rem; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } }

.photo-pair { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 20px; }
.photo-pair img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
figcaption { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }

/* Workbook pages: thumbnails that open larger */
.pages { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin-top: 20px; }
.pages button {
  padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: var(--surface); cursor: zoom-in;
}
.pages img { width: 100%; aspect-ratio: 300 / 425; object-fit: cover; }
dialog.viewer {
  border: 0; padding: 0; background: transparent; max-width: min(560px, 92vw);
}
dialog.viewer::backdrop { background: rgb(10 14 24 / 0.82); }
dialog.viewer img { max-height: 86vh; width: auto; margin-inline: auto; border-radius: 6px; }
dialog.viewer .close {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: var(--surface); color: var(--ink);
  font-size: 1.4rem; cursor: pointer;
}

/* Games shelf */
.shelf { display: grid; gap: clamp(32px, 5vw, 48px) 32px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.game { display: flex; flex-direction: column; }
.game .tile-img { aspect-ratio: 3 / 2; object-fit: cover; object-position: top; width: 100%; margin-bottom: 18px; }
.game h3 { margin-bottom: 0.2em; }
.game .made { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.6em; }
.game p:not(.made) { flex: 1; }
.game .btn { align-self: flex-start; }
.game .retired { color: var(--muted); font-weight: 700; }

.note {
  max-width: var(--measure); padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}

/* Play page */
.stage { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: 8px 8px 0 var(--shadow-red); }
.stage iframe, .stage embed, .stage ruffle-embed, .stage ruffle-player { display: block; width: 100%; border: 0; }
.stage.wide { max-width: max(320px, calc((100vh - 200px) * 2)); margin-inline: auto; }
.stage.wide iframe { aspect-ratio: 2 / 1; }
.stage.flash { max-width: max(320px, calc((100vh - 200px) * 1.5)); margin-inline: auto; }
.stage.flash > * { aspect-ratio: 3 / 2; width: 100%; height: auto; }
.stage.unity { overflow: auto; }
.stage.unity iframe { width: 800px; height: 660px; margin-inline: auto; }
.stage.course iframe { aspect-ratio: 16 / 10; }
.play-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.play-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); padding-block: 32px 48px; color: var(--muted); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-foot ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; flex-wrap: wrap; }
.theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
