/* BIASR — Binodian Institute for Astronomical and Space Research
   Shared stylesheet: theme variables, layout shell, components. */

:root[data-theme="dark"] {
  --bg: #081b33;
  --bg-elevated: #0d2547;
  --surface: #112c52;
  --surface-border: rgba(255, 255, 255, 0.10);
  --text: #eef2f9;
  --text-muted: #9fb2d1;
  --royal-blue: #3a63e0;
  --gold: #d4af37;
  --status-active: #34d399;
  --status-paused: #f87171;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-border: rgba(8, 27, 51, 0.10);
  --text: #0b1b33;
  --text-muted: #4a5a75;
  --royal-blue: #1d3fa0;
  --gold: #a8790f;
  --status-active: #0f9d67;
  --status-paused: #c62b2b;
  --shadow: 0 8px 24px rgba(8, 27, 51, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  margin: 0 0 .5em;
  letter-spacing: .01em;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header / Nav ─────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--surface-border);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img { width: 42px; height: 42px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: Georgia, serif; font-size: .95rem; color: var(--text); }
.brand-text span { font-size: .68rem; letter-spacing: .08em; color: var(--gold); text-transform: uppercase; }

.nav-links {
  display: flex;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  font-size: .86rem;
  color: var(--text-muted);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--gold);
}

.nav-controls { display: flex; align-items: center; gap: 10px; }

.theme-toggle, .nav-toggle {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: .9rem;
}

.nav-toggle { display: none; }

