/*
 * AIRA Playground: one stylesheet for the landing page, the gallery and the 404 page.
 * Tokens follow digistar.club. Spacing is a multiple of 8. No inline styles are used anywhere
 * (CSP style-src 'self'), so every visual state is a class or the `hidden` attribute.
 */
:root {
  --red: #cc1f31;
  --red-dark: #a8192a;
  --navy: #1d2956;
  --orange: #ff6c02;
  --yellow: #fbb026;
  --peach: #ffe0d8;
  --surface: #f5f5f5;
  --card: #ffffff;
  --ink: #282828;
  --muted: #626779;
  --line: #dfe1e8;
  --navy-tint: #e8ebf5;
  --yellow-tint: #fff1cf;
  --r1: 8px;
  --r2: 16px;
  --r3: 24px;
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 48px;
  --s8: 64px;
  --s10: 80px;
  --shadow: 0 1px 2px rgba(29, 41, 86, 0.06), 0 8px 24px rgba(29, 41, 86, 0.06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1120px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--red); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Focus: always visible, 3px navy ring with a white halo so it also works on coloured surfaces. */
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
  border-radius: var(--r1);
}

.skip-link {
  position: absolute;
  left: var(--s2);
  top: -80px;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: var(--s1) var(--s2);
  border-radius: var(--r1);
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.skip-link:focus { top: var(--s1); color: #fff; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s2); }
@media (min-width: 720px) { .wrap { padding-inline: var(--s4); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  min-height: 48px;
  padding: 0 var(--s3);
  border-radius: var(--r1);
  border: 2px solid transparent;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--red-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--small { min-height: 44px; padding: 0 var(--s2); font-size: 0.9375rem; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--light { background: var(--card); color: var(--navy); border-color: var(--line); }
.btn--light:hover { background: var(--navy-tint); color: var(--navy); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Header ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 64px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { height: 32px; width: auto; }
.nav { display: flex; align-items: center; gap: var(--s1); }
.nav a:not(.btn) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s2);
  border-radius: var(--r1);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.nav a:not(.btn):hover { background: var(--navy-tint); color: var(--navy); }
.nav a[aria-current="page"]:not(.btn) { box-shadow: inset 0 -3px 0 var(--red); border-radius: 0; }
@media (max-width: 479px) { .nav__home { display: none !important; } .brand img { height: 28px; } }

/* ---------- Hero ---------- */
.hero { padding-block: var(--s6) var(--s8); position: relative; overflow: hidden; }
.hero__grid { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.15fr 0.85fr; } .hero { padding-block: var(--s10); } }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 32px;
  padding: 0 var(--s2);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.8125rem;
  line-height: 1.2;
}
.chip--line { background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--navy); flex: none; }
.chip--live .chip__dot { background: var(--red); }
.hero h1 { font-size: clamp(2rem, 6.4vw, 3.5rem); margin-top: var(--s3); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--red); }
.lead { font-size: 1.125rem; margin-top: var(--s2); max-width: 36em; color: var(--ink); }
.sub-en { margin-top: var(--s1); color: var(--muted); font-size: 0.9375rem; max-width: 40em; }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.hero__meta { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s1); }

.hero__art { position: relative; display: grid; place-items: center; min-height: 440px; }
.hero__art::before {
  content: "";
  position: absolute;
  width: min(88vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--peach);
}
.hero__art::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 10px solid var(--yellow);
  top: 8px;
  right: 8%;
}
.badge-aira { position: absolute; left: 0; top: 0; width: 88px; height: 88px; border-radius: 50%; box-shadow: var(--shadow); z-index: 2; background: var(--red); }
@media (min-width: 900px) { .badge-aira { left: 8px; top: 8px; width: 104px; height: 104px; } }

