/* Sources & Reports — styles
   Idea: a clean page like a fact file; the only bright colour is highlighter yellow, used only to signal "has sources". */
:root {
  --ink: #13222f;
  --ink-2: #4a5a68;
  --paper: #f2f5f8;
  --card: #ffffff;
  --line: #d6dde4;
  --blue: #1f5fa8;
  --blue-d: #174a85;
  --mark: #ffd84d;
  --mark-ink: #3b2f00;
  --danger: #b3261e;
  --ok: #1e7a4f;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
:focus-visible { outline: 3px solid #7fb2ee; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
code { background: #e7edf3; padding: 1px 6px; border-radius: 3px; font-size: .9em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 8px; padding-bottom: 56px; }

/* Header */
.site-head { background: var(--ink); color: #fff; }
.site-head .wrap { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; text-decoration: underline; }
.search { display: flex; gap: 8px; }
.search input { width: min(320px, 56vw); }

/* Form elements */
input[type=text], input[type=search], input[type=url], input[type=password], input[type=date], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  padding: 8px 12px;
}
textarea { resize: vertical; line-height: 1.65; }
input[type=file] { font: inherit; max-width: 100%; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inline-row { display: flex; gap: 8px; }
.inline-row input { flex: 1; min-width: 0; }
.check { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 12px; }

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.5;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 4px;
  padding: 7px 16px;
}
.btn:hover { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }
.btn-line { background: transparent; color: var(--blue); }
.btn-line:hover { background: #e4eef9; color: var(--blue-d); }
.btn-light { background: #fff; color: var(--ink); border-color: #fff; }
.btn-light:hover { background: #e4eef9; color: var(--ink); border-color: #e4eef9; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.linkbtn { font: inherit; background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-decoration: underline; }
.linkbtn.danger, .danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }

/* Home */
.hero { padding: 40px 0 22px; max-width: 46rem; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.4; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.result-line { margin: 0 0 18px; color: var(--ink-2); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0b1620; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tab {
  position: absolute; left: 0; bottom: 12px;
  background: var(--mark); color: var(--mark-ink);
  font-weight: 600; font-size: .85rem; line-height: 1.4;
  padding: 3px 12px 3px 12px;
  border-radius: 0 3px 3px 0;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h2 { font-family: var(--serif); font-size: 1.08rem; line-height: 1.55; margin: 0; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.meta { color: var(--ink-2); font-size: .88rem; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
p.actions { margin: 12px 0 0; }

.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 34px; color: var(--ink-2); }
.empty { background: var(--card); border: 1px dashed #aebbc7; border-radius: 6px; padding: 32px 24px; max-width: 40rem; }
.empty h1, .empty h2 { font-family: var(--serif); margin: 0 0 6px; font-size: 1.3rem; }
.empty p { margin: 0 0 10px; color: var(--ink-2); }

/* Video detail page */
.crumb { margin: 18px 0 6px; font-size: .92rem; }
.detail-head { max-width: 760px; margin-bottom: 8px; }
.detail-head h1 { font-family: var(--serif); font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.5; margin: 6px 0 4px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #0b1620; border-radius: 6px; overflow: hidden; margin: 16px 0 8px; }
.video-frame iframe, .yt-lite { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-lite { padding: 0; background: none; cursor: pointer; }
.yt-lite img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-lite .play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; margin: -24px 0 0 -34px; background: rgba(19, 34, 47, .86); border-radius: 12px; }
.yt-lite .play::after { content: ''; position: absolute; left: 27px; top: 14px; border-left: 17px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.yt-lite:hover .play { background: var(--blue); }
.lead { font-size: 1.08rem; color: #22313e; margin: 14px 0 0; }

.detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 40px; margin-top: 28px; align-items: start; }
.detail h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 12px; }
.notes h3 { font-family: var(--serif); font-size: 1.1rem; margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.notes h3:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.notes p { margin: 0 0 12px; max-width: 42rem; }
.notes-list { margin: 0 0 14px; padding-left: 1.3em; max-width: 42rem; }
.notes-list li { margin-bottom: 8px; }

.side { display: flex; flex-direction: column; gap: 28px; }
.pdf-box { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--mark); border-radius: 0 0 6px 6px; padding: 16px 18px 18px; }
.pdf-box h2 { font-size: 1.15rem; margin-bottom: 6px; }
.pdf-box p { margin: 0 0 8px; }

.src-list { list-style: none; margin: 0; padding: 0; }
.src { border-left: 3px solid var(--mark); padding: 2px 0 2px 12px; margin: 0 0 16px; display: flex; flex-direction: column; gap: 1px; }
.src a, .src-title { font-weight: 600; overflow-wrap: anywhere; }
.src .pub { font-size: .88rem; color: var(--ink-2); }
.src .note { font-size: .92rem; }

.site-foot { border-top: 1px solid var(--line); color: var(--ink-2); font-size: .9rem; }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 28px; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; border: 1px solid; }
.flash.ok { background: #e6f4ec; border-color: #9fd2b6; color: #12563a; }
.flash.err { background: #fdeceb; border-color: #efb1ad; color: #8c1d17; }

/* Admin */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; }
.admin-nav a, .admin-nav .linkbtn { color: #dbe6f1; text-decoration: none; font-size: .95rem; }
.admin-nav a:hover, .admin-nav .linkbtn:hover { color: #fff; text-decoration: underline; }
.admin-nav a[aria-current=page] { color: #fff; box-shadow: inset 0 -3px 0 var(--mark); }
.page-title { font-family: var(--serif); font-size: 1.6rem; margin: 24px 0 16px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { font-size: .9rem; color: var(--ink-2); background: #f7f9fb; font-weight: 600; }
.admin-table tr:last-child td { border-bottom: 0; }
.vcell { display: flex; gap: 12px; align-items: center; }
.vcell img, .noimg { width: 96px; height: 54px; object-fit: cover; border-radius: 3px; background: #0b1620; flex: none; display: block; }
.noimg { background: #cfd8e1; }
.badge { display: inline-block; font-size: .85rem; padding: 1px 10px; border-radius: 99px; border: 1px solid; }
.badge.on { background: #e6f4ec; border-color: #9fd2b6; color: #12563a; }
.badge.off { background: #f1f3f5; border-color: #c7cfd6; color: #46525d; }
.row-actions { white-space: nowrap; }
.row-actions > * { margin-right: 12px; }

.form .panel { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px 6px; margin-bottom: 20px; }
.form .panel h2 { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 14px; }
.form .panel > .btn { margin-bottom: 18px; }
.form.narrow { max-width: 420px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.thumb-preview { margin: 0 0 16px; }
.thumb-preview img { width: 240px; height: 135px; object-fit: cover; border-radius: 4px; background: #0b1620; display: block; }
.src-row { border: 1px solid var(--line); border-left: 3px solid var(--mark); border-radius: 4px; padding: 10px 14px 8px; margin: 0 0 14px; background: #fbfcfd; }
.src-row legend { font-weight: 600; padding: 0 6px; }
.src-tools { display: flex; gap: 16px; padding-bottom: 6px; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-box { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 26px 24px 20px; }
.login-box h1 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 2px; }
.login-box p { margin: 6px 0 16px; }

@media (max-width: 820px) {
  .detail { grid-template-columns: 1fr; gap: 28px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .inline-row { flex-direction: column; }
}
@media (max-width: 520px) {
  .search { width: 100%; }
  .search input { width: 100%; flex: 1; }
  .site-head .wrap { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
