/* ============================================================
   Weekly IT Security Bulletin — Template Stylesheet
   You should rarely need to touch this file. Weekly content
   changes belong in content.js.
   ============================================================ */

:root {
  /* ---- palette ---- */
  --navy-950: #060b16;
  --navy-900: #0b1526;
  --navy-800: #101d34;
  --navy-700: #16264420;
  --line: #22304e;
  --text-hi: #f4f6fb;
  --text-mid: #b6c2da;
  --text-low: #7c8aa8;

  --amber: #f3a83b;
  --amber-dim: #b97e28;
  --cyan: #35c6e8;
  --red: #e6473a;
  --red-dim: #7a2620;
  --gold: #d9ab45;

  /* threat band colors */
  --lvl-low: #6fcf67;
  --lvl-guarded: #3e8ede;
  --lvl-elevated: #f4d35e;
  --lvl-high: #f2994a;
  --lvl-severe: #e6473a;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--navy-950);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, #12234a55, transparent),
    radial-gradient(ellipse 900px 600px at 100% 20%, #0e1c3a55, transparent);
  color: var(--text-hi);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Poppins", "Inter", system-ui, sans-serif;
  font-weight: 700;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

a { color: var(--cyan); text-decoration-color: #35c6e880; }
a:hover { color: #6fdcf5; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

button { font-family: inherit; cursor: pointer; }

/* ============ SKIP LINK / A11Y ============ */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--amber); color: #201200; padding: 10px 16px;
  border-radius: 0 0 8px 0; z-index: 999; font-weight: 700;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ============ TOP BAR ============ */
.topbar {
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  border-bottom: 1px solid var(--line);
  padding: 22px 0 18px;
}

/* Two-column header: left = title/status/buttons, right = tall cartoon */
.topbar-grid {
  display: flex;
  align-items: stretch;
  gap: 24px;
}
.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar-right {
  flex: 0 0 260px;
}

.masthead-title h1 {
  font-size: clamp(20px, 2.6vw, 28px);
  color: var(--text-hi);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.masthead-title .date {
  color: var(--amber);
  font-weight: 600;
  font-size: 15px;
}
.masthead-title .byline {
  color: var(--text-low);
  font-size: 13px;
  margin-top: 2px;
}

.attention-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  margin-top: 0;
}

/* Row pairing the attention cards with the (now larger) alert gauge */
.top-fill-row {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Cartoon lives in the right-hand sidebar, stretched to match the left
   column's height, with its caption as a bold heading above the image. */
.cartoon-card--header {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 16px;
}
.cartoon-card--header .cartoon-caption-top {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-hi);
  text-align: center;
  margin-bottom: 10px;
}
.cartoon-card--header img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  border-width: 2px;
  border-radius: 12px;
}
.cartoon-card--header .cartoon-fallback { font-size: 11px; padding: 12px 8px; max-width: 100%; margin: auto; }
.attention-card {
  border: 1px solid var(--red-dim);
  background: linear-gradient(180deg, #1a0f0f, #120a0a);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 160px;
  max-width: 220px;
}
.attention-card .label {
  color: var(--red);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.attention-card .count { font-weight: 700; color: var(--text-hi); }
.attention-card a { font-size: 13px; }
.attention-card .detail { font-size: 12px; color: var(--text-mid); }

/* buttons: threat levels / scoring / disclaimer / listen */
.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.btn {
  border: 1px solid var(--line);
  background: var(--navy-800);
  color: var(--text-hi);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--amber); transform: translateY(-1px); }
.btn.listen { border-color: #2fa7c9; color: #7fe0ff; }
.btn .ico { font-size: 15px; line-height: 1; }

/* ============ GAUGE ============ */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-shrink: 0;
}
.gauge-wrap svg { width: 240px; height: auto; display: block; }
.gauge-level-label {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.gauge-score {
  color: var(--text-mid);
  font-size: 13.5px;
}

/* ============ LAYOUT GRID ============ */
main.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "article"
    "eq"
    "weeklyimg"
    "news"
    "links";
  gap: 26px;
  padding: 28px 0 10px;
}

@media (min-width: 900px) {
  main.layout {
    grid-template-columns: 340px 1fr;
    grid-template-areas:
      "news article"
      "news eq"
      "news weeklyimg"
      "links links";
    gap: 30px;
    align-items: start;
  }
}

section[class] { min-width: 0; }

.panel {
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 22px 26px;
  box-shadow: var(--shadow);
}

/* ---- news sidebar ---- */
.news-section { grid-area: news; }
.news-section h2 {
  color: var(--amber);
  font-size: 21px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.news-item { margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.news-item h3 { font-size: 15.5px; margin-bottom: 6px; }
.news-item h3 a { color: var(--text-hi); text-decoration: none; }
.news-item h3 a:hover { color: var(--amber); text-decoration: underline; }
.news-item p { font-size: 13.5px; color: var(--text-mid); margin: 0; }
.news-item .src { font-size: 12.5px; color: var(--text-low); }

.section-divider {
  border: none;
  height: 1px;
  margin: 4px 0 18px;
  background: linear-gradient(90deg, var(--line), transparent 85%);
}

.other-links h3 {
  color: var(--cyan);
  font-size: 16px;
  margin-top: 0;
  text-transform: none;
}
.other-links ul { padding-left: 18px; margin: 8px 0; }
.other-links li { font-size: 13.5px; margin-bottom: 8px; color: var(--text-mid); }
.other-links a { color: var(--text-hi); }

.report-line {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--text-low);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ---- feature article ---- */
.article-section { grid-area: article; }
.article-section h2 {
  font-size: clamp(21px, 2.6vw, 27px);
  color: var(--text-hi);
}
.article-body p { font-size: 15.5px; color: #dbe2f0; margin: 0 0 15px; }
.article-body p:first-of-type::first-letter {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 2.6em;
  float: left;
  line-height: 0.85;
  padding-right: 8px;
  color: var(--amber);
}
.article-meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-low);
}
.article-meta a { color: var(--text-mid); }

/* ---- earthquake chart (sits under the article) ---- */
.eq-section { grid-area: eq; max-width: 720px; }

.eq-card h3 { font-size: 16px; color: var(--text-hi); }
.eq-card .eq-sub { color: var(--text-low); font-size: 12.5px; margin-bottom: 14px; }
.eq-row { display: grid; grid-template-columns: 190px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 9px; }
.eq-row .eq-name { font-size: 10.5px; line-height: 1.15; color: var(--text-mid); text-align: right; white-space: normal; overflow: visible; text-overflow: clip; }
.eq-row .eq-bar-track { position: relative; height: 16px; background: #0b1220; border-radius: 4px; overflow: hidden; }
.eq-row .eq-bar { height: 100%; border-radius: 4px; }
.eq-row .eq-mag { font-size: 12px; font-weight: 700; color: var(--text-hi); }
.eq-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--text-mid); }
.eq-legend span { display: inline-flex; align-items: center; gap: 6px; }
.eq-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.eq-source { font-size: 11px; color: var(--text-low); margin-top: 10px; }

/* ---- weekly image (sits under the earthquake chart, swap weekly) ---- */
.weekly-image-section { grid-area: weeklyimg; max-width: 720px; }

.weekly-image-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.weekly-image-card h3 { font-size: 16px; color: var(--text-hi); align-self: flex-start; margin-bottom: 14px; }
.weekly-image-card img {
  max-width: 100%;
  border-radius: 16px;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.weekly-image-caption { margin-top: 10px; font-size: 12px; color: var(--text-low); }
.weekly-image-source { align-self: flex-start; font-size: 11px; color: var(--text-low); margin-top: 10px; }
.weekly-image-fallback {
  display: none;
  width: 100%;
  max-width: 260px;
  padding: 20px 16px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  color: var(--text-low);
  font-size: 12.5px;
  text-align: center;
}
.weekly-image-fallback code {
  display: block;
  margin-top: 8px;
  color: var(--amber);
  font-size: 11.5px;
  word-break: break-all;
}

.cartoon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 16px;
}
.cartoon-card img {
  max-width: 100%;
  border-radius: 16px;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.cartoon-card .caption { margin-top: 10px; font-size: 12px; color: var(--text-low); }
.cartoon-fallback {
  display: none;
  width: 100%;
  max-width: 260px;
  padding: 20px 16px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  color: var(--text-low);
  font-size: 12.5px;
  text-align: center;
}
.cartoon-fallback code {
  display: block;
  margin-top: 8px;
  color: var(--amber);
  font-size: 11.5px;
  word-break: break-all;
}

/* ---- resources / links section ---- */
.links-section { grid-area: links; }
.dashboard-cta {
  display: block;
  text-align: center;
  border: 1px solid var(--red-dim);
  background: linear-gradient(180deg, #1a0f0f, #120a0a);
  color: var(--text-hi);
  font-weight: 700;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  text-decoration: none;
}
.dashboard-cta:hover { border-color: var(--red); }
.dashboard-cta .hl { color: var(--red); }

.resource-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.resource-pill {
  border: 1px solid var(--line);
  background: var(--navy-800);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-mid);
  text-decoration: none;
}
.resource-pill:hover { border-color: var(--cyan); color: var(--text-hi); }

/* ============ FOOTER ============ */
footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 40px;
  text-align: center;
  color: var(--text-low);
  font-size: 13px;
}
footer.site-footer .author { color: var(--text-hi); font-size: 16px; font-weight: 700; }
footer.site-footer .author span { color: var(--text-low); font-weight: 400; font-size: 13px; }
footer.site-footer .note { font-style: italic; margin-top: 6px; }

/* ============ MODALS ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 20px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-close {
  background: transparent; border: none; color: var(--text-mid);
  font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px;
}
.modal-close:hover { color: var(--text-hi); background: var(--navy-800); }

.threat-row { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.threat-row .swatch { width: 14px; height: 14px; border-radius: 4px; margin-top: 4px; flex-shrink: 0; }
.threat-row.current { background: var(--navy-800); border-radius: var(--radius-sm); padding: 8px 10px; margin: -8px -10px 12px; }
.threat-row b { color: var(--text-hi); }
.threat-row p { margin: 2px 0 0; font-size: 13.5px; color: var(--text-mid); }

.modal .score-breakdown { list-style: none; padding: 0; margin: 0 0 14px; }
.modal .score-breakdown li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--text-mid);
}
.modal .score-breakdown li b { color: var(--text-hi); font-weight: 600; }
.modal p { font-size: 13.5px; color: var(--text-mid); }
.modal p.small-note { font-size: 12px; color: var(--text-low); margin-top: 14px; }

/* ============ MOBILE ADJUSTMENTS ============ */
@media (max-width: 899px) {
  .desktop-only { display: none; }
  .topbar-grid { flex-direction: column; align-items: stretch; }
  .topbar-left { align-items: center; text-align: center; }
  .topbar-right { flex: 0 0 auto; margin-top: 18px; }
  .cartoon-card--header { height: auto; max-width: 340px; margin: 0 auto; }
  .cartoon-card--header img { max-height: 260px; }
  .gauge-wrap svg { width: 230px; }
  .top-fill-row { justify-content: center; }
  .attention-row { justify-content: center; flex: 0 1 auto; }
  .action-row { justify-content: center; }
  .eq-row { grid-template-columns: 128px 1fr 30px; }
  .eq-row .eq-name { font-size: 9.5px; }
}

@media (min-width: 900px) {
  .mobile-only { display: none; }
}
