/* FigureSkate — vanilla CSS, no build step. */

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #1c2733;
  --muted: #5c6b7a;
  --accent: #1d6fb8;
  --accent-dark: #155a96;
  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --err: #c0332b;
  --err-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --border: #d9e2ec;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* --- header / nav --- */
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.nav-links a { color: var(--accent); text-decoration: none; margin-left: 1.2rem; }
.nav-links a:hover { text-decoration: underline; }

main.container { padding-top: 1.5rem; padding-bottom: 3rem; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; padding: 1rem 0; }

/* --- shared bits --- */
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; color: var(--muted); margin-top: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--accent-dark); }
.bv { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 0.45rem 0.9rem; border-radius: 6px; cursor: pointer;
  text-decoration: none; font-size: 0.95rem;
}
.btn:hover { background: var(--accent-dark); }
.btn-subtle { background: #e8eef5; color: var(--ink); }
.btn-subtle:hover { background: #d7e2ee; }

.banner { border-radius: 8px; padding: 0.6rem 1rem; margin: 1rem 0; }
.banner-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dfae; }

.breadcrumb { color: var(--muted); margin-bottom: 0.5rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

.hero { text-align: center; padding: 2rem 0 1rem; }
.hero p { color: var(--muted); max-width: 46em; margin: 0.5rem auto 0; }

/* --- home: level grid --- */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.level-card h2 { margin-top: 0; }
.level-code {
  background: var(--accent); color: #fff; border-radius: 6px;
  padding: 0.1rem 0.45rem; font-size: 0.85rem; vertical-align: middle;
}

/* --- builder --- */
.builder-header { margin-bottom: 1rem; }
.builder-header h1 { margin-bottom: 0.2rem; }
.notes { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0; padding-left: 1.2rem; }
.notes li { margin-bottom: 0.15rem; }
.builder-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 950px) { .builder-grid { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.panel h2 { margin-top: 0; }

.palette { list-style: none; margin: 0 0 1rem; padding: 0; }
.palette li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid #eef2f7; }
.palette-name { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-add {
  width: 1.6rem; height: 1.6rem; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; flex: none;
}
.palette-add:hover { background: var(--accent-dark); }

#program-list { list-style: none; padding: 0; margin: 0; }
.program-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.3rem; border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}
.program-item:hover { background: #f2f7fc; }
.program-detail { list-style: none; }
.program-detail .element-detail {
  margin: 0.3rem 0 0.6rem; padding: 0.6rem 0.9rem;
  background: #f8fbfe;
}
.program-detail .element-detail h2 { font-size: 1rem; margin-bottom: 0.2rem; }
.program-detail .element-detail p { margin: 0.3rem 0; font-size: 0.9rem; }
.program-item .pos { color: var(--muted); width: 1.4rem; text-align: right; }
.program-item .pname { color: var(--muted); font-size: 0.9rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; gap: 0.25rem; }
.item-actions button {
  border: 1px solid var(--border); background: #fff; border-radius: 6px;
  width: 1.7rem; height: 1.7rem; cursor: pointer; color: var(--ink);
}
.item-actions button:hover:not(:disabled) { background: #eef4fa; }
.item-actions button:disabled { opacity: 0.35; cursor: default; }
.program-actions { display: flex; gap: 0.5rem; margin-top: 0.8rem; }

/* --- combination builder --- */
.combo-builder { border: 1px dashed var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 1rem; }
.combo-builder h3 { margin-top: 0; }
.combo-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.combo-row select {
  max-width: 11rem; padding: 0.35rem 0.4rem; font-size: 0.9rem;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}

/* --- validation panel --- */
.checks { list-style: none; padding: 0; margin: 0; }
.check { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.35rem 0.5rem; border-radius: 6px; margin-bottom: 0.3rem; }
.check .mark { font-weight: 700; width: 1rem; flex: none; }
.check.ok { background: var(--ok-bg); color: var(--ok); }
.check.error { background: var(--err-bg); color: var(--err); }
.check.warning { background: var(--warn-bg); color: var(--warn); }

.score { border-top: 1px solid var(--border); margin-top: 0.8rem; padding-top: 0.8rem; }
.score-total { font-size: 1.1rem; }
.threshold-table { border-collapse: collapse; margin: 0.4rem 0; font-size: 0.9rem; }
.threshold-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; padding: 0.15rem 0.6rem 0.15rem 0; border-bottom: 1px solid var(--border); }
.threshold-table td { padding: 0.2rem 0.6rem 0.2rem 0; border-bottom: 1px solid #eef2f7; }
.threshold-table td span { white-space: nowrap; margin-right: 0.4rem; }
.threshold-table .ok { color: var(--ok); font-weight: 600; }
.threshold-table .no { color: var(--muted); }

/* --- library --- */
.search {
  width: 100%; padding: 0.6rem 0.9rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; margin: 0.5rem 0 1rem;
}
.library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 800px) { .library-grid { grid-template-columns: 1fr; } }
.library-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.library-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px solid #eef2f7; }
.linklike { background: none; border: none; padding: 0; cursor: pointer; color: var(--ink); font-size: 0.95rem; text-align: left; }
.linklike:hover .code { text-decoration: underline; }
.element-detail h1, .element-detail h2 { margin-top: 0; }
.element-detail .code { font-size: 1em; }

/* --- education --- */
.formula { font-size: 1.15rem; font-weight: 600; background: #eef4fa; padding: 0.6rem 1rem; border-radius: 8px; display: inline-block; }
.code-table { list-style: none; padding: 0; }
.code-table li { padding: 0.2rem 0; }
.code-table .code { display: inline-block; min-width: 3.2rem; }
.glossary dt { font-weight: 700; margin-top: 0.6rem; }
.glossary dd { margin: 0 0 0 1.2rem; color: var(--muted); }

/* htmx indicator */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