.chat {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  box-shadow: var(--shadow);
  padding: var(--s3);
  display: grid;
  gap: var(--s2);
  margin-top: 104px;
}
@media (min-width: 900px) { .chat { margin-top: 120px; } }
.chat__bar { display: flex; align-items: center; gap: var(--s1); font-weight: 700; color: var(--navy); font-size: 0.9375rem; }
.chat__bar span:last-child { color: var(--muted); font-weight: 500; font-size: 0.8125rem; margin-left: auto; }
.chat__dot { width: 10px; height: 10px; border-radius: 50%; background: #1c9a55; }
.bubble { padding: var(--s1) var(--s2); border-radius: var(--r2); font-size: 0.9375rem; line-height: 1.5; max-width: 88%; }
.bubble--me { background: var(--navy); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.bubble--bot { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; background: var(--peach); color: #7a1a00; padding: 1px 6px; border-radius: 6px; }

/* ---------- Sections ---------- */
.section { padding-block: var(--s6); }
.section--card { background: var(--card); border-block: 1px solid var(--line); }
.section__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s4); }
.section__head h2 { font-size: clamp(1.5rem, 4.4vw, 2.25rem); }
.section__head p { color: var(--muted); margin-top: var(--s1); max-width: 40em; }
.eyebrow { color: var(--red); font-weight: 700; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s1); }

.start { display: grid; gap: var(--s4); }
@media (min-width: 900px) { .start { grid-template-columns: 1fr 280px; align-items: start; } }
.steps { display: grid; gap: var(--s2); counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--s2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: var(--s3);
}
.section--card .steps li { background: var(--surface); }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 1.125rem;
}
.steps h3 { font-size: 1.125rem; }
.steps p { color: var(--ink); margin-top: 4px; }
.steps .en { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }
.steps code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--peach); color: #7a1a00; padding: 1px 6px; border-radius: 6px; }

.qr {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: var(--s3);
  text-align: center;
  display: grid;
  gap: var(--s2);
  justify-items: center;
}
.qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.qr p { font-size: 0.9375rem; color: var(--muted); }
.qr strong { color: var(--navy); display: block; }
@media (max-width: 719px) { .qr { display: none; } }

.schedule { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.schedule li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s3); border-top: 6px solid var(--navy); }
.schedule li:nth-child(2) { border-top-color: var(--red); }
.schedule li:nth-child(3) { border-top-color: var(--yellow); }
.schedule li:nth-child(4) { border-top-color: var(--orange); }
.schedule time, .schedule .when { display: block; color: var(--navy); font-weight: 800; font-size: 1.125rem; }
.schedule p { color: var(--muted); font-size: 0.9375rem; margin-top: 4px; }
.schedule h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; font-weight: 700; }

/* ---------- Gallery cards ---------- */
.grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: var(--s3);
  box-shadow: var(--shadow);
  min-height: 220px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { border-color: var(--navy); transform: translateY(-2px); }
.card:focus-within { border-color: var(--navy); }
.card__top { display: flex; flex-wrap: wrap; gap: var(--s1); }
.card h3 { font-size: 1.125rem; line-height: 1.3; }
.card h3 a { text-decoration: none; color: var(--navy); display: block; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r2); } /* whole card is the hit area */
.card h3 a:focus-visible { outline: none; box-shadow: none; }
.card h3 a:focus-visible::after { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }
.card__desc { color: var(--ink); font-size: 0.9375rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1); color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.card__by { color: var(--navy); font-weight: 700; font-size: 0.875rem; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--navy-tint);
  color: var(--navy);
}
.tag--automation { background: var(--peach); color: #7a1a00; }
.tag--exploration { background: var(--yellow-tint); color: #5c3a00; }
.tag--finalist { background: var(--yellow); color: var(--navy); }
.tag--tool { background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }

/* ---------- Gallery page ---------- */
.page-head { padding-block: var(--s6) var(--s3); }
.page-head h1 { font-size: clamp(1.75rem, 5.4vw, 2.75rem); }
.page-head p { margin-top: var(--s1); color: var(--ink); max-width: 40em; }
.page-head .sub-en { margin-top: 4px; }

.toolbar { display: grid; gap: var(--s2); padding-bottom: var(--s3); }
@media (min-width: 860px) { .toolbar { grid-template-columns: 1fr auto; align-items: end; } }
.field label { display: block; font-weight: 700; color: var(--navy); font-size: 0.875rem; margin-bottom: 4px; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s2);
  border: 2px solid var(--line);
  border-radius: var(--r1);
  background: var(--card);
}
.field input:focus-visible { border-color: var(--navy); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s1); }
.filters button {
  min-height: 44px;
  padding: 0 var(--s2);
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}
.filters button:hover { border-color: var(--navy); }
.filters button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.count { color: var(--muted); font-size: 0.875rem; min-height: 24px; margin-bottom: var(--s2); }
.gallery { padding-bottom: var(--s10); }

