/* aigoo.io stylesheet
   Layout idea: one 1160px column, soft rounded panels on a white ground, mono labels for metadata.
   Single bright theme by choice. Every colour, font and space below is a token: change it here only. */

:root {
  color-scheme: light;

  /* Colour: bright white ground, with the red and blue of the Korean flag */
  --bg: #FFFFFF;          /* page ground */
  --surface: #F3F7FF;     /* tinted panels, inputs */
  --line: #D9E2F2;        /* soft rules */
  --line-strong: #7486A6; /* control borders */
  --text: #0B1B3A;        /* headings, body */
  --text-2: #2C3B5A;      /* long-form reading text, placeholders */
  --muted: #55637F;       /* metadata, captions */
  --accent: #0047A0;      /* blue: links, actions, current page */
  --accent-hover: #003478;
  --red: #CD2E3A;         /* red: versions, labels, the badge */
  --accent-ink: #FFFFFF;  /* text on blue or red */
  --sun: #FFE27A;         /* highlight behind a key phrase, used once per page */

  --radius: 14px;
  --radius-lg: 22px;
  --pill: 999px;

  /* Type */
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-ko: "Jua", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --fs-hero: clamp(2.375rem, 5.4vw, 4.125rem);
  --fs-h1: clamp(2rem, 4.6vw, 3.5rem);
  --fs-h2: 1.75rem;
  --fs-h3: 1.25rem;
  --fs-lead: 1.1875rem;
  --fs-read: 1.125rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-label: 0.8125rem;

  /* Space: 4px base */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 88px;

  --page: 1160px;
  --measure: 68ch;
  --tap: 44px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, pre, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }

.wrap { max-width: var(--page); margin: 0 auto; padding-inline: var(--s6); }
.rule { border-bottom: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Labels and metadata */
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.label--accent { color: var(--red); }
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5);
  font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted);
}
.placeholder { color: var(--text-2); }

/* Version badge */
.version {
  display: inline-block; padding: 2px 10px;
  border: 1.5px solid var(--red); border-radius: var(--pill); color: var(--red); background: var(--bg);
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
}

/* Status pill: a paper that is not published yet. Blue and filled, so it never reads as a version. */
.status {
  display: inline-block; padding: 2px 10px; border-radius: var(--pill);
  background: var(--surface); border: 1.5px solid var(--accent); color: var(--accent);
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1.5px solid var(--line-strong); border-radius: var(--pill); background: var(--bg); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn--small { min-height: var(--tap); padding: 0 14px; font-size: var(--fs-small); }
.btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn svg, .icon { width: 18px; height: 18px; flex: none; }

/* Header */
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s4) var(--s6); padding-block: 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand__mark { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(155deg, var(--red) 0 50%, var(--accent) 50% 100%); }
.brand__tld { color: var(--red); }
.brand-lockup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }

/* The 아이고! badge: red pill with a blue offset. Always tilted, never stretched or recoloured. */
.aigoo {
  display: inline-block; padding: 5px 14px 3px; border-radius: var(--pill);
  background: var(--red); color: #fff; box-shadow: 3px 3px 0 var(--accent);
  font-family: var(--font-ko); font-size: 1.0625rem; line-height: 1.3; white-space: nowrap;
  transform: rotate(-5deg);
}

.search { flex: 1 1 220px; max-width: 340px; margin: 0; }
.search__field {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--pill); background: var(--surface);
}
.search__field:focus-within { border-color: var(--accent); }
.search__field svg { color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: 42px; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 0.9375rem;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) 26px; font-size: 0.9375rem; font-weight: 500; }
.nav a { display: flex; align-items: center; min-height: var(--tap); }
.nav a[aria-current="page"] { color: var(--accent); }

