/* Form Studio — original stylesheet for an unofficial student concept site. */
:root {
  --ink: #1d1d1f;
  --ink-soft: #4a4a50;
  --ink-muted: #5f5f66;
  --paper: #ffffff;
  --paper-soft: #f5f5f7;
  --line: #d9d9de;
  --accent: #0b5fcc;
  --accent-ink: #ffffff;
  --focus: #0b5fcc;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px rgba(29, 29, 31, 0.08);
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

}

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

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

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

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

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(12px)) {
  .site-header { background: rgba(255, 255, 255, 0.78); backdrop-filter: saturate(160%) blur(12px); }
}
.nav-bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark { width: 26px; height: 26px; }
.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}
.nav-list a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav-list a:hover { color: var(--ink); background: var(--paper-soft); }
.nav-list a[aria-current="page"] { color: var(--ink); background: var(--paper-soft); font-weight: 600; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .js .nav-list {
    display: none;
    position: absolute;
    top: 56px; left: 0; right: 0;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1rem 1rem;
    box-shadow: var(--shadow);
  }
  .js .nav-list.is-open { display: flex; }
  .nav-list a { padding: 0.8rem 1rem; font-size: 1.05rem; }
  /* Without JavaScript, the menu wraps instead of collapsing. */
  html:not(.js) .nav-bar { height: auto; flex-wrap: wrap; padding-block: 0.5rem; }
  html:not(.js) .nav-list { flex-wrap: wrap; }
}

/* ---------- Layout ---------- */
main { display: block; }
.section { padding: clamp(3rem, 8vw, 6.5rem) 1.25rem; }
.section.soft { background: var(--paper-soft); }
.wrap { max-width: var(--max); margin: 0 auto; }
.narrow { max-width: 760px; margin: 0 auto; }

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.8rem; }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: var(--ink-soft); max-width: 46rem; }
.center { text-align: center; }
.center .lede, .lede.center { margin-left: auto; margin-right: auto; }