.state {
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--r2);
  padding: var(--s6) var(--s3);
  text-align: center;
  display: grid;
  gap: var(--s2);
  justify-items: center;
}
.state h2 { font-size: 1.25rem; }
.state p { color: var(--muted); max-width: 32em; }
.state--error { border-color: var(--red); }
.state--error h2 { color: var(--red-dark); }
.state code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--peach); color: #7a1a00; padding: 1px 6px; border-radius: 6px; }

.skeleton { min-height: 220px; border-radius: var(--r2); background: linear-gradient(100deg, #ececf0 30%, #f8f8fa 50%, #ececf0 70%); background-size: 200% 100%; border: 1px solid var(--line); animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.notice { background: var(--yellow-tint); border: 1px solid var(--yellow); color: var(--navy); border-radius: var(--r1); padding: var(--s2); margin-bottom: var(--s3); font-weight: 600; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(29, 41, 86, 0.6); padding: 0; }
.modal__panel {
  background: var(--card);
  width: 100%;
  max-width: 880px;
  max-height: 94vh;
  max-height: 94dvh;
  overflow: auto;
  border-radius: var(--r3) var(--r3) 0 0;
  padding: var(--s3) var(--s2) var(--s4);
  position: relative;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}
@media (min-width: 720px) {
  .modal { place-items: center; padding: var(--s3); }
  .modal__panel { border-radius: var(--r3); padding: var(--s4); max-height: 90vh; max-height: 90dvh; }
}
.modal__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); margin-bottom: var(--s2); }
.modal__nav { display: flex; align-items: center; gap: var(--s1); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r1);
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
  font-weight: 700;
  padding: 0 var(--s2);
}
.icon-btn:hover { border-color: var(--navy); background: var(--navy-tint); }
.icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.modal__tags { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); }
.modal h2 { font-size: clamp(1.375rem, 4.6vw, 2rem); }
.modal__by { color: var(--muted); margin-top: var(--s1); font-size: 0.9375rem; }
.modal__by strong { color: var(--navy); }
.modal__body { display: grid; gap: var(--s3); margin-top: var(--s3); }
.modal__body h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.modal__body p { white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.preview { border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; background: var(--surface); }
.preview iframe { width: 100%; height: 320px; border: 0; background: #fff; display: block; }
@media (min-width: 720px) { .preview iframe { height: 420px; } }
.preview__foot { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; padding: var(--s2); background: var(--card); border-top: 1px solid var(--line); }
.preview__foot p { color: var(--muted); font-size: 0.875rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #fff; margin-top: var(--s8); padding-block: var(--s6); }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--yellow); }
.site-footer :focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--navy); }
.footer__grid { display: grid; gap: var(--s4); }
@media (min-width: 800px) { .footer__grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.footer__brand { display: flex; align-items: center; gap: var(--s2); }
.footer__brand img { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.footer__brand strong { display: block; font-size: 1.125rem; }
.footer__brand span { color: #d6daea; font-size: 0.9375rem; }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.footer__links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.footer__partners { margin-top: var(--s3); background: #fff; border-radius: var(--r2); padding: var(--s2); display: inline-flex; align-items: center; gap: var(--s3); }
.footer__partners img { height: 32px; width: auto; }
.footer__note { margin-top: var(--s3); color: #d6daea; font-size: 0.875rem; max-width: 48em; }

/* ---------- 404 ---------- */
.notfound { padding-block: var(--s10); text-align: center; display: grid; gap: var(--s2); justify-items: center; }
.notfound h1 { font-size: clamp(2rem, 8vw, 4rem); }
.notfound .big { color: var(--red); font-size: clamp(4rem, 16vw, 8rem); font-weight: 800; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .skeleton { background: #ececf0; }
}
@media (forced-colors: active) {
  .card, .btn, .tag, .chip { border: 1px solid CanvasText; }
}