/* Hero */
.hero {
  background:
    radial-gradient(520px 320px at 8% 0%, rgba(205, 46, 58, 0.10), transparent 70%),
    radial-gradient(620px 380px at 96% 100%, rgba(0, 71, 160, 0.13), transparent 70%),
    var(--surface);
}
.hero .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 56px var(--s8); padding-block: var(--s9) 96px; }
.hero__copy { flex: 1 1 520px; min-width: 0; gap: 28px; }
.hero h1 { font-size: var(--fs-hero); font-weight: 700; line-height: 1.04; letter-spacing: -0.03em; }
.hero h1 mark { background: linear-gradient(transparent 62%, var(--sun) 62%); color: inherit; }
.hero__hello { font-size: var(--fs-small); color: var(--muted); }
.hero__hello strong { color: var(--red); }
.hero__logo { flex: 0 1 460px; width: 460px; min-width: 0; max-width: 100%; height: auto; margin-inline: auto; }

/* Brand images */
img { max-width: 100%; height: auto; }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s7) var(--s8); }
.split .form { flex: 999 1 420px; }
.mascot { flex: 1 1 220px; min-width: 0; max-width: 300px; margin-inline: auto; }
.mascot--small { max-width: 180px; margin: 0; flex: none; }
.lead { max-width: 540px; font-size: var(--fs-lead); line-height: 1.55; color: var(--muted); }

/* Sections */
.section .wrap { padding-block: 80px; gap: var(--s6); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3) var(--s5); }
.section__head h1, .section__head h2 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.page-head .wrap { padding-block: 56px var(--s7); gap: 22px; }
.page-head h1 { max-width: 900px; font-size: var(--fs-h1); font-weight: 700; line-height: 1.06; letter-spacing: -0.03em; }

/* Featured paper */
.feature { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.feature__body { flex: 999 1 480px; min-width: 0; padding: 44px 40px; gap: 22px; }
.feature h3 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.feature h3 a:hover { text-decoration: none; color: var(--accent); }
.feature__fig {
  flex: 1 1 320px; min-width: 0; min-height: 260px; border-left: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; padding: var(--s6);
  background-image: repeating-linear-gradient(135deg, var(--line) 0, var(--line) 1px, transparent 1px, transparent 14px);
}
.slot {
  padding: 10px 14px; background: var(--bg); border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: var(--fs-label); color: var(--text-2); text-align: center;
}
.actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* List rows */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto 24px; align-items: center; gap: var(--s4);
  padding: 22px var(--s3); border-bottom: 1px solid var(--line);
}
.row:hover { background: var(--surface); text-decoration: none; }
.row:hover .row__title { color: var(--accent); }
.row__type { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--accent); }
.row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); line-height: 1.3; }
.row__meta { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.row svg { color: var(--muted); }
.empty { padding: var(--s7) var(--s5); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); }
.empty strong { display: block; color: var(--text); font-family: var(--font-display); font-size: var(--fs-h3); }

/* Paper page */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--muted); }
.crumbs [aria-current] { color: var(--red); }

.permalink {
  flex: 1 1 380px; max-width: 580px; min-width: 0; display: flex; align-items: center; gap: var(--s3);
  min-height: 48px; padding: 0 2px 0 var(--s5); border: 1.5px solid var(--line-strong); border-radius: var(--pill); background: var(--surface);
}
.permalink code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-2); }
.note { font-size: var(--fs-small); color: var(--muted); }
.note code { font-family: var(--font-mono); color: var(--text-2); overflow-wrap: anywhere; }

.paper .wrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s7) var(--s8); padding-block: 56px 80px; }
.paper__body { flex: 999 1 560px; min-width: 0; gap: var(--s7); }
.paper__body section { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: var(--s5); }
.paper__body p { max-width: var(--measure); font-size: var(--fs-read); line-height: 1.7; color: var(--text-2); }
.h-anchor { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.02em; }
.h-anchor button {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.h-anchor button:hover { color: var(--accent); }

.summary { border: 1.5px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); padding: 28px 30px 30px; gap: var(--s4) !important; }
.summary ul { padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 1.0625rem; color: var(--text-2); }
.summary p.note { font-size: var(--fs-small); line-height: 1.6; color: var(--muted); }
.machine { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding-top: var(--s4); border-top: 1px solid var(--line); }
.panel { border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.panel__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s1) var(--s1) var(--s1) var(--s4); border-bottom: 1px solid var(--line); }
pre, .code { font-family: var(--font-mono); font-size: var(--fs-label); line-height: 1.7; color: var(--text-2); }
.panel pre { padding: var(--s4); overflow-x: auto; max-height: 340px; }

