/*
 * SPDX-FileCopyrightText: 2026 Mad Scientist
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #fffdf8;
  --ink: #20242b;
  --muted: #68707d;
  --line: #ded9ce;
  --accent: #3559e0;
  --accent-soft: #e9edff;
  --category: #7652c7;
  --category-soft: #f1ebff;
  --stem: #176b5b;
  --ending: #c44b24;
  --present: #e8f3ff;
  --preterite: #fff0df;
  --imperfect: #f4eafe;
  --future: #e9f7e8;
  --shadow: 0 10px 30px rgba(38, 42, 51, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  padding: 2rem clamp(1rem, 4vw, 4rem) 1.25rem;
}
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .6rem;
}
.eyebrow {
  margin: 0 0 .35rem;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; }
.subtitle { margin: .65rem 0 0; color: var(--muted); }

.toggle {
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  white-space: nowrap;
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.toggle input { accent-color: var(--accent); }

main {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  padding: 0 clamp(1rem, 4vw, 4rem) 3rem;
}
.panel, .verb-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.control-stack {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
  min-width: 0;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding-right: .15rem;
}
.controls, .priority-panel { padding: 1.1rem; }
.control-head, .study-toolbar, .verb-card-head, .tense-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.control-head h2 { margin: 0; }
.text-button {
  border: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 700;
}
.filter-help {
  margin: .9rem 0 .2rem;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}
.filter-group { margin: 1rem 0 0; min-width: 0; }
.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
}
.filter-heading h3 {
  margin: 0;
  font-size: .8rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.filter-actions { display: flex; gap: .25rem; }
.filter-actions button {
  border: 0;
  border-radius: 7px;
  padding: .25rem .42rem;
  background: transparent;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 750;
}
.filter-actions button:hover { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: .42rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: .88rem;
  transition: .15s ease;
}
.chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #20358d;
  font-weight: 750;
}
.chip.is-category-included span {
  border-color: var(--category);
  border-style: dashed;
  background: var(--category-soft);
  color: #55339b;
}
.chip.is-category-included span::after {
  content: " +";
  color: var(--category);
  font-weight: 900;
}

.category-filter-group {
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.category-help,
.category-description,
.category-key {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}
.category-help { margin: 0 0 .8rem; }
.category-groups { display: grid; gap: .8rem; }
.category-group {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.category-group-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65rem;
}
.category-group-heading h4 {
  margin: 0;
  font-size: .86rem;
}
.category-description { margin: .3rem 0 .6rem; }
.category-chip input:checked + span {
  border-color: var(--category);
  background: var(--category-soft);
  color: #55339b;
}
.category-key {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .65rem 0 0;
}
.category-key span {
  width: .75rem;
  height: .75rem;
  border: 1px dashed var(--category);
  border-radius: 3px;
  background: var(--category-soft);
}

.priority-list {
  display: grid;
  gap: .5rem;
  margin: .85rem 0 0;
  padding: 0;
  list-style: none;
}
.priority-item {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: center;
  padding: .6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.priority-item.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.priority-rank {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
}
.priority-item.is-active .priority-rank {
  background: var(--accent);
  color: #fff;
}
.priority-copy { min-width: 0; }
.priority-copy strong, .priority-copy small { display: block; }
.priority-copy strong { font-size: .9rem; }
.priority-copy small {
  margin-top: .1rem;
  color: var(--muted);
  font-size: .72rem;
}
.priority-actions { display: flex; gap: .25rem; }
.priority-actions button {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-weight: 800;
}
.priority-actions button:not(:disabled):hover { background: #fff; }

.study-area { min-width: 0; }
.study-toolbar { margin: .2rem 0 .8rem; }
.summary { color: var(--muted); font-size: .92rem; }
.legend { display: flex; gap: .9rem; color: var(--muted); font-size: .78rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: .75rem; height: .75rem; border-radius: 3px; display: inline-block; }
.legend-stem { background: var(--stem); }
.legend-ending { background: var(--ending); }

.verb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
.verb-grid[data-column-axis="verbs"] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  align-items: start;
}
.verb-grid[data-column-axis="verbs"] .verb-card { height: 100%; }

.verb-card { padding: 1.15rem; overflow: hidden; }
.verb-title { margin: 0; font-size: 1.45rem; }
.verb-meaning { margin: .2rem 0 0; color: var(--muted); }
.verb-type {
  padding: .3rem .55rem;
  border-radius: 999px;
  background: #eef0f3;
  color: #58606b;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.verb-note { margin: .8rem 0 0; color: #5c6470; font-size: .88rem; }
.verb-note:empty { display: none; }
.tense-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .85rem;
  margin-top: 1rem;
}
.verb-grid[data-column-axis="tenses"] .tense-groups {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  align-items: start;
}
.tense-group { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tense-head { padding: .6rem .75rem; }
.tense-head h3 { margin: 0; font-size: .95rem; }
.tense-head small { color: var(--muted); }
.tense-present .tense-head { background: var(--present); }
.tense-preterite .tense-head { background: var(--preterite); }
.tense-imperfect .tense-head { background: var(--imperfect); }
.tense-future .tense-head { background: var(--future); }
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-row { min-width: 0; padding: .72rem .8rem; border-top: 1px solid var(--line); }
.form-row:not(:last-child) { border-right: 1px solid var(--line); }
.pronoun { display: block; color: var(--muted); font-size: .75rem; margin-bottom: .2rem; }
.form { font-size: 1.2rem; font-weight: 800; letter-spacing: .01em; }
.stem { color: var(--stem); }
.ending { color: var(--ending); }
.no-colors .stem, .no-colors .ending { color: inherit; }
.no-colors .legend { opacity: .35; }
.site-footer {
  display: flex;
  justify-content: center;
  gap: .45rem;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: .78rem;
}
.site-footer a { color: inherit; }

.empty {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar { align-items: center; }
  main { grid-template-columns: 1fr; }
  .control-stack { position: static; max-height: none; overflow: visible; padding-right: 0; }
}
@media (max-width: 560px) {
  .topbar { flex-direction: column; gap: 1rem; }
  .topbar-actions { justify-content: flex-start; }
  .study-toolbar { align-items: flex-start; flex-direction: column; }
  .forms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .verb-grid[data-column-axis="tenses"] .tense-groups,
  .verb-grid[data-column-axis="verbs"] {
    grid-template-columns: minmax(0, 1fr);
  }
}
