/* ========================================
   DESIGN TOKENS / VARIABLES
   ===================================== */

:root {
  --bg: #f9fafb;
  --bg-alt: #ffffff;
  --card-bg: #ffffff;

  --accent: #1f2933;
  --accent-soft: rgba(244, 180, 0, 0.16);

  --text-main: #1f2933;
  --text-muted: #6b7280;

  --danger: #dc2626;
  --warn: #f97316;
  --success: #16a34a;

  --border-subtle: rgba(148, 163, 184, 0.35);
  --shadow-soft: 0 4px 20px rgba(15, 23, 42, 0.08);

  --radius-xl: 18px;
  --radius-md: 12px;

  --content-max-width: 1320px;
  --text-soft: #6b7280;

  /* Header sizing controls */
  --header-side-col: 360px; /* MUST be >= brand min-width and >= status-card min-width */

  --header-side-col: 240px;   /* you can keep tuning this */
  --header-nav-bias: -28px;   /* negative = shift nav left */
}

/* ========================================
   GLOBAL RESET / BASE
   ===================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top right, rgba(255, 230, 87, 0.2), transparent 55%),
    radial-gradient(circle at top left, rgba(87, 140, 255, 0.2), transparent 55%),
    radial-gradient(circle at bottom, rgba(255, 163, 87, 0.2), transparent 55%),
    #f9fafc;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================
   PAGE LAYOUT
   ===================================== */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page main,
.site-main {
  flex: 1;
  max-width: var(--content-max-width);
  width: 100%;
  margin: 1.4rem auto 2.5rem;
  padding: 0 1rem;
}

.content-shell { width: 100%; }

/* ========================================
   HEADER / TOP BAR + NAV
   ===================================== */


.top-bar {
  position: sticky;
  top: 0;
  z-index: 9999;
  transform: translateZ(0); /* forces a new compositing layer in some browsers */

  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);

  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;

  padding: 0.95rem 0.75rem;
}

/* Inner container (THIS is the layout engine) */
.top-bar-inner {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;

  display: grid;
  grid-template-columns: var(--header-side-col) 1fr var(--header-side-col) ;
  align-items: center;
  column-gap: 1.25rem;
}

/* Left / center / right alignment */
.top-bar-inner .brand { justify-self: end; }
.top-bar-inner .nav-links { justify-self: center; justify-content: center; }
.top-bar-inner .top-status { justify-self: start; }

/* Brand block */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;

  /* Your requirement */
  min-width: 300px;

  /* Prevent brand from overflowing its column */
  max-width: 100%;
}

.brand-logo {
  width: 70px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.brand-text-main {
  font-size: 1.5rem;
  font-weight: 650;
  color: #111827;
  line-height: 1.15;
}

.brand-text-sub {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.15rem;
  line-height: 1.2;
}

/* Nav container */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: nowrap;
}

/* Nav pills */
.nav-link {
  font-size: 1rem;
  padding: 0.32rem 0.78rem;
  border-radius: 999px;
  border: 1px solid transparent;

  color: #4b5563;
  background: transparent;

  transition: all 0.18s ease-out;
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-link:hover {
  border-color: #e0e7ff;
  background: #eef2ff;
  color: #3730a3;
  text-decoration: none;
}

.nav-link.active {
  border-color: #6366f1;
  background: #e0e7ff;
  color: #312e81;
}

/* ========================================
   NAV DROPDOWN
   ===================================== */

.nav-item.nav-dropdown { position: relative; }

button.nav-link {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid transparent;
  font: inherit;
  color: inherit;
  line-height: inherit;
  margin: 0;
  cursor: pointer;
}

.nav-dropdown-toggle { gap: 0.25rem; }

.nav-dropdown-caret {
  font-size: 1rem;
  line-height: 1;
  transform: translateY(1px);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4rem;

  min-width: 190px;
  padding: 0.35rem 0;

  display: none;
  flex-direction: column;

  background: var(--bg-alt);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  z-index: 50;
}

.nav-dropdown-item {
  display: block;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  text-decoration: none;
}

.nav-dropdown-item:hover { background: var(--accent-soft); }

.nav-dropdown.open .nav-dropdown-menu { display: flex; }

.nav-links button.nav-link:hover {
  border-color: #e0e7ff;
  background: #eef2ff;
  color: #3730a3;
  text-decoration: none;
}

.nav-links button.nav-link.active {
  border-color: #6366f1;
  background: #e0e7ff;
  color: #312e81;
}

.nav-links button.nav-link:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.55);
  outline-offset: 2px;
}

/* ========================================
   LIVE STATUS PANEL (header right side)
   ===================================== */

.top-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.top-status-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;

  padding: 0.55rem 0.8rem;
  border-radius: 16px;

  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);

  text-decoration: none;

  min-width: 290px;   /* fits inside side column */
  max-width: 100%;

  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.top-status-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
}

