/* Skillcheck — blueprint-paper drafting aesthetic. Tokens mirror docs/DESIGN.md. */

:root {
  --bg: #EDE6D6;
  --surface-1: #F7F2E7;
  --surface-2: #E3DAC5;
  --ink: #1B2A44;
  --ink-muted: #5A6579;
  --line: #C6BCA4;
  --grid: rgba(27, 42, 68, 0.06);

  --accent: #0E6E8C;
  --accent-warm: #C05B1E;
  --error: #B3261E;
  --warn: #B7791F;
  --info: #0E6E8C;
  --ok: #3F7A34;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --r-card: 6px;
  --r-chip: 3px;
  --shadow: 0 12px 28px -18px rgba(27, 42, 68, 0.35);
  --hairline: 0 1px 0 var(--line);
  --sp: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E2036;
    --surface-1: #132A46;
    --surface-2: #0B1A2C;
    --ink: #E8EEF6;
    --ink-muted: #93A4BC;
    --line: #274769;
    --grid: rgba(180, 210, 255, 0.07);
    --accent: #3FB6D6;
    --accent-warm: #E08A3C;
    --error: #F0685E;
    --warn: #E9B44C;
    --info: #3FB6D6;
    --ok: #7FC46E;
    --shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(14, 110, 140, 0.10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Faint blueprint grid across the whole page. */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, black, black 70%, transparent);
}

.masthead, .sheet, .footer { position: relative; z-index: 1; }

/* ---- Masthead ---- */
.masthead {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 48px) 8px;
  flex-wrap: wrap;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.wordmark__glyph { flex: none; filter: drop-shadow(0 2px 3px rgba(27,42,68,.25)); }
.wordmark__text {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
}
.wordmark__text b { font-weight: 700; }
.wordmark__text i { font-style: normal; font-weight: 600; color: var(--accent); }
.tagline { margin: 0; color: var(--ink-muted); font-size: 15px; }
.masthead__actions { margin-left: auto; }

.icon-btn {
  font-size: 18px;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface-1);
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out, background 140ms ease-out;
}
.icon-btn:hover { background: var(--surface-2); box-shadow: var(--shadow); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn[aria-pressed="true"] { color: var(--accent-warm); }

/* ---- Sheet (the drafting table) ---- */
.sheet {
  flex: 1;
  /* Floor the hero at ~a full screen below the masthead. Without this, the
     below-the-fold reference copy makes the page taller than the viewport, and
     a flex-basis:0 item with overflow:hidden would shrink to nothing instead of
     growing. The min-height keeps the drafting table filling the first screen. */
  min-height: calc(100vh - 150px);
  margin: 8px clamp(12px, 4vw, 48px) 24px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-card);
  background: var(--surface-1);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet__titleblock {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1.5px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, transparent, transparent 27px, var(--grid) 27px, var(--grid) 28px),
    var(--surface-2);
  position: relative;
}
.tb-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 10px 18px;
  border-right: 1px solid var(--line);
}
.tb-field--tally { flex: 1; }
.tb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
}
.tb-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }

.tally { display: inline-flex; gap: 16px; font-family: var(--font-mono); font-size: 14px; }
.tally__item { color: var(--ink-muted); }
.tally__item b { font-size: 16px; font-variant-numeric: tabular-nums; }
.tally__item--error b { color: var(--error); }
.tally__item--warn b { color: var(--warn); }
.tally__item--info b { color: var(--info); }

/* The signature title-block status stamp. */
.stamp {
  align-self: center;
  margin: 0 18px 0 auto;
  padding: 4px 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  border: 2.5px solid currentColor;
  border-radius: 4px;
  transform: rotate(-6deg);
  opacity: 0.85;
  transition: transform 220ms cubic-bezier(.2,.9,.3,1.2), opacity 180ms ease-out, color 180ms;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.stamp[data-state="idle"] { color: var(--ink-muted); }
.stamp[data-state="pass"] { color: var(--ok); }
.stamp[data-state="revise"] { color: var(--error); }
.stamp.stamp--pop { animation: stampPop 320ms cubic-bezier(.2,.9,.3,1.2); }
@keyframes stampPop {
  0% { transform: rotate(-18deg) scale(1.4); opacity: 0; }
  100% { transform: rotate(-6deg) scale(1); opacity: 0.85; }
}

/* ---- Panes ---- */
.panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 60vh;
}
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane--editor { border-right: 1.5px solid var(--ink); }

.pane__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.pane__title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.pane__controls { display: flex; gap: 10px; align-items: center; }

