/* --------------------------------------- Keyboard shortcuts ------------------------------- *
   Keyboard shortcuts for regions in VS Code:
     Ctrl+K Ctrl+8   Fold all regions
     Ctrl+K Ctrl+9   Unfold all regions
     Ctrl+K Ctrl+0   Fold everything (all levels)
     Ctrl+K Ctrl+J   Unfold everything (all levels)
     Ctrl+K Ctrl+[   Fold block under cursor
     Ctrl+K Ctrl+]   Unfold block under cursor
 * ---------------------------------------------------------------------------------------- */

/* ------------------- Self-Inflicted Antisemitism — shared stylesheet ---------------------- *
   Editorial palette, serif display, mono metadata, warm paper.
   Used by index.html, about.html, admin/admin.html, admin/submission.html
*/

/* --------------------------------------------- Contents ----------------------------------- *
   1. Design tokens
   2. Base
   3. Shared chrome
        3a. Masthead
        3b. Toolbar (+ toolbar menu)
        3c. Main
        3d. Colophon
   4. Shared components (nav-link, about-btn)
   5. Index page
        5a. Incidents
        5b. Incident body
        5c. Sources
        5d. Empty / error states
   6. About page
        6a. Sections
        6b. Contact list
        6c. Downloads
        6d. Nested JSON download group
   7. Admin / submission forms
        7a. Sections
        7b. Fields
        7c. URL field open arrow
        7d. Buttons
        7e. Source cards
        7f. Output
        7g. Country combobox
        7h. Toast
   8. Mobile (<= 640px)
   9. Reduced motion
 */

/* #region 1. Design tokens */

:root {
  --paper:    #f6f3ec;
  --paper-2:  #efeae0;
  --ink:      #16130f;
  --ink-2:    #3a352c;
  --ink-3:    #6b6456;
  --rule:     #cfc6b4;
  --rule-2:   #b8ad97;
  --accent:   #7a1f14;
  --accent-2: #a8442f;
  --ok:       #1f5c2e;
  --warn:     #8a5a00;

  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:  "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
/* #endregion */

/* #region 2. Base */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  font-optical-sizing: auto;
  overflow-x: clip;
}
/* #endregion */

/* #region 3. Shared chrome — masthead, toolbar, main, colophon */

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 3px double var(--ink);
  background: var(--paper);
}
.masthead-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 32px 28px;
}
.kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 72px;
  line-height: .95;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ink);
  font-style: italic;
  overflow-wrap: anywhere;
}
.standfirst {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0;
}
.standfirst::first-letter {
  font-size: 1.05em;
  font-weight: 600;
}

/* Masthead links (About page has linked title/kicker) */

.masthead h1 a,
.masthead .kicker a {
  color: inherit;
  text-decoration: none;
}
.masthead h1 a:hover,
.masthead .kicker a:hover {
  color: var(--accent);
}

/* Record count next to standfirst */

.record-count {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ---------- Toolbar ---------- */

.toolbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
.toolbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
}

.toolbar input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-2);
  padding: 6px 2px;
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--ink);
  outline: none;
}
.toolbar input[type="search"]::placeholder {
  color: var(--ink-3);
  font-style: italic;
}
.toolbar input[type="search"]:focus {
  border-bottom-color: var(--ink);
}

/* Burger button + dropbar */

.toolbar-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.toolbar-burger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-bottom-color .15s;
}
.toolbar-burger:hover {
  background: var(--paper-2);
  border-bottom-color: var(--accent);
}
.toolbar-burger[aria-expanded="true"] {
  background: var(--accent);
  border-bottom-color: transparent;
}

.burger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  transition: background .15s;
}
.toolbar-burger[aria-expanded="true"] .burger-line {
  background: var(--paper);
}

.toolbar-dropbar {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  box-shadow: 0 6px 24px rgba(22, 19, 15, .12), 0 2px 6px rgba(22, 19, 15, .06);
  padding: 8px 0;
  z-index: 50;
}
.toolbar-dropbar[hidden] { display: none; }

.toolbar-dropbar-group {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  border-bottom: 1px solid var(--rule);
}
.toolbar-dropbar-group:last-child { border-bottom: none; }

.toolbar-dropbar-group label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.toolbar-dropbar-group select {
  background: transparent;
  border: 1px solid var(--rule-2);
  padding: 8px 28px 8px 10px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 12px center, right 7px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
  outline: none;
  width: 100%;
}
.toolbar-dropbar-group select:focus { border-color: var(--ink); }

