/* AISA Forum workshops — shared stylesheet. Light theme, forest/mint accent, system fonts, no build step. */

:root {
  --forest: #1f4d3a;
  --forest-dark: #163828;
  --forest-light: #2f6b50;
  --mint: #bfe8d4;
  --mint-light: #e6f6ee;
  --mint-dark: #6fc39b;
  --cream: #fbfaf6;
  --white: #ffffff;
  --text: #1c2521;
  --text-muted: #5b6761;
  --border: #d9e0dc;
  --border-strong: #b8c4bd;
  --info-bg: #e8f1fb;
  --info-border: #8fb8e8;
  --info-text: #1b4e86;
  --warning-bg: #fff6df;
  --warning-border: #f0c75e;
  --warning-text: #7a5a00;
  --success-bg: #e4f6ea;
  --success-border: #6fc39b;
  --success-text: #1f4d3a;
  --danger-bg: #fdeaea;
  --danger-border: #e59a9a;
  --danger-text: #8c2222;
  --danger: #b83232;
  --track-fundamentals: #1f4d3a;
  --track-genai: #6b3fa0;
  --track-eval: #a35d12;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 40, 30, 0.06), 0 4px 14px rgba(20, 40, 30, 0.06);
  --content-w: min(1100px, 100% - 32px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--cream);
  overflow-x: hidden;
}

img, svg, canvas, iframe { max-width: 100%; }

a { color: var(--forest-light); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--forest-dark); }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; color: var(--forest-dark); font-weight: 700; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin-top: 1.4em; }
h3 { font-size: 1.15rem; margin-top: 1.2em; }
h4 { font-size: 1rem; margin-top: 1em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: 0.3em; }
code { font-family: var(--mono); font-size: 0.9em; background: #eef2f0; padding: 1px 5px; border-radius: 4px; }
pre {
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.5;
  background: #f1f4f2; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
blockquote {
  margin: 0 0 1em; padding: 8px 16px; border-left: 4px solid var(--mint-dark);
  background: var(--mint-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text);
}
small, .muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

:focus-visible { outline: 3px solid var(--mint-dark); outline-offset: 2px; }

/* ---------- layout ---------- */
.container { width: var(--content-w); margin: 0 auto; }
main.page { width: var(--content-w); margin: 0 auto; padding: 28px 0 56px; }
.lead { font-size: 1.1rem; color: var(--text-muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--forest); color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.site-header .container {
  display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  min-height: 56px; padding: 8px 0;
}
.site-brand {
  color: var(--white); text-decoration: none; font-weight: 700; font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.site-brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mint-dark); display: inline-block; }
.site-nav { display: flex; gap: 2px 4px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  color: #e2f0e8; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 0.92rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.lane-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: var(--white); white-space: nowrap;
}
.lane-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c8d2cc; }
.lane-badge.accelerated { background: var(--mint); color: var(--forest-dark); }
.lane-badge.accelerated::before { background: var(--forest); }
.lane-badge.unknown::before { background: #e0b24a; }

/* access-code box */
.access-box {
  background: var(--white); border-bottom: 1px solid var(--border);
}
.access-box summary {
  cursor: pointer; padding: 10px 0; font-size: 0.95rem; color: var(--forest); font-weight: 600; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.access-box summary::-webkit-details-marker { display: none; }
.access-box summary::before { content: "▸"; display: inline-block; transition: transform 0.15s; }
.access-box details[open] summary::before { transform: rotate(90deg); }
.access-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 4px 0 14px; }
.access-form .field { margin: 0; flex: 1 1 220px; max-width: 320px; }
.access-form .btn { flex: 0 0 auto; }
.access-status { font-size: 0.9rem; color: var(--text-muted); flex-basis: 100%; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 40px; padding: 24px 0 40px;
  font-size: 0.875rem; color: var(--text-muted);
}
.site-footer p { margin-bottom: 0.4em; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform 0.12s, box-shadow 0.12s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(20, 40, 30, 0.12); color: inherit; }
.card-link h3 { margin-top: 0; color: var(--forest); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); margin-bottom: 24px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); margin-bottom: 20px; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); margin-bottom: 20px; }