.gauge {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.gauge-ring {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: conic-gradient(#e5e7eb 0deg, #e5e7eb 360deg);
  position: absolute;
  inset: 0;
}

.gauge-ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

.gauge-value {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  color: #111827;
}

.gauge-label {
  margin-top: 0.1rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #6b7280;
}

.top-status-meta { min-width: 0; }

.top-status-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.1rem;
}

.top-status-last {
  font-size: 0.88rem;
  font-weight: 750;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.top-status-sub {
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ========================================
   HEADER AD SLOT
   ===================================== */

.header-ad-wrap {
  border-top: 1px solid var(--border-subtle);
  background: #f9fafb;
}

.header-ad-inner {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0.4rem 1rem 0.6rem;
}

.ad-slot {
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
  background: #fefefe;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-soft);

  position: relative;
  overflow: hidden;
}

.ad-slot--header { min-height: 90px; }

.ad-label {
  position: absolute;
  top: 0.45rem;
  right: 0.7rem;

  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-soft);
}

.ad-slot-inner {
  width: 100%;
  text-align: center;
}

/* ========================================
   GENERIC CARDS
   ===================================== */

.card {
  border-radius: 20px;
  background: #ffffff;
  border: 5px solid #e5e7eb;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
  padding: 1rem 1.2rem;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #111827;
}

.card-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

.card-body {
  font-size: 0.86rem;
  color: #374151;
}

.card ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

/* ========================================
   STATUS PAGE (status.html)
   ===================================== */

.time {
  width: 100%;
  max-width: 480px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 1.25rem;
}

.status-label {
  margin: 0.25rem 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.status-ok { color: #16a34a; }
.status-warn { color: #ea580c; }
.status-error { color: #dc2626; }
.status-unknown { color: #6b7280; }

.status-message {
  margin: 0;
  font-size: 0.9rem;
  color: #6b7280;
}

hr {
  margin: 1.5rem 0 1.25rem;
  border: none;
  border-top: 1px solid #e5e7eb;
}

.section-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #020617;
}

.section-text {
  margin: 0;
  font-size: 0.95rem;
  color: #4b5563;
}

.link {
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

.link a {
  color: #2563eb;
  font-weight: 600;
}

.link a:hover { text-decoration: underline; }

.refresh-note {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.summary-note {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ========================================
   CONTACT PAGE (contact.html)
   ===================================== */

.card-contact {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem;
}

.card-contact h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

.card-contact p.lead {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

form.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 500;
}

.form-row input,
.form-row textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(31, 41, 51, 0.15);
}

.form-row textarea {
  min-height: 140px;
  resize: vertical;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.submit-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.75rem;
}

button.btn-primary {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

button.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
  opacity: 0.96;
}

/* ========================================
   ARTICLES LIST (articles.html)
   ===================================== */

.articles-header { margin-bottom: 1rem; }

.articles-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.5rem;
}

.articles-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.articles-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.article-card-link {
  text-decoration: none;
  color: inherit;
}

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.article-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.15);
}

.article-meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.article-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.article-thumb {
  margin-bottom: 0.6rem;
  overflow: hidden;
  border-radius: 0.9rem;
}

.article-thumb img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  max-height: 180px;
}

.article-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.article-preview-banner {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: #fef3c7;
  border: 1px solid #facc15;
  font-size: 0.9rem;
}

/* ========================================
   MAP AREA (map.html)
   ===================================== */

.map-area {
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
  background: linear-gradient(to bottom right, #f8fafc, #e5e7eb);
  padding: 1rem;
  min-height: 280px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  gap: 0.5rem;

  font-size: 0.85rem;
  color: #6b7280;
}

.map-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #1f2933;
}

.selected-call {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #111827;
}

/* ========================================
   FOOTER
   ===================================== */

.footer {
  padding: 0.85rem 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  font-size: 0.78rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer a { color: #4b5563; }
.footer a:hover { color: #111827; }

/* ========================================
   ADMIN BADGE
   ===================================== */

.admin-pill {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;

  display: inline-flex;
  align-items: center;
  gap: 0.4rem;

  padding: 0.4rem 0.9rem;
  border-radius: 999px;

  font-size: 0.75rem;
  font-weight: 600;

  background: rgba(17, 24, 39, 0.92);
  color: #f3f4f6;

  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);

  text-decoration: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.admin-pill:hover {
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

.admin-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #22c55e;
}

/* ========================================
   RESPONSIVE TWEAKS
   ===================================== */

@media (max-width: 768px) {
  /* IMPORTANT: target the inner container, not .top-bar */
  .top-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.85rem;
  }

  /* Let brand shrink normally on mobile */
  .brand {
    min-width: 0;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  /* Keep live status compact on mobile */
  .top-status-card {
    width: auto;
    max-width: 100%;
    min-width: 0;
  }

  .top-status-last,
  .top-status-sub {
    max-width: 14rem;
  }

  .page main,
  .site-main {
    margin-top: 1rem;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

.hero-ctas { display:flex; gap:.65rem; flex-wrap:wrap; margin-top: 1rem; }

.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.7rem 1rem;
  border-radius: 999px;
  font-weight:700;
  text-decoration:none;
}

.btn-primary { background: var(--accent, #111827); color:#fff; }
.btn-secondary { background: rgba(15,23,42,.06); color: var(--text-main, #111827); }

.home-hero { margin-top: 1rem; }

.page-wrap {
  padding: 2rem 0;
}

.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-title {
  margin: 0 0 1rem 0;
}

/* =========================
   AD SLOTS (gated by ADS_ENABLED)
   ========================= */

.header-ad-wrap {
  border-bottom: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.35));
  background: var(--bg-alt, #ffffff);
}

.header-ad-inner {
  max-width: var(--content-max-width, 1120px);
  margin: 0 auto;
  padding: 0.5rem 1rem;
}

/* Generic container for any slot */
.ad-slot {
  width: 100%;
  display: block;
}

/* Optional visible placeholder (only if placeholder=true in macro) */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-subtle, rgba(148, 163, 184, 0.35));
  border-radius: var(--radius-md, 12px);
  color: var(--text-muted, #6b7280);
  background: rgba(148, 163, 184, 0.06);
}

.ad-placeholder small {
  font-size: 0.85rem;
}