.hero { padding-top: clamp(3.5rem, 9vw, 7rem); text-align: center; }
.hero-art { margin: clamp(2rem, 5vw, 3.5rem) auto 0; max-width: 920px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 1.5rem; }
.btn {
  display: inline-block;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #094ea8; }
.btn-ghost { border-color: var(--accent); color: var(--accent); }
.btn-ghost:hover { background: #eef4fd; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.section.soft .card { border-color: transparent; }
.card p:last-child { margin-bottom: 0; }
.card-link { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-link .more { margin-top: auto; padding-top: 0.75rem; color: var(--accent); font-weight: 600; }
.card-icon { width: 56px; height: 56px; margin-bottom: 1rem; }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.figure { margin: 0; }
.figure.hero-art { margin: clamp(2rem, 5vw, 3.5rem) auto 0; }
.figure figcaption { font-size: 0.92rem; color: var(--ink-muted); margin-top: 0.75rem; text-align: center; }
.rounded { border-radius: var(--radius-lg); overflow: hidden; }

/* ---------- Disclaimer ---------- */
.notice {
  border: 1px solid var(--line);
  background: var(--paper-soft);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* ---------- Demo stage ---------- */
.studio-stage {
  background: var(--paper-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 4vw, 2.5rem);
}
.small-note { font-size: 0.9rem; color: var(--ink-muted); margin-top: 0.5rem; }

.spec-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.spec-list li { border-top: 1px solid var(--line); padding-top: 0.9rem; }
.spec-list strong { display: block; }

/* ---------- Playground: gridworld ---------- */
button.btn { font: inherit; cursor: pointer; background-clip: padding-box; }
button.btn-ghost { background: var(--paper); }
button.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.gw-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (max-width: 820px) { .gw-layout { grid-template-columns: 1fr; } }
.grid-world {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.gw-cell {
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: clamp(0.95rem, 3vw, 1.35rem);
  color: var(--ink-soft);
  transition: background-color 0.25s ease;
}
.gw-cell.v1 { background: #eaf1fd; }
.gw-cell.v2 { background: #d5e4fb; }
.gw-cell.v3 { background: #bcd3f8; }
.gw-cell.v4 { background: #9fc0f4; color: var(--ink); }
.gw-cell.gw-path { box-shadow: inset 0 0 0 2px var(--accent); }
.gw-cell.gw-wall { background: #3b3f46; border-color: #3b3f46; }
.gw-cell.gw-goal { background: #e3f1df; border-color: #8ea487; color: #2f5a34; font-weight: 700; }
.gw-cell.gw-pit { background: #fbe4e2; border-color: #d9827a; color: #a3352b; font-weight: 700; }
.gw-cell.gw-agent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.gw-buttons { justify-content: flex-start; margin-top: 0; }
.gw-label { display: block; font-weight: 600; margin-top: 1.25rem; }
#gw-epsilon { width: 100%; accent-color: var(--accent); }
.gw-status { margin: 1rem 0; padding: 0.9rem 1rem; background: var(--paper); border-radius: var(--radius-sm); border: 1px solid var(--line); min-height: 3.2em; }
.gw-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.92rem; color: var(--ink-soft); }
.gw-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.gw-key { width: 16px; height: 16px; border-radius: 5px; display: inline-block; border: 1px solid var(--line); }
.gw-key-agent { background: var(--accent); border-color: var(--accent); }
.gw-key-goal { background: #e3f1df; border-color: #8ea487; }
.gw-key-pit { background: #fbe4e2; border-color: #d9827a; }
.gw-key-wall { background: #3b3f46; border-color: #3b3f46; }

/* ---------- Research: concept tabs ---------- */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  background: var(--paper-soft);
  border-radius: 999px;
  padding: 0.35rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 2rem;
}
.mode-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.98rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
}
.mode-tab[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
@media (max-width: 560px) {
  .mode-tabs { border-radius: var(--radius-md); width: 100%; }
  .mode-tab { flex: 1 1 45%; }
}
.mode-panel { display: block; max-width: 760px; margin: 0 auto; }
@media (max-width: 820px) { .mode-panel { grid-template-columns: 1fr; } }
.mode-panel[hidden] { display: none; }
.tip-list { margin: 0; padding-left: 1.2rem; }
.tip-list li { margin-bottom: 0.55rem; }

.planner { margin-top: 1.5rem; }
.planner label { font-weight: 600; display: block; margin-bottom: 0.4rem; }
.planner input[type="range"] { width: 100%; accent-color: var(--accent); }
.planner-out { margin-top: 0.75rem; font-size: 1rem; color: var(--ink-soft); }
.planner-out strong { color: var(--ink); }

/* ---------- Principles ---------- */
.principle { display: grid; grid-template-columns: 72px 1fr; gap: 1.25rem; align-items: start; }
.principle img { width: 72px; height: 72px; }
@media (max-width: 480px) { .principle { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0.75rem; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  padding: 0;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.1rem 3rem 1.1rem 1.25rem;
  font-weight: 600;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--ink-muted);
}
.faq details[open] summary::after { content: "\2212"; }
.faq .answer { padding: 0 1.25rem 1.1rem; color: var(--ink-soft); }
.faq .answer p { margin: 0; }

/* ---------- 404 ---------- */
.error-code { font-size: clamp(4rem, 14vw, 8rem); font-weight: 700; letter-spacing: -0.04em; margin: 0; color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--paper-soft);
  border-top: 1px solid var(--line);
  padding: 2.5rem 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.footer-inner { max-width: var(--max); margin: 0 auto; display: grid; gap: 1rem; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer-nav a { color: var(--ink-soft); }
.site-footer p { margin: 0; }

/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .js .reveal { opacity: 1; transform: none; }
  .card-link:hover { transform: none; }
}

/* Avoid a doubled gap when a hero is followed by another white section. */
.hero + .section:not(.soft) { padding-top: clamp(0.5rem, 2vw, 1.5rem); }
.hero-art img { margin-inline: auto; }