.field { display: inline-flex; align-items: center; gap: 6px; }
.field__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Themed native select — no naked widget. */
.select {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  padding: 6px 26px 6px 10px;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: right 12px center, right 7px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
}
.select:hover { border-color: var(--accent); }
.select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,110,140,.25); }

.btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-chip);
  padding: 6px 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--ink);
  transition: transform 140ms ease-out, background 140ms ease-out, border-color 140ms ease-out;
}
.btn:hover { border-color: var(--accent); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(14,110,140,.25); }
.btn--ghost { background: transparent; }

/* File tabs — each is one document in the linted set. */
.tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 6px 8px 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-chip) var(--r-chip) 0 0;
  padding: 6px 10px;
  min-height: 32px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease-out, background 140ms ease-out, box-shadow 140ms ease-out;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(14, 110, 140, 0.25); }
.tab--active {
  color: var(--ink);
  background: var(--surface-1);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-muted);
  transition: color 120ms ease-out, background 120ms ease-out;
}
.tab__close:hover { color: var(--error); background: var(--surface-2); }
.tab--add {
  font-size: 16px;
  color: var(--ink-muted);
  padding: 6px 12px;
  min-width: 36px;
  justify-content: center;
}

/* File header inside a multi-file report. */
.report__file {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 12px 8px 4px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}

/* Editor with line-number gutter. */
.editor-wrap {
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--surface-1);
  overflow: auto;
}
.gutter {
  flex: none;
  padding: 14px 8px 14px 12px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-muted);
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  user-select: none;
  white-space: pre;
}
.gutter .g-hot { color: var(--accent); font-weight: 600; }
.editor {
  flex: 1;
  border: 0;
  resize: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  outline: none;
  min-height: 40vh;
  white-space: pre;
  tab-size: 2;
}
.editor::placeholder { color: var(--ink-muted); }

/* Report */
.report { flex: 1; overflow: auto; padding: 8px; background: var(--surface-1); }

.report__empty, .report__clean {
  height: 100%;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--ink-muted);
  padding: 24px;
}
.report__clean { color: var(--ok); }
.report__clean svg { width: 54px; height: 54px; }
.report__empty-title { font-family: var(--font-display); font-size: 18px; color: var(--ink); }

.finding {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--r-chip);
  background: var(--surface-1);
  margin: 6px 4px;
  box-shadow: var(--hairline);
  animation: rowIn 130ms ease-out both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.finding--error { border-left-color: var(--error); }
.finding--warning { border-left-color: var(--warn); }
.finding--info { border-left-color: var(--info); }
.finding:hover { border-color: var(--accent); }

.finding__gutter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  padding-top: 2px;
}
.finding__sev {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--r-chip);
  color: #fff;
}
.finding--error .finding__sev { background: var(--error); }
.finding--warning .finding__sev { background: var(--warn); }
.finding--info .finding__sev { background: var(--info); }
.finding__msg { font-size: 14px; }
.finding__rule { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.finding__hint { font-size: 13px; color: var(--ink-muted); margin-top: 3px; }
.finding__hint::before { content: "↳ "; }

/* ---- Below-the-fold reference / SEO copy ---- */
.seo {
  position: relative;
  z-index: 1;
  padding: 8px clamp(16px, 4vw, 48px) 24px;
}
.seo__inner {
  max-width: 70ch;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-card);
  background: var(--surface-1);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
}
.seo h2 {
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.seo h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 28px 0 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.seo p { margin: 0 0 14px; color: var(--ink); }
.seo code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: var(--r-chip);
}
.faq { margin: 0; }
.faq dt {
  font-weight: 600;
  color: var(--ink);
  margin-top: 14px;
}
.faq dd {
  margin: 4px 0 0;
  color: var(--ink-muted);
}

.footer {
  padding: 16px clamp(16px, 4vw, 48px) 28px;
  color: var(--ink-muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.footer p { margin: 4px 0; }
.footer__portfolio { color: var(--ink-muted); }
.footer code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--r-chip);
  color: var(--ink);
}
.footer a { color: var(--accent); }

/* ---- Responsive: stack the panes on phones ---- */
@media (max-width: 820px) {
  .panes { grid-template-columns: 1fr; }
  .pane--editor { border-right: 0; border-bottom: 1.5px solid var(--ink); }
  .sheet__titleblock { flex-wrap: wrap; }
  .stamp { margin: 8px 18px; }
  .editor, .report, .report__empty, .report__clean { min-height: 32vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
