/* Niagara Pioneer SC theme: shield green, black, silver, white. Raleway headings, Open Sans body. */
:root {
  --green: #2e9e2f;
  --green-dark: #1f7a22;
  --green-deep: #0f3d13;
  --club-bar: #349800;
  --green-bright: #0dbc03;
  --lime: #81d742;
  --black: #111315;
  --silver: #c9ced4;
  --ink: #191b1e;
  --text: #3f4650;
  --muted: #69727d;
  --line: #dde2dc;
  --bg: #f3f5f2;
  --card: #fff;
  --danger: #ae0217;
  --font-head: Raleway, "Segoe UI", system-ui, sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0; color: var(--ink); }
/* Raleway defaults to old-style figures ("U12" wobbles); use lining numbers everywhere. */
body, h1, h2, h3, h4, .btn, .datebadge, .brand-text { font-variant-numeric: lining-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }
.inner { max-width: 1160px; margin: 0 auto; padding-inline: 16px; }

/* ---------- Site chrome ---------- */
.topbar { background: var(--club-bar); color: #fff; font-size: .78rem; }
.topbar .inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-block: 6px; }
.topbar a { color: #fff; text-decoration: none; opacity: .9; }
.topbar a:hover { opacity: 1; text-decoration: underline; }

.site-head { background: #fff; border-bottom: 1px solid var(--line); }
.site-head .inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.crest { width: 40px; height: 46px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--font-head); font-weight: 900; font-style: italic; font-size: 1.2rem; letter-spacing: .02em; text-transform: uppercase; color: var(--black); }
.brand-text small { font-family: var(--font-head); font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.site-head nav { display: flex; gap: 22px; }
.site-head nav a {
  font-family: var(--font-head); font-weight: 700; font-size: .95rem; color: var(--ink);
  text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent;
}
.site-head nav a:hover { color: var(--green); }
.site-head nav a.active { color: var(--green); border-color: var(--green); }

main { max-width: 1160px; margin: 0 auto; padding: 0 16px 64px; }
.site-foot { border-top: 4px solid var(--green); background: var(--black); color: #b9c0c7; font-size: .8rem; }
.site-foot .inner { padding-block: 16px; }

/* Dark band used for page titles */
.band {
  margin: 0 -16px 24px; padding: 28px 16px; color: #fff;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.035) 0 18px, transparent 18px 36px),
    linear-gradient(120deg, var(--black) 0%, #16261a 55%, var(--green-deep) 100%);
  border-bottom: 4px solid var(--green);
}
.band h1 { color: #fff; }
.eyebrow { margin: 0 0 4px; font-family: var(--font-head); font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--lime); }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 6px 16px; border: 2px solid var(--black); border-radius: 4px; background: #fff; color: var(--black);
  font-family: var(--font-head); font-size: .82rem; font-weight: 800; letter-spacing: .03em; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--black); color: #fff; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.band .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.band .btn:hover { background: #fff; color: var(--black); }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: .76rem; }
.chip {
  border: 1px dashed #9aa3ad; background: #fff; border-radius: 999px; padding: 4px 11px;
  font-size: .78rem; font-weight: 600; cursor: pointer; color: var(--ink);
}
.chip:hover { border-style: solid; border-color: var(--green); color: var(--green-dark); }

.bar {
  background: var(--black); color: #fff; font-size: 1.05rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; padding: 11px 16px; display: flex; align-items: baseline; gap: 10px;
  border-left: 6px solid var(--green);
}
.bar small { font-family: var(--font-body); font-size: .75rem; font-weight: 600; color: var(--silver); letter-spacing: .02em; text-transform: none; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .lib-filters input, .lib-filters select {
  width: 100%; padding: 8px 10px; border: 1px solid #c3cac1; border-radius: 4px; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty { color: var(--muted); padding: 14px 0; list-style: none; }

/* ---------- Planner ---------- */
.page-title p { margin: 6px 0 0; color: #d5dbd3; max-width: 60ch; }
.page-title h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; font-style: italic; text-transform: uppercase; }

.builder { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); }
.panel-body { padding: 16px; }
.plan { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
@media (max-width: 880px) {
  .builder { grid-template-columns: 1fr; }
  .plan { position: static; max-height: none; order: -1; }
}

.timeline { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 4px 0 10px; }
.timeline .seg { background: var(--cat); border-right: 2px solid #fff; min-width: 0; }
.timeline .seg:last-child { border-right: 0; }
.cat-passing { --cat: var(--green); }
.cat-first-touch { --cat: var(--lime); }
.cat-block { --cat: #9aa3ad; }
[class*="cat-"] { --cat-fallback: var(--green-dark); }

.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 40px; border-radius: 6px; }
.plan-list.is-empty {
  min-height: 120px; border: 2px dashed #c3cac1; display: grid; place-items: center; padding: 16px;
  text-align: center; color: var(--muted); font-size: .9rem;
}
.plan-list.is-empty::before { content: attr(data-empty); }
.plan-list.drop-active { outline: 2px dashed var(--lime); outline-offset: 4px; }
.plan-list.drop-end::after { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--green-bright); }

.plan-item {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 8px 10px 8px 4px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--cat, var(--green));
  border-radius: 4px;
}
.plan-item.drop-before::before {
  content: ""; position: absolute; left: -5px; right: 0; top: -7px; height: 4px; border-radius: 2px; background: var(--green-bright);
}
.plan-item.dragging { background: #f1f8ed; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); z-index: 2; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }

.handle {
  display: grid; place-items: center; width: 30px; height: 44px; border: 0; background: transparent; color: #8b949d;
  border-radius: 4px; cursor: grab; touch-action: none;
}
.handle:hover, .handle:focus-visible { color: var(--black); background: #eef1ec; }
.pi-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pi-num {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--black); color: #fff; font-size: .72rem; font-weight: 700;
}
.pi-name { font-family: var(--font-head); font-weight: 800; color: var(--ink); font-size: .95rem; overflow-wrap: anywhere; }
.pi-block-name { flex: 1; min-width: 0; font-family: var(--font-head); font-weight: 800; font-size: .95rem; padding: 3px 6px; border: 1px solid #c3cac1; border-radius: 4px; }
.pi-time { display: block; margin: 2px 0 6px 30px; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.pi-note { width: 100%; padding: 5px 8px; font-size: .84rem; border: 1px solid #d6dbd4; border-radius: 4px; }
.pi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pi-min { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
.pi-min input { width: 56px; padding: 5px 6px; border: 1px solid #c3cac1; border-radius: 4px; text-align: right; }
.icon { width: 30px; height: 30px; border: 1px solid #c3cac1; border-radius: 4px; background: #fff; cursor: pointer; font-weight: 700; }
.icon:hover { border-color: var(--black); }
.icon.danger { color: var(--danger); }

.block-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: .78rem; color: var(--muted); }
.plan-total { margin: 12px 0; font-size: .95rem; color: var(--ink); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.lib-filters { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
@media (max-width: 480px) { .lib-filters { grid-template-columns: 1fr; } }
.select-bar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 12px; background: #eef6ea; border: 1px solid #cfe5c6; border-radius: 4px; font-size: .84rem; color: var(--ink);
}
.select-bar .grow { flex: 1; min-width: 12ch; }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lib-card {
  display: grid; grid-template-columns: auto 132px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: grab;
}
.lib-card:hover { border-color: #b8c7b3; }
.lib-card.is-selected { border-color: var(--green); background: #f3faf0; box-shadow: inset 4px 0 0 var(--green); }
.lib-card.drag-source { opacity: .5; }
.lib-check { display: grid; place-items: center; width: 28px; height: 28px; cursor: pointer; }
.lib-check input { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.lib-thumb { width: 132px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; background: #dde3da; }
.lib-info h3 { font-size: 1rem; font-weight: 800; }
.meta { margin: 2px 0 6px; font-size: .74rem; color: var(--green-dark); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.lib-sum { margin: 0 0 8px; font-size: .86rem; }
.lib-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 560px) {
  .lib-card { grid-template-columns: auto minmax(0, 1fr); }
  .lib-thumb { grid-column: 2; width: 100%; }
  .lib-info { grid-column: 2; }
}

/* ---------- Shared practice view ---------- */
.practice-head { display: flex; align-items: center; gap: 24px; }
.ph-text { flex: 1; text-align: center; }
.practice-head h1 { font-size: clamp(1.6rem, 4.4vw, 2.5rem); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }
.long-date { margin: 6px 0 0; color: #d5dbd3; }
.practice-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.datebadge { flex: none; display: flex; flex-direction: column; width: 96px; text-align: center; background: #fff; border: 2px solid #fff; border-radius: 4px; overflow: hidden; }
.datebadge .mon { background: var(--green); color: #fff; font-family: var(--font-head); font-weight: 800; letter-spacing: .12em; padding: 3px 0; }
.datebadge .day { font-family: var(--font-head); font-weight: 900; font-size: 1.7rem; line-height: 1.2; color: var(--black); }
.datebadge .yr { font-size: .82rem; padding-bottom: 4px; color: var(--muted); }

.notes { background: #fff; border: 1px solid var(--line); border-top: 0; padding: 16px; margin-bottom: 28px; }
.notes-text { margin: 0 0 14px; color: var(--ink); }
.table-wrap { overflow-x: auto; }
.run-sheet { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.run-sheet th { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--black); }
.run-sheet td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.run-sheet .t { white-space: nowrap; text-align: right; }
.run-sheet a { color: var(--ink); font-weight: 700; text-decoration: none; }
.run-sheet a:hover { color: var(--green); text-decoration: underline; }
.run-sheet tr.is-block a { font-weight: 600; color: var(--muted); }
.run-sheet tfoot td { font-weight: 800; border-bottom: 0; color: var(--ink); }
.row-note { font-size: .82rem; color: var(--muted); }
.num-cell { width: 32px; color: var(--muted); font-weight: 700; }

.drill-card { background: #fff; border: 1px solid var(--line); padding: 20px; margin: 0 0 20px; scroll-margin-top: 12px; }
.drill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--green); }
.drill-head h3 { flex: 1; font-size: 1.3rem; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
.num { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--black); color: #fff; font-weight: 700; font-size: .85rem; }
.time-range { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.block-card { padding: 12px 20px; background: #f7f8f6; border-style: dashed; }
.block-card .drill-head { margin: 0; padding: 0; border: 0; }
.block-card .drill-head h3 { font-size: 1.05rem; color: var(--muted); }
.block-card .coach-note { margin: 10px 0 0; }

.drill-media { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .drill-media { grid-template-columns: 1fr; } }
.diagram-wrap { margin: 0; }
.diagram { display: block; width: 100%; height: auto; border-radius: 3px; font-family: var(--font-body); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend svg { width: 30px; height: 12px; background: #3d8f50; border-radius: 2px; }

.video { display: flex; flex-direction: column; gap: 6px; }
.video-facade, .video iframe {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0;
  border-radius: 3px; overflow: hidden; background: #000; cursor: pointer;
}
.video.is-short .video-facade, .video.is-short iframe { aspect-ratio: 9 / 16; max-width: 260px; margin-inline: auto; }
.video-facade img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.play { position: absolute; inset: 0; margin: auto; width: 64px; height: 44px; border-radius: 12px; background: #e62117; }
.play::after { content: ""; position: absolute; left: 26px; top: 13px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; }
.video-facade:hover .play { background: #f00; }
.video-link { font-size: .8rem; color: var(--muted); }
.video.is-short .video-link { text-align: center; }

.drill-summary { margin: 16px 0 8px; font-size: 1rem; color: var(--ink); }
.tags { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: #e7f4e3; color: var(--green-dark); padding: 3px 9px; border-radius: 999px; }
.tags li:first-child { background: var(--black); color: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0 0 12px; }
.facts dt { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: .9rem; color: var(--ink); }
.coach-note { background: #f1f9ec; border-left: 4px solid var(--lime); padding: 8px 12px; margin: 0 0 12px; color: var(--ink); }

.full { border-top: 1px solid var(--line); margin-top: 8px; }
.full summary {
  cursor: pointer; display: inline-block; margin: 12px 0 4px; padding: 6px 14px; border: 2px solid var(--black); border-radius: 4px;
  font-family: var(--font-head); font-size: .8rem; font-weight: 800; color: var(--black); list-style: none;
}
.full summary::-webkit-details-marker { display: none; }
.full summary:hover, .full[open] summary { background: var(--black); color: #fff; }
.full h4 { margin: 14px 0 4px; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--green-dark); }
.full ul, .full ol { margin: 0; padding-left: 22px; }
.full li { margin: 3px 0; }
.source { font-size: .8rem; color: var(--muted); margin: 14px 0 0; }
.length { margin: 14px 0 0; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.length strong { color: var(--ink); font-size: 1rem; }

/* ---------- Dialog & toast ---------- */
.preview { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 6px; }
.preview::backdrop { background: rgba(10, 15, 10, .65); }
.preview form { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 8px; background: #fff; z-index: 1; border-bottom: 1px solid var(--line); }
.preview .drill-card { border: 0; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--black); color: #fff;
  border-left: 5px solid var(--green); padding: 10px 16px; border-radius: 4px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .practice-head { gap: 12px; }
  .ph-text { text-align: left; }
  .practice-actions { justify-content: flex-start; }
  .datebadge { width: 68px; align-self: flex-start; }
  .datebadge .day { font-size: 1.25rem; }
  .drill-card { padding: 14px; }
  .brand-text b { font-size: 1.05rem; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .site-head, .site-foot, .no-print, .toast, .video-facade, .video iframe, .full summary { display: none !important; }
  main { padding: 0; max-width: none; }
  .band { margin: 0 0 12pt; padding: 0 0 8pt; background: none; color: #000; border-bottom: 3px solid var(--green); }
  .band h1 { color: #000; }
  .long-date, .eyebrow { color: #333; }
  .datebadge { border-color: #000; }
  .bar { background: #fff; color: #000; border-left: 0; border-bottom: 2px solid #000; padding: 6px 0; }
  .notes { border: 0; padding: 8px 0; }
  .drill-card { border: 0; border-top: 1px solid #999; padding: 10pt 0 0; margin-bottom: 16pt; break-inside: avoid-page; }
  .drill-media { grid-template-columns: 1.4fr 1fr; }
  .diagram, .datebadge .mon, .num, .legend svg, .tags li, .drill-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .video-link::before { content: "Video: "; }
  .video-link::after { content: " — " attr(href); word-break: break-all; }
  .video.is-short .video-link { text-align: left; }
  .full { border: 0; }
}
