/* components.css — cards, badges, filter UI, drawer, buttons, utilities */

/* ===========================
   FRAME CARDS
   =========================== */

.frame-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4);
  box-shadow: var(--shadow-paper);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  text-align: left;
  width: 100%;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.frame-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-raised);
}

.frame-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Card title (grammar, topics, templates) */
.frame-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

/* Card latin text (idioms) */
.frame-card__latin {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.3;
}

/* Card gloss (idioms) */
.frame-card__gloss {
  font-style: italic;
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-top: -2px;
}

/* Badge row */
.frame-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

/* Notes text */
.frame-card__notes {
  font-size: 0.88rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

/* Example item (shared by card and drawer) */
.example-item {
  background: var(--surface);
  border-left: 3px solid var(--border);
  border-radius: 0 var(--r) var(--r) 0;
  padding: var(--s2) var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.example-citation {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.example-quote {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.55;
}

/* ===========================
   BADGES
   =========================== */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px var(--s2);
  border-radius: var(--r-xl);
  white-space: nowrap;
  line-height: 1.4;
}

.badge--category {
  background: var(--parchment-dark);
  color: var(--ink-muted);
}

.badge--fixed {
  background: var(--badge-fixed-bg);
  color: var(--badge-fixed-text);
}

.badge--flexible {
  background: var(--badge-flexible-bg);
  color: var(--badge-flexible-text);
}

.badge--todo {
  background: var(--badge-todo-bg);
  color: var(--badge-todo-text);
}

/* ===========================
   FILTER PANEL COMPONENTS
   =========================== */

.filter-section {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.filter-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-muted);
}

/* Search input */
.filter-search {
  width: 100%;
  padding: var(--s2) var(--s3);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  outline: none;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}

.filter-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.filter-search::placeholder {
  color: var(--ink-muted);
}

/* Category pills */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--s3);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  cursor: pointer;
  white-space: nowrap;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}

.filter-pill:hover {
  background: var(--parchment-dark);
  color: var(--ink);
}

.filter-pill.is-active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.filter-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Inflection toggle buttons (All / Fixed / Flexible) */
.filter-toggles {
  display: flex;
  gap: var(--s1);
}

.filter-toggle {
  flex: 1;
  padding: var(--s2) var(--s2);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  text-align: center;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}

.filter-toggle:hover {
  background: var(--parchment-dark);
  color: var(--ink);
}

.filter-toggle.is-active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.filter-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Small explanatory hint text */
.filter-hint {
  font-size: 0.77rem;
  color: var(--ink-muted);
  font-style: italic;
  line-height: 1.45;
}

/* Item count line */
.filter-count {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-style: italic;
}

/* ===========================
   DETAIL DRAWER  (native <dialog>)
   showModal() places it in the top layer;
   margin: 0 0 0 auto right-anchors it.
   =========================== */

.frame-detail-drawer {
  /* right-anchored full-height panel */
  margin: 0 0 0 auto;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  max-height: 100vh;
  /* appearance */
  background: var(--surface-raised);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(31, 27, 22, 0.16);
  overflow: hidden;
  /* display + flex layout moved into [open] state below — keeps the browser's
     default `display: none` for the closed dialog so it never occupies layout */
}

.frame-detail-drawer[open] {
  display: flex;
  flex-direction: column;
}

.frame-detail-drawer::backdrop {
  background: rgba(31, 27, 22, 0.28);
}

/* Sticky drawer header */
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.drawer-latin {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: var(--s1);
}

.drawer-gloss {
  font-style: italic;
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: var(--s2);
}

.drawer-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 1.1rem;
  padding: var(--s1);
  border-radius: var(--r);
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
  transition: color 100ms ease, background 100ms ease;
}

.drawer-close-btn:hover {
  color: var(--ink);
  background: var(--parchment-dark);
}

.drawer-close-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollable body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

/* reference link buttons inside a drawer section */
.drawer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* footer section holding the "Open in workspace" button */
.drawer-workspace-section {
  margin-top: var(--s4);
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
}

.drawer-section-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-muted);
}

.drawer-notes {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.65;
}

/* Numbered steps (Templates) */
.steps-list {
  padding-left: var(--s5);
  list-style: decimal;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.steps-list li {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.55;
}

/* ===========================
   BUTTONS
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--border);
}

.btn--secondary:hover {
  background: var(--parchment-dark);
  border-color: var(--border);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===========================
   EMPTY STATE
   =========================== */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--s7) var(--s4);
  color: var(--ink-muted);
  font-style: italic;
  font-size: 1rem;
}

/* ===========================
   UTILITIES
   =========================== */

.flex      { display: flex; }
.flex-col  { display: flex; flex-direction: column; }
.gap-1     { gap: var(--s1); }
.gap-2     { gap: var(--s2); }
.gap-3     { gap: var(--s3); }
.gap-4     { gap: var(--s4); }
.mt-2      { margin-top: var(--s2); }
.mt-3      { margin-top: var(--s3); }
.mt-4      { margin-top: var(--s4); }
.mt-5      { margin-top: var(--s5); }
.mt-6      { margin-top: var(--s6); }
.italic    { font-style: italic; }
.hidden    { display: none !important; }
.sr-only   {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.text-muted   { color: var(--ink-muted); }
.text-accent  { color: var(--accent); }
.text-sm      { font-size: 0.875rem; }
.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }
