/* GDD Builder — PetRockStudios
 *
 * A document tool, so it uses the SITE's paper palette (cream / ink / orange), not the
 * dark editor theme PixVox uses. PixVox is dark because you cannot judge colour against a
 * cream page; a design document is read like a page, so it looks like one.
 */

:root {
  --ink: #1d0b33;
  --paper: #fff3d6;
  --surface: #fffdf8;
  --orange: #ff7a18;
  --orange-dark: #d9530a;
  --yellow: #ffce00;
  --slime: #7de22b;
  --pink: #ff3da6;
  --purple: #8b47e8;
  --muted: #6b5a8a;
  --dim: #a290bd;
  --line: #e4d7c2;
  --radius: 12px;
  --font-display: 'Bungee', 'Impact', sans-serif;
  --font-ui: 'Baloo 2', 'Trebuchet MS', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 50% -10%, #fff9ea 0%, var(--paper) 55%, #f6e9d0 100%);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-dark); }

/* ── top bar ─────────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--ink);
  border-bottom: 4px solid var(--orange);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--paper);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--orange);
  text-shadow: 2px 2px 0 #000;
}

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 190px;
}

.meter-track {
  position: relative;
  flex: 1;
  height: 12px;
  background: #2c1550;
  border: 2px solid #000;
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
  transition: width 0.25s ease;
}

.meter-fill.done { background: linear-gradient(90deg, var(--slime), #2ec27e); }

.meter-label {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--paper);
  white-space: nowrap;
}

.bar-actions { display: flex; gap: 8px; }

.btn {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 10px;
  border: 3px solid var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--slime);
  color: var(--ink);
  box-shadow: 3px 3px 0 #000;
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper);
}

.btn-ghost:hover { background: rgba(255, 243, 214, 0.12); }

/* ── layout ──────────────────────────────────────────────────────────────── */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.basics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px;
  margin-bottom: 22px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: span 2; }

.field > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.sec-input {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.field input:focus,
.field select:focus,
.sec-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.18);
}

.cols {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── table of contents ───────────────────────────────────────────────────── */

.toc {
  position: sticky;
  top: 74px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  max-height: calc(100vh - 100px);
  overflow: auto;
}

.toc-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.toc ol { list-style: none; margin: 0; padding: 0; }

.toc li { margin: 0 0 2px; }

.toc button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.25;
}

.toc button:hover { background: rgba(255, 122, 24, 0.12); }
.toc button[aria-current="true"] { background: rgba(255, 122, 24, 0.2); }

.dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
}

.dot.ok { background: var(--slime); }
.dot.empty { background: var(--yellow); }

.toc-hint {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.toc-hint code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  background: rgba(29, 11, 51, 0.07);
  padding: 1px 4px;
  border-radius: 4px;
}

/* ── sections ────────────────────────────────────────────────────────────── */

.sections { display: flex; flex-direction: column; gap: 16px; }

.section {
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
  scroll-margin-top: 84px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
}

.section-num {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--orange);
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.01em;
}

.section-state {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 2px solid #000;
  color: var(--ink);
  background: var(--yellow);
}

.section-state.ok { background: var(--slime); }

.section-body { padding: 14px; }

.purpose {
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 4px solid var(--orange);
  font-size: 13.5px;
  color: var(--muted);
}

.sec-input {
  min-height: 132px;
  resize: vertical;
  line-height: 1.6;
}

.sec-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--dim);
}

.sec-count.under { color: var(--orange-dark); font-weight: 700; }

/* ── footer, toast ───────────────────────────────────────────────────────── */

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px 48px;
  font-size: 12.5px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(140%);
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--orange);
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  transition: transform 0.25s ease;
  z-index: 40;
  max-width: 90vw;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  .toc ol { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .field-wide { grid-column: span 1; }
  .meter { order: 3; width: 100%; margin-left: 0; }
  .bar { gap: 10px; }
}

@media print {
  .bar, .toc, .foot, .sec-foot, .toast { display: none; }
  .cols { grid-template-columns: 1fr; }
  .section { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Screen-reader-only text. The page needs an <h1> for a heading to exist at all; the
 * visible title is the brand bar, and an editor should open into the document. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