.toolbar-dropbar-group button {
  padding: 6px 6px;
  text-align: left;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.toolbar-dropbar-group button:hover {
  color: var(--paper);
  background: var(--accent);
  border-bottom-color: transparent;
}

/* Menu button + centered modal */

.toolbar-menu-btn {
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 34px;
  background: transparent;
  border: 1px solid var(--rule-2);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color .28s cubic-bezier(.5,.1,.2,1),
              border-color .28s cubic-bezier(.5,.1,.2,1);
}
.toolbar-menu-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.5,.1,.2,1);
  z-index: 0;
  pointer-events: none;
}
.toolbar-menu-btn:hover {
  color: var(--paper);
  border-color: var(--accent);
}
.toolbar-menu-btn:hover::before {
  transform: translateX(0);
}

.toolbar-menu-btn > * {
  position: relative;
  z-index: 1;
}

.toolbar-menu-btn .menu-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: aboutPulse 2.4s ease-in-out infinite;
  transition: background .28s cubic-bezier(.5,.1,.2,1);
}
.toolbar-menu-btn:hover .menu-dot {
  background: var(--paper);
  animation: none;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(246, 243, 236, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 90;
}
.menu-backdrop[hidden] { display: none; }

.menu-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 40px));
  background: var(--paper);
  border: 1px solid var(--rule-2);
  box-shadow: 0 12px 40px rgba(22, 19, 15, .18), 0 2px 8px rgba(22, 19, 15, .08);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
}
.menu-modal[hidden] { display: none; }

.menu-modal .nav-link {
  font-size: 13px;
  padding: 8px 0;
}

/* ---------- Main ---------- */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 32px 80px;
}

/* ---------- Colophon ---------- */

.colophon {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 32px 60px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.colophon p { margin: 0; }
/* #endregion */

/* #region 4. Shared components — nav-link, about-btn */

.nav-link {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 6px 2px;
}
.nav-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.about-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--rule-2);
  background: transparent;
  position: relative;
  overflow: hidden;
  transition: color .2s, border-color .2s;
  cursor: pointer;
}
.about-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform .28s cubic-bezier(.5,.1,.2,1);
  z-index: 0;
}
.about-btn:hover { color: var(--paper); border-color: var(--accent); }
.about-btn:hover::before { transform: translateX(0); }

.about-btn > * { position: relative; z-index: 1; }

.about-btn .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transition: background .2s;
  animation: aboutPulse 2.4s ease-in-out infinite;
}
.about-btn:hover .dot {
  background: var(--paper);
  animation: none;
}

@keyframes aboutPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .35; transform: scale(.75); }
}

.about-btn.active {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}
.about-btn.active .dot {
  background: var(--paper);
  animation: none;
}
/* #endregion */

/* #region 5. Index page — incidents and sources */

/* ---------- Incidents ---------- */

.incident {
  border-bottom: 1px solid var(--rule);
  padding: 36px 0 28px;
}
.incident:last-child { border-bottom: none; }

.incident-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px 24px;
  cursor: pointer;
  align-items: start;
  -webkit-tap-highlight-color: transparent;
}
.incident-head:hover .incident-title { color: var(--accent); }

.incident-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-3);
  letter-spacing: .02em;
  padding-top: 6px;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

/* Permalink button inside the SN column */

.incident-permalink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}

.incident-permalink:hover {
  background: transparent;
  border: none;
  opacity: 1;
}

.incident-permalink:active {
  background: transparent;
  transform: scale(0.85);
  opacity: 1;
}

.incident-permalink.copied {
  background: transparent;
  opacity: 1;
  animation: permalink-pulse .4s ease-out;
}

@keyframes permalink-pulse {
  0%   { transform: scale(0.8); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.permalink-icon {
  display: block;
  width: 14px;
  height: 14px;
}

/* Flash highlight when an incident is opened via permalink */

.incident.highlighted {
  animation: incident-flash 2s ease-out;
}

@keyframes incident-flash {
  0%   { background: var(--paper-2); }
  100% { background: transparent; }
}

.incident-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  transition: color .15s;
  max-width: 48rem;
}
.incident-meta {
  grid-column: 2;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}
.incident-meta .sep { color: var(--rule-2); margin: 0 8px; }

.chev { display: none; }

/* ---------- Incident body ---------- */

.incident-body {
  display: none;
  grid-column: 2;
  margin-top: 20px;
}
.incident.open .incident-body { display: block; }

.summary-block { margin-bottom: 24px; }
.summary-block h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}
.summary-block p {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 90ch;
  overflow-wrap: anywhere;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}
.summary-block p::first-letter {
  font-weight: 600;
  font-size: 1.02em;
}

/* ---------- Sources ---------- */

.sources {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--rule);
}