.versions { padding-top: 40px; border-top: 1px solid var(--line); }
.vrow { display: grid; grid-template-columns: 72px 110px minmax(0, 1fr); align-items: baseline; gap: var(--s4); padding: 18px var(--s1); border-bottom: 1px solid var(--line); }
.vrow__v { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 500; color: var(--red); }
.vrow__d { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.vrow--next { border-bottom-style: dashed; border-bottom-color: var(--line-strong); }
.vrow--next .vrow__v { color: var(--muted); }

.toc { flex: 1 1 240px; min-width: 0; gap: var(--s3); padding: 22px 22px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.toc nav { display: flex; flex-direction: column; font-size: 0.9375rem; }
.toc button {
  display: flex; align-items: center; min-height: var(--tap); width: 100%; padding: 0;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.toc button:last-child { border-bottom: 0; }
.toc button:hover { color: var(--accent); }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s4); }

/* Forms */
.form { max-width: 620px; gap: var(--s5); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-weight: 600; font-size: 0.9375rem; }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 12px var(--s4);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--bg);
  color: var(--text); font: inherit;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field [aria-invalid="true"] { border-color: var(--red); }
.field__error { font-size: var(--fs-small); font-weight: 500; color: var(--red); }
.field--trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: var(--s4) var(--s5); border: 1.5px solid var(--accent); border-radius: var(--radius); background: var(--surface); font-size: 0.9375rem; color: var(--text-2); }
.notice strong { display: block; color: var(--text); }
.notice[hidden] { display: none; }

/* Style guide */
.guide .wrap { padding-block: 56px 80px; gap: var(--s8); }
.guide section { display: flex; flex-direction: column; gap: var(--s5); }
.guide h2 { font-size: var(--fs-h2); letter-spacing: -0.02em; padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.guide p, .guide li { max-width: var(--measure); color: var(--text-2); }
.guide ul { padding-left: 22px; display: flex; flex-direction: column; gap: var(--s2); }
.guide code { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--accent); background: var(--surface); padding: 1px 6px; border-radius: 6px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: var(--s4); }
.swatch { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.swatch__chip { height: 72px; border-bottom: 1px solid var(--line); }
.swatch__info { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-small); color: var(--muted); }
.swatch__info strong { color: var(--text); font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; }
.specimen { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: baseline; gap: var(--s4); padding-block: var(--s4); border-bottom: 1px solid var(--line); }
.specimen > span:first-child { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.spaces { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s5); }
.space { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); font-family: var(--font-mono); font-size: var(--fs-label); color: var(--muted); }
.space i { display: block; height: 16px; border-radius: 4px; background: var(--accent); }
.demo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.demo--col { flex-direction: column; align-items: stretch; }

/* Legal pages reuse .guide; links inside prose are underlined blue */
.legal a, .note a { color: var(--accent); text-decoration: underline; }
.legal section { gap: var(--s4); }

/* Footer */
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s5) var(--s7); padding-block: var(--s7) var(--s8); }
.site-footer p { font-size: var(--fs-small); color: var(--muted); }
.site-footer { background: var(--surface); }
.site-footer .brand { font-size: 1.125rem; min-height: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 20px; border-radius: var(--pill);
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-small); font-weight: 600;
}
.toast[hidden] { display: none; }

@media (max-width: 640px) {
  .wrap { padding-inline: var(--s4); }
  .row { grid-template-columns: minmax(0, 1fr) 24px; }
  .row__type { grid-column: 1 / -1; }
  .row .version, .row .status { justify-self: start; grid-column: 1; }
  .row svg { grid-row: 2; grid-column: 2; }
  .feature__body { padding: var(--s6) var(--s5); }
  .feature__fig { border-left: 0; border-top: 1px solid var(--line); }
  .vrow, .specimen { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .section .wrap { padding-block: var(--s7); }
  .hero .wrap { padding-block: var(--s7); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
