:root {
  /* Clean Slate — light, modern minimalism */
  --bg: #fafaf9;          /* near-white (stone-50) */
  --bg-2: #f4f4f3;        /* header/footer strip */
  --card: #ffffff;        /* pure white card on off-white bg */
  --card-hover: #f1f5f4;  /* faint teal-tinted hover */
  --ink: #18181b;         /* near-black (zinc-900) */
  --ink-dim: #71717a;     /* zinc-500 */
  --accent: #0d9488;      /* teal-600 (links, accents) */
  --accent-warm: #f59e0b; /* amber (warnings) */
  --border: #e4e4e7;      /* zinc-200 */
  --good: #16a34a;        /* green-600 */
  --warn: #f59e0b;        /* amber */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .brand {
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.site-header nav a {
  margin-left: 18px;
  color: var(--ink-dim);
  font-size: 14px;
}
.site-header nav a:hover { color: var(--ink); text-decoration: none; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

.page-heading h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.01em;
}
.page-heading .subtitle {
  margin: 0 0 28px;
  color: var(--ink-dim);
  font-size: 15px;
}

footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  color: var(--ink-dim);
  font-size: 12px;
  text-align: center;
}

/* ---- Home tile grid ---- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.tile {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--card), var(--bg-2));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
  background: linear-gradient(135deg, var(--card-hover), var(--bg-2));
}
.tile .emoji {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 22px;
  opacity: 0.85;
}
.tile .tag {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}
.tile.priority {
  background: linear-gradient(135deg, var(--card-hover), var(--bg-2));
  border-color: var(--accent);
}

/* ---- Atlas page content ---- */
.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 18px;
}
.section h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--ink);
}
.section h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.section p { color: var(--ink); }
.section ul { padding-left: 20px; }
.section li { margin: 4px 0; }

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.link-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.link-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  text-decoration: none;
}
.link-card .title { font-weight: 600; display: block; }
.link-card .desc  { font-size: 13px; color: var(--ink-dim); margin-top: 2px; display: block; }

.kbd {
  font-family: ui-monospace, "SF Mono", monospace;
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 13px;
}

table { width: 100%; border-collapse: collapse; margin: 8px 0; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--ink-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

.note {
  background: rgba(13, 148, 136, 0.07);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 4px;
  font-size: 14px;
}

/* ---- Tile with background image ---- */
.tile.has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  border-color: transparent;
}
.tile.has-bg .emoji { display: none; }
.tile.has-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(12,14,18,0.20) 0%, rgba(12,14,18,0.55) 70%, rgba(12,14,18,0.85) 100%);
  pointer-events: none;
  transition: background 0.15s;
  z-index: 0;
}
.tile.has-bg:hover::after {
  background: linear-gradient(135deg, rgba(12,14,18,0.10) 0%, rgba(12,14,18,0.45) 70%, rgba(12,14,18,0.75) 100%);
}
.tile.has-bg .label {
  position: relative;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}
.tile.has-bg .tag {
  z-index: 1;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}

/* ---- Voyage cards ---- */
.voyage-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  transition: border-color 0.15s;
}
.voyage-card:hover { border-color: var(--accent); }
.voyage-card a { display: block; color: var(--ink); text-decoration: none; }
.voyage-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #e8e6e0;
  display: block;
}
.voyage-card-label {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid var(--border);
}
.voyage-card-failed {
  padding: 14px;
  color: #b13a2f;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.voyage-card-failed .err { font-size: 11px; color: var(--ink-dim); }

.voyage-banner {
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.voyage-banner strong { color: var(--accent); }
.voyage-banner .meta { font-size: 13px; color: var(--ink-dim); }

/* ---- AI narrative section ---- */
.narrative-section {
  border: 1px solid var(--accent);
  background: rgba(13, 148, 136, 0.04);
  position: relative;
}
.narrative-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.narrative-section > h2::before {
  content: "✦";
  color: var(--accent);
  font-size: 18px;
}
.narrative-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.narrative-body h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 22px 0 6px;
  border: 0;
}
.narrative-body h4 {
  font-size: 13px;
  margin: 14px 0 4px;
  color: var(--ink);
}
.narrative-body p { margin: 0 0 10px; }
.narrative-body ul { margin: 0 0 12px; padding-left: 22px; }
.narrative-body li { margin: 3px 0; }
.narrative-body strong { color: var(--ink); }
.narrative-section .meta {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--ink-dim);
  font-style: italic;
}

/* ---- Refresh button ---- */
.refresh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}
.refresh-btn {
  padding: 9px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}
.refresh-btn:hover:not(:disabled) { background: #0b7e74; transform: translateY(-1px); }
.refresh-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}
.refresh-status {
  font-size: 13px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ---- Previous briefings ---- */
.prev-briefing {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.prev-briefing summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  padding: 4px 0;
}
.prev-briefing summary::-webkit-details-marker { display: none; }
.prev-briefing summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  color: var(--ink-dim);
  transition: transform 0.12s;
}
.prev-briefing[open] summary::before { transform: rotate(90deg); }
.prev-briefing summary .meta { font-weight: normal; margin-left: 6px; }
.prev-briefing .narrative-body {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 14px;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  main { padding: 20px 16px 40px; }

  .site-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
  }
  .site-header .brand { font-size: 15px; }
  .site-header nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 4px;
  }
  .site-header nav a { margin-left: 0; font-size: 13px; }

  .page-heading h1 { font-size: 22px; }
  .page-heading .subtitle { font-size: 14px; }

  .section { padding: 16px 14px; }
  .section h2 { font-size: 16px; }
  .section h3 { font-size: 12px; }

  /* Force all 2-col link-grids to single column; override inline style */
  .link-grid,
  .link-grid[style*="repeat(2"] {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  /* Tables scroll horizontally when cramped */
  .section table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .section table thead,
  .section table tbody { width: max-content; min-width: 100%; }

  /* Map-symbols SVGs adapt */
  .legend-table .sym { width: 120px; }
  .legend-table .sym-cell { width: auto; padding-right: 8px; }
  .legend-row { grid-template-columns: 1fr !important; }
  .legend-row .sym-big { width: 100%; max-width: 320px; }
  .station { width: 100%; height: auto; }

  .tile-grid { grid-template-columns: 1fr; gap: 10px; }
  .tile { aspect-ratio: 5 / 2; font-size: 16px; }

  .barb-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .barb svg { width: 44px; height: 58px; }
  .octa-grid { grid-template-columns: repeat(3, 1fr); }
  .octa svg { width: 40px; height: 40px; }

  /* Hero image shrinks proportionally */
  .hero { min-height: 200px; }
  .hero-inner { padding: 24px 16px 18px; }
  .hero-inner h1 { font-size: 24px; }
}