.source {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 4px 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.source .tag {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  align-self: start;
  padding-top: 4px;
}
.source.Original .tag { color: var(--accent); }
.source.Reveal   .tag { color: var(--ink); }
.source.Neutral  .tag { color: var(--ink-3); }
.source.Original .tag::before { content: "● "; font-size: 8px; vertical-align: 2px; }
.source.Reveal   .tag::before { content: "● "; font-size: 8px; vertical-align: 2px; }
.source.Neutral  .tag::before { content: "○ "; font-size: 8px; vertical-align: 2px; }

.source .outlet {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.source .headline {
  grid-column: 2;
  grid-row: 2;
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.45;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.source a {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule-2);
  padding-bottom: 1px;
  word-break: break-all;
  overflow-wrap: anywhere;
  justify-self: start;
  max-width: 100%;
}
.source a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Empty / error states ---------- */

.empty {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  text-align: center;
  padding: 80px 20px;
  font-size: 18px;
}
.error {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  padding: 32px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
/* #endregion */

/* #region 6. About page */

/* ---------- Sections ---------- */

.about-section {
  border-bottom: 1px solid var(--rule);
  padding: 40px 0 32px;
}
.about-section:last-child { border-bottom: none; }

.about-section h2 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 16px;
  line-height: 1.2;
}

.about-section h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 28px 0 10px;
  line-height: 1.25;
}

.about-section p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 16px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}
.about-section p:last-child { margin-bottom: 0; }

.about-section strong {
  font-weight: 600;
  color: var(--ink);
}

.about-section a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 1px;
}
.about-section a:hover {
  border-bottom-color: var(--accent);
}

.about-section code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink);
}

.inline-num {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink);
  font-size: 1.05em;
}

/* ---------- Submission bullet list ---------- */

.submit-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.submit-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}
.submit-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-3);
}
.submit-list li:last-child { margin-bottom: 0; }

/* ---------- Contact list ---------- */

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.contact-list li {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.contact-list li:last-child { border-bottom: none; }

.contact-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  min-width: 100px;
  flex-shrink: 0;
}

.contact-note {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 15px;
  margin-top: 8px;
}

/* ---------- Downloads ---------- */

.download-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.download-btn {
  display: block;
  border: 1px solid var(--rule-2);
  border-left: 4px solid var(--accent);
  padding: 18px 20px;
  text-decoration: none;
  background: var(--paper);
  transition: background .15s, border-color .15s;
}
.download-btn:hover {
  background: var(--paper-2);
  border-color: var(--ink);
  border-left-color: var(--accent);
}

.download-label {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
}

.download-meta {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
}

/* ---------- Nested JSON download group ---------- */

.download-group {
  cursor: default;
}
.download-group:hover {
  background: var(--paper);
  border-color: var(--rule-2);
}

.download-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.download-sub-btn {
  display: block;
  border: 1px solid var(--rule-2);
  padding: 10px 12px;
  text-decoration: none;
  background: var(--paper);
  transition: background .15s, border-color .15s, color .15s;
}
.download-sub-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.download-sub-name {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
  transition: color .15s;
}
.download-sub-btn:hover .download-sub-name {
  color: var(--paper);
}
/* #endregion */

/* #region 7. Admin / submission forms */

/* ---------- Sections ---------- */

.admin-section {
  border-bottom: 1px solid var(--rule);
  padding: 28px 0;
}
.admin-section:last-child { border-bottom: none; }
.admin-section h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; }

.section-note {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 20px;
  max-width: 68ch;
}

/* ---------- Fields ---------- */

.field-row {
  margin-bottom: 18px;
}
.field-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row label,
.source label {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.field-row .hint,
.source .hint {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-3);
  font-size: 12px;
  opacity: .8;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--rule-2);
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--ink);
  background: #fffefb;
}

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}


textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}

/* ---------- URL field with open-in-new-tab arrow ---------- */

.src-link-wrap {
  position: relative;
  display: block;
}

.src-link-wrap .src-link {
  padding-right: 40px;
}

.src-link-open {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-left: none;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}

.src-link-open:hover {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.src-link-open:active {
  background: var(--accent-2);
}

/* ---------- Buttons ---------- */

button {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid var(--rule-2);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
button:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.btn-add        { border-color: var(--ink); }
.btn-clear      { color: var(--ink-3); }
.btn-copy {
  padding: 6px 12px;
  font-size: 10px;
}
.btn-generate {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.btn-generate:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

/* ---------- Source cards ---------- */

.source-card {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}
.source-card .source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.source-card .source-head .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}
.btn-remove {
  padding: 4px 10px;
  font-size: 10px;
  color: var(--accent);
  border-color: var(--rule-2);
}
.btn-remove:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.source-grid .full { grid-column: 1 / -1; }

.add-source-row {
  margin-top: 16px;
}

/* ---------- Output (generated SQL or submission URL) ---------- */

.output-section pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: #1c1a15;
  color: #e8e2d2;
  padding: 20px;
  overflow-x: auto;
  white-space: pre;
  border: none;
  margin: 0;
}

.output-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

#copy-sql.copied {
  background: var(--ok);
  color: var(--paper);
  border-color: var(--ok);
}