.hero { padding: 36px 0 12px; }
.hero h1 { margin-bottom: 0.3em; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; background: var(--mint-light); color: var(--forest); border: 1px solid var(--mint);
}
.badge.fundamentals { background: var(--mint-light); color: var(--track-fundamentals); border-color: var(--mint); }
.badge.genai { background: #f1e9fb; color: var(--track-genai); border-color: #d9c4f2; }
.badge.eval { background: #fdf1e3; color: var(--track-eval); border-color: #f3d2a8; }
.badge.keynote { background: #eef2f0; color: var(--text-muted); border-color: var(--border); }
.badge.success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.badge.warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--forest); cursor: pointer;
  background: var(--forest); color: var(--white); text-decoration: none; transition: background 0.12s, border-color 0.12s;
  min-height: 42px; position: relative;
}
.btn:hover { background: var(--forest-dark); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--forest); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--mint-light); color: var(--forest-dark); }
.btn-ghost { background: transparent; color: var(--forest); border-color: transparent; }
.btn-ghost:hover { background: var(--mint-light); color: var(--forest-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #8c2222; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; min-height: 34px; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: var(--white); animation: spin 0.8s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after { border-color: rgba(31, 77, 58, 0.3); border-top-color: var(--forest); }
.btn-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--mint);
  border-top-color: var(--forest); animation: spin 0.8s linear infinite; flex: 0 0 auto;
}
.loader { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 5px; color: var(--text); }
.field .help { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  font: inherit; color: var(--text); background: var(--white);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 12px; width: 100%; max-width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--forest-light); box-shadow: 0 0 0 3px rgba(111, 195, 155, 0.35);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235b6761' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type="color"] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--white); }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f2; color: var(--text-muted); }

.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--forest); margin: 0; }

/* range sliders with readouts */
.range-field { margin-bottom: 16px; }
.range-field .range-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.range-field label { font-weight: 600; font-size: 0.92rem; }
.range-field output, .range-field .readout {
  font-family: var(--mono); font-size: 0.9rem; color: var(--forest); background: var(--mint-light);
  padding: 1px 8px; border-radius: 6px; min-width: 3ch; text-align: center;
}
input[type="range"] { width: 100%; accent-color: var(--forest); margin: 4px 0; cursor: pointer; height: 28px; }
input[type="range"]:focus-visible { outline: 3px solid var(--mint-dark); outline-offset: 2px; border-radius: 4px; }

.form-row { display: grid; gap: 14px 20px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

/* pill radios */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pills label {
  cursor: pointer; border: 1px solid var(--border-strong); border-radius: 999px; padding: 7px 14px;
  background: var(--white); font-size: 0.9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px;
}
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pills label:has(input:checked) { background: var(--forest); color: var(--white); border-color: var(--forest); }
.pills label:has(input:focus-visible) { outline: 3px solid var(--mint-dark); outline-offset: 2px; }
.pills label svg { width: 18px; height: 18px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 44px; height: 24px; border-radius: 999px; background: #c8d2cc; position: relative; transition: background 0.15s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--white); transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch input:checked + .track { background: var(--forest); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--mint-dark); outline-offset: 2px; }

/* ---------- callouts ---------- */
.callout { border: 1px solid; border-left-width: 5px; border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; }
.callout > :last-child { margin-bottom: 0; }
.callout.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.callout.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.callout.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.callout.danger, .callout.error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.callout h3, .callout h4 { color: inherit; margin-top: 0; }

/* ---------- toasts ---------- */
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: #26302b; color: var(--white); border-radius: 8px; padding: 12px 16px; font-size: 0.92rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); display: flex; gap: 12px; align-items: flex-start;
  animation: toast-in 0.2s ease-out;
}
.toast.error { background: #7a1f1f; }
.toast.success { background: var(--forest); }
.toast button { background: none; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; padding: 0; line-height: 1; margin-left: auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f1f4f2; font-weight: 600; color: var(--forest-dark); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f7faf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { background: var(--mint-light); }

/* ---------- metrics ---------- */
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); margin-bottom: 18px; }
.metric { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.metric .metric-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2px; }
.metric .metric-value { font-size: 1.4rem; font-weight: 700; color: var(--forest-dark); font-variant-numeric: tabular-nums; line-height: 1.2; }
.metric .metric-delta { font-size: 0.82rem; margin-top: 2px; }
.metric .metric-delta.good { color: var(--success-text); }
.metric .metric-delta.bad { color: var(--danger-text); }

/* ---------- steps ---------- */
.step { margin-top: 36px; padding-top: 8px; }
.step-title { display: flex; align-items: center; gap: 12px; }
.step-num {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--forest); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.flow { counter-reset: flow; padding-left: 0; list-style: none; }
.flow > li { counter-increment: flow; padding-left: 36px; position: relative; margin-bottom: 8px; }
.flow li ul, .flow li ol { margin-top: 6px; margin-bottom: 4px; }
.flow > li::before {
  content: counter(flow); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--mint); color: var(--forest-dark); font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.keynote-link {
  display: inline-flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px 6px 10px; text-decoration: none; color: var(--forest); font-size: 0.9rem; font-weight: 600;
  margin-bottom: 18px;
}
.keynote-link:hover { background: var(--mint-light); }

details.collapsible { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); margin-bottom: 16px; }
details.collapsible summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--forest); }
details.collapsible .collapsible-body { padding: 4px 14px 14px; }