@media (max-width: 1180px) {
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--bg-elevated);
    flex-direction: column;
    padding: 14px 24px;
    border-bottom: 1px solid var(--surface-border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: inline-block; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary { background: var(--gold); color: #0b1b33; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--surface-border); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary:hover { border-color: var(--gold); }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, rgba(8,27,51,.55), rgba(8,27,51,.88)), var(--hero-img, none);
  background-size: cover;
  background-position: center;
  color: #fff;
}

.hero-content { max-width: 720px; }
.hero-eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); color: #fff; }
.hero p { color: #dbe4f2; font-size: 1.1rem; max-width: 560px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

/* ── Sections / Cards ────────────────────────────────────────────────────── */

section { padding: 64px 0; }

.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head .eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.card h3 { font-size: 1.02rem; }
.card .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.card .value { font-size: 1.4rem; font-weight: 600; font-family: Georgia, serif; }
.card .value.mono { font-family: "Consolas", "SFMono-Regular", monospace; letter-spacing: .03em; }

.division-card img { border-radius: 10px 10px 0 0; height: 150px; width: 100%; object-fit: cover; }
.division-card .card-body { padding: 16px; }

/* ── Status pill ─────────────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .85rem;
}
.status-pill.active { background: rgba(52, 211, 153, .14); color: var(--status-active); }
.status-pill.paused { background: rgba(248, 113, 113, .14); color: var(--status-paused); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-pill.active .status-dot { box-shadow: 0 0 8px var(--status-active); }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--surface-border);
  padding: 40px 0 24px;
  color: var(--text-muted);
  font-size: .88rem;
}

.site-footer strong { color: var(--text); }

.gov-link-bar {
  background: var(--royal-blue);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: .85rem;
}
.gov-link-bar a { color: #fff; text-decoration: underline; }

/* ── Explanation note ────────────────────────────────────────────────────── */

.note {
  border-left: 3px solid var(--gold);
  background: var(--surface);
  padding: 18px 22px;
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
  font-size: .96rem;
}

/* ── Timeline (About page) ───────────────────────────────────────────────── */

.timeline { position: relative; margin-left: 10px; padding-left: 30px; border-left: 2px solid var(--surface-border); }
.timeline-item { position: relative; padding-bottom: 30px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: -37px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 4px var(--bg);
}
.timeline-year { color: var(--gold); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }

/* ── Avatar placeholder (Director's portrait fallback) ──────────────────── */

.avatar-placeholder {
  width: 160px; height: 160px; border-radius: 50%;
  background: linear-gradient(135deg, var(--royal-blue), var(--bg-elevated));
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-size: 2.2rem; color: var(--gold);
}

/* ── Standards (accordion via <details>) ─────────────────────────────────── */

.standard-item {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.standard-item summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
}
.standard-item summary::-webkit-details-marker { display: none; }
.standard-item summary .std-id { color: var(--gold); font-family: Georgia, serif; margin-right: 12px; }
.standard-item summary::after { content: '+'; font-size: 1.2rem; color: var(--text-muted); }
.standard-item[open] summary::after { content: '−'; }
.standard-body { padding: 0 22px 20px; color: var(--text-muted); }
.std-status { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 3px 10px; border-radius: 999px; background: rgba(52,211,153,.14); color: var(--status-active); }

/* ── Publications (journal interface) ────────────────────────────────────── */

.pub-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.pub-toolbar input, .pub-toolbar select {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .9rem;
}
.pub-toolbar input { flex: 1; min-width: 220px; }

.pub-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
}
.pub-card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.pub-meta { color: var(--text-muted); font-size: .85rem; margin-bottom: 12px; }
.pub-abstract { font-size: .94rem; color: var(--text-muted); margin-bottom: 14px; }
.pub-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pub-tag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  background: rgba(212,175,55,.12); color: var(--gold);
  padding: 3px 10px; border-radius: 999px;
}
.pub-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: var(--text-muted); }
.pub-citation { font-family: Georgia, serif; font-style: italic; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.pagination button {
  background: var(--surface); border: 1px solid var(--surface-border); color: var(--text);
  border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: .88rem;
}
.pagination button[aria-current="true"] { background: var(--gold); color: #0b1b33; border-color: var(--gold); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); }

/* ── Lunar phase + orbital simulation (Observatory page) ─────────────────── */

.lunar-phase {
  width: 90px; height: 90px; border-radius: 50%;
  background: #e8e4d8;
  position: relative; overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0,0,0,.25);
}
.lunar-phase .shadow { position: absolute; inset: 0; background: #081b33; }

.orbit-sim { width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; position: relative; }
.orbit-sim .sun { position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 22px var(--gold); }
.orbit-ring { position: absolute; top: 50%; left: 50%; border: 1px dashed var(--surface-border); border-radius: 50%; transform: translate(-50%, -50%); }
.orbit-planet { position: absolute; top: 0; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; }
.orbit-track { position: absolute; inset: 0; animation: orbit-spin linear infinite; }
@keyframes orbit-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item { display: flex; gap: 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 8px; font-size: .88rem; }
.log-item time { color: var(--gold); font-family: "Consolas", monospace; white-space: nowrap; }

/* ── Contact / campus map ─────────────────────────────────────────────────── */

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
@media (max-width: 780px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-item { margin-bottom: 18px; }
.contact-item .label { margin-bottom: 4px; }
.campus-map-svg { width: 100%; height: auto; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; }

/* ── Project cards ────────────────────────────────────────────────────────── */

.project-status { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px; }
.project-status.active { background: rgba(52,211,153,.14); color: var(--status-active); }
.project-status.planning { background: rgba(212,175,55,.14); color: var(--gold); }
.project-status.completed { background: rgba(159,178,209,.14); color: var(--text-muted); }

/* ── Mini Calendar (Earth/Gregorian reference, Calendar Research page) ──── */

.mini-cal-card {
  max-width: 320px;
  padding: 18px;
}

.mini-cal-today {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .98rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.mc-chevron {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .75rem;
  transition: transform .2s ease;
}
.mc-chevron:hover { color: var(--text); border-color: var(--gold); }
.mini-cal-card.collapsed .mc-chevron { transform: rotate(-90deg); }

.mini-cal-body { overflow: hidden; }
.mini-cal-card.collapsed .mini-cal-body { display: none; }

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mini-cal-month { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mini-cal-nav { display: flex; gap: 6px; }
.mini-cal-nav button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 6px;
  font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.mini-cal-nav button:hover { background: var(--surface-border); color: var(--text); }

.mini-cal-weekdays, .mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.mini-cal-weekdays span {
  text-align: center;
  font-size: .68rem;
  color: var(--text-muted);
  padding-bottom: 6px;
  font-weight: 600;
}

.mc-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .84rem;
  color: var(--text);
  cursor: default;
  border-radius: 50%;
}
.mc-day.mc-outside { color: var(--text-muted); opacity: .45; }
.mc-day.mc-today { background: var(--gold); color: #0b1b33; font-weight: 700; }
.mc-day.mc-has-event::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--royal-blue);
  transform: translateX(-50%);
}
.mc-day.mc-today.mc-has-event::after { background: #0b1b33; }
.mc-day[title] { cursor: help; }

.mc-synchrony-row { margin-top: 8px; }
.mc-synchrony-day {
  padding: 8px 10px;
  text-align: center;
  font-size: .76rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(212, 175, 55, .1);
  border: 1px dashed var(--gold);
  border-radius: 8px;
}
.mc-synchrony-day.mc-today { background: var(--gold); color: #0b1b33; }