/* ---------- Country combobox ---------- */

.country-field { position: relative; }

.combobox {
  position: relative;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  box-shadow: 0 4px 16px rgba(22,19,15,.10);
  z-index: 50;
}
.combobox-list[hidden] { display: none; }

.combobox-list li {
  padding: 8px 12px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.35;
}
.combobox-list li:hover,
.combobox-list li[aria-selected="true"] {
  background: var(--paper-2);
  color: var(--accent);
}
.combobox-list li .match {
  font-weight: 600;
  color: var(--accent);
}
.combobox-list li.empty {
  color: var(--ink-3);
  font-style: italic;
  cursor: default;
}
.combobox-list li.empty:hover {
  background: transparent;
  color: var(--ink-3);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  background: var(--paper-2);
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--accent);
  box-shadow: 0 6px 24px rgba(22, 19, 15, .12), 0 2px 6px rgba(22, 19, 15, .06);
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
  opacity: 1;
  transition: opacity .2s ease;
}
.toast[hidden] { display: none; }

#toast-message {
  flex: 1;
  min-width: 0;
}

.toast button {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--rule-2);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.toast button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

/* #endregion */

/* #region 8. Mobile (<= 640px) */

@media (max-width: 640px) {

  /* ---------- Base ---------- */

  body { font-size: 16px; }

  /* ---------- Masthead ---------- */

  .masthead-inner { padding: 28px 20px 20px; }
  .masthead h1 { font-size: 48px; }
  .standfirst { font-size: 16px; }

  /* ---------- Toolbar ---------- */

  .toolbar-inner {
    padding: 10px 20px;
    gap: 8px;
  }
  .toolbar input[type="search"] {
    font-size: 16px;
  }
  .toolbar-burger {
    width: 36px;
    height: 36px;
  }
  .burger-line {
    width: 16px;
  }
  .toolbar-menu-btn {
    padding: 8px 14px;
    font-size: 12px;
  }
  .toolbar-dropbar {
    right: 0;
    min-width: 220px;
    max-width: calc(100vw - 40px);
  }

  .menu-modal {
    padding: 24px 20px;
    gap: 12px;
  }
  .menu-modal .nav-link {
    padding: 10px 0;
  }

  /* ---------- Main ---------- */

  main { padding: 4px 20px 60px; }

  /* ---------- Shared components ---------- */

  .about-btn {
    padding: 8px 14px;
    font-size: 12px;
  }
  .about-btn .dot {
    width: 7px;
    height: 7px;
  }
  .nav-link {
    padding: 8px 0;
    font-size: 12px;
  }

  /* ---------- Incidents ---------- */

  .incident { padding: 28px 0 20px; }
  .incident-head {
    grid-template-columns: 44px 1fr;
    gap: 6px 16px;
  }
  .incident-num {
    font-size: 12px;
    padding-top: 4px;
  }
  .incident-title { font-size: 20px; }
  .incident-body { margin-top: 16px; }

  .summary-block p { font-size: 16px; }

  /* ---------- Sources (main page) ---------- */

  .source {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px 0;
  }
  .source .tag,
  .source .outlet,
  .source .headline,
  .source a {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
  }
  .source .tag {
    margin-top: 6px;
  }
  .source a {
    align-self: auto;
    margin-top: 6px;
    overflow-wrap: anywhere;
  }

  /* ---------- About page ---------- */

  .about-section { padding: 28px 0 24px; }
  .about-section h2 { font-size: 24px; }
  .about-section p { font-size: 16px; }

  .contact-list li {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
  .contact-label { min-width: 0; }

  .download-row { grid-template-columns: 1fr; gap: 12px; }
  .download-btn { padding: 16px; }
  .download-label { font-size: 17px; }

  /* ---------- Forms: sections ---------- */

  .admin-section h2 { font-size: 20px; }

  /* ---------- Forms: fields ---------- */

  .field-row.two-col { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }

  /* ---------- Forms: action buttons (Generate / Clear, Copy / Mail) ---------- */

  .admin-section.actions,
  .output-actions {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .admin-section.actions button,
  .output-actions button {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 8px;
    font-size: 10px;
    letter-spacing: .10em;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ---------- Forms: add-source button ---------- */

  .add-source-row .btn-add {
    width: 100%;
    padding: 12px 18px;
  }

  /* ---------- Toast ---------- */

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    max-width: none;
  }
  .toast button {
    padding: 8px 10px;
    text-align: center;
  }

  /* ---------- Colophon ---------- */

  .colophon { padding: 20px 20px 40px; }
}
/* #endregion */

/* #region 9. Reduced motion  */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .about-btn .dot { animation: none; }
}
/* #endregion */