/* ---------- charts ---------- */
.chart-box { position: relative; width: 100%; height: 360px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 16px; }
.chart-box.short { height: 280px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
@media (max-width: 600px) { .chart-box { height: 280px; } .chart-box.short { height: 220px; } }

/* ---------- formulas ---------- */
.formula { text-align: center; font-size: 1.05rem; margin: 12px 0 16px; overflow-x: auto; padding: 6px 0; }
.katex { font-size: 1.05em; }

/* ---------- job / progress ---------- */
.job-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.job-panel .job-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.job-panel .job-status { font-weight: 600; color: var(--forest); }
.progress { height: 8px; background: #e7ece9; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--forest-light); width: 0; transition: width 0.3s; }
.log {
  font-family: var(--mono); font-size: 0.8rem; background: #f1f4f2; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; max-height: 220px; overflow-y: auto; margin-bottom: 16px; white-space: pre-wrap; line-height: 1.5;
}
.log .err { color: var(--danger); }

/* ---------- images ---------- */
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-grid figure { margin: 0; text-align: center; font-size: 0.75rem; color: var(--text-muted); width: 72px; }
.img-grid img { width: 64px; height: 64px; image-rendering: pixelated; border-radius: 4px; border: 1px solid var(--border); display: block; margin: 0 auto 2px; }
.pixel { image-rendering: pixelated; }
.attack-result { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.attack-result figure { margin: 0; text-align: center; }
.attack-result img { width: 160px; height: 160px; border: 1px solid var(--border); border-radius: 6px; background: #000; }
.attack-result figcaption { font-weight: 600; margin: 6px 0 4px; }
.attack-result ol { text-align: left; font-size: 0.85rem; display: inline-block; margin: 0; padding-left: 1.3em; }

.hidden { display: none !important; }

/* ---------- misc ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 0.92rem; background: none; border: 0; border-bottom: 3px solid transparent;
  margin-bottom: -2px; padding: 8px 14px; cursor: pointer; color: var(--text-muted);
}
.tabs button[aria-selected="true"] { color: var(--forest); border-bottom-color: var(--forest); }
.tabs button:hover { color: var(--forest-dark); }

.heatmap { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); font-size: 0.6rem; max-width: 100%; overflow-x: auto; }
.heatmap-wrap { overflow-x: auto; margin-bottom: 16px; }
.heatmap div { background: var(--white); min-width: 14px; aspect-ratio: 1; }

.game-grid { display: grid; grid-template-columns: repeat(5, minmax(44px, 64px)); gap: 6px; margin-bottom: 14px; }
.game-grid .cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
}
.game-grid .cell.robot { background: var(--mint-light); border-color: var(--mint-dark); }
.dpad { display: grid; grid-template-columns: repeat(3, 64px); gap: 6px; margin-bottom: 14px; }
.dpad .btn { padding: 8px; min-height: 44px; }

.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); }

/* ---------- print ---------- */
@media print {
  .site-header, .access-box, .site-footer, .toast-region, .btn, .job-panel, .tabs { display: none !important; }
  body { background: #fff; color: #000; }
  main.page { width: 100%; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
