/* ═══════════════════════════════════════════════════
   Riner Research Hub — Academic/Scientific Theme
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paper palette */
  --bg: #faf8f4;
  --bg-alt: #f2efe8;
  --card: #ffffff;
  --card-border: #e0dcd4;
  --card-shadow: rgba(0, 0, 0, 0.06);

  /* Text */
  --text: #1a1a2e;
  --text-secondary: #4a4a5e;
  --text-dim: #7a7a8e;
  --text-faint: #a0a0ae;

  /* Accents — scholarly navy, gold, teal */
  --accent1: #1e3a5f;     /* deep navy */
  --accent2: #b8860b;     /* dark goldenrod */
  --accent3: #2a7a6f;     /* teal */
  --green: #2d7d46;
  --orange: #c67600;
  --red: #b33a3a;

  /* Fonts */
  --font-serif: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --radius: 6px;
  --radius-lg: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent1);
}

h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.4rem; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.05rem; }

/* ── Links ── */
a {
  color: var(--accent1);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
a:hover {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

/* ── Layout ── */
.main {
  max-width: 820px;
  padding: 40px 32px 80px;
  margin: 0 auto;
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--accent1);
}
.header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent1);
  background: none;
  -webkit-text-fill-color: unset;
}
.header .sub {
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  margin-top: 8px;
  font-style: italic;
}

/* ── Back Link ── */
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent1);
  border-bottom: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent2); }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 1px 3px var(--card-shadow), 0 1px 2px var(--card-shadow);
  transition: box-shadow 0.3s, border-color 0.3s;
}
.card:hover {
  box-shadow: 0 4px 12px var(--card-shadow), 0 2px 4px var(--card-shadow);
  border-color: #ccc8be;
}
.card-header {
  padding: 18px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-bottom: 1px solid var(--bg-alt);
}
.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header .tag {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(30, 58, 95, 0.1);
  color: var(--accent1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-header .tag.warn {
  background: rgba(198, 118, 0, 0.1);
  color: var(--orange);
}
.chevron {
  transition: transform 0.3s;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.card.collapsed .chevron { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }

.card-body {
  padding: 4px 24px 24px;
  animation: fadeIn 0.3s ease;
}
.card-body p, .card-body li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
}
.card-body ul { padding-left: 22px; }
.card-body li { margin-bottom: 6px; }
.card-body h3 {
  font-size: 1.1rem;
  color: var(--accent1);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bg-alt);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Metric Equations ── */
.metric-eq {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent1);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 1rem;
  margin: 20px 0;
  overflow-x: auto;
  color: var(--accent1);
  line-height: 2;
}

/* ── Tables ── */
.results {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}
.results td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.95rem;
}
.results td:last-child { text-align: center; }
.results tr:hover td { background: var(--bg-alt); }

.vs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}
.vs-table th {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid var(--accent1);
  color: var(--accent1);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 0.92rem;
}
.vs-table tr:hover td { background: var(--bg-alt); }
.vs-table .new { color: var(--accent2); font-weight: 600; }

/* ── Project Grid ── */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.proj {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.proj:hover {
  border-color: var(--accent1);
  box-shadow: 0 2px 8px var(--card-shadow);
}
.proj h4 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent1);
}
.proj p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.proj .status {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
}

/* ── Publications ── */
.pub {
  padding: 14px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.95rem;
  line-height: 1.7;
}
.pub:last-child { border-bottom: none; }

/* ── Visualization Links ── */
a.viz-link { display: block; text-decoration: none; border-bottom: none; }
a.viz-link .proj:hover {
  border-color: var(--accent3);
  box-shadow: 0 2px 8px rgba(42, 122, 111, 0.1);
}

/* ── Skills / Progress Bars ── */
.skill {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  font-size: 0.9rem;
  font-family: var(--font-sans);
}
.skill-name {
  width: 180px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: 500;
}
.skill-track {
  flex: 1;
  height: 10px;
  background: var(--bg-alt);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}
.skill-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease-out;
}
.skill-pct {
  width: 40px;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: right;
  font-family: var(--font-mono);
}

/* ── Log Entries ── */
.log-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.log-entry .date {
  color: var(--accent1);
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-sans);
}

/* ── Vertical Timeline ── */
.vtl { position: relative; padding: 0; margin: 20px 0; }
.vtl-track {
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--card-border);
  border-radius: 1px;
}
.vtl-progress {
  position: absolute;
  left: 18px;
  top: 0;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--green), var(--accent1), var(--accent2));
  transition: height 1s ease-out;
}
.vtl-item {
  position: relative;
  padding: 16px 0 16px 48px;
  font-size: 0.95rem;
  line-height: 1.7;
}
.vtl-dot {
  position: absolute;
  left: 12px;
  top: 18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  background: var(--bg);
  z-index: 1;
}
.vtl-item.done .vtl-dot { background: var(--green); border-color: var(--green); }
.vtl-item.current .vtl-dot {
  background: var(--accent2);
  border-color: var(--accent2);
  box-shadow: 0 0 6px rgba(184, 134, 11, 0.4);
}
.vtl-item.current .vtl-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent2);
  opacity: 0.4;
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.3); opacity: 0; }
}
.vtl-item.future .vtl-dot { background: var(--bg); border-color: #ccc; }
.vtl-label {
  font-size: 0.75rem;
  font-family: var(--font-sans);
  color: var(--accent2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vtl-text { color: var(--text-secondary); }

/* ── Comparison Grid ── */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 20px 0;
}
.compare-col {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--card-border);
}
.compare-col h4 { font-size: 1rem; margin-bottom: 12px; }
.compare-col.bad h4 { color: var(--red); }
.compare-col.good h4 { color: var(--green); }

/* ── Bar Charts ── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 0.85rem;
  font-family: var(--font-sans);
}
.bar-label {
  width: 50px;
  text-align: right;
  color: var(--text-dim);
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.bar-track {
  flex: 1;
  height: 16px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--card-border);
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.5s ease-out;
  width: 0;
}
.bar-fill.danger { background: linear-gradient(90deg, var(--red), var(--orange)); }
.bar-fill.safe { background: linear-gradient(90deg, var(--green), var(--accent1)); }
.bar-val {
  width: 42px;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Explorer Controls ── */
.explorer {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
}
.explorer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  font-family: var(--font-sans);
}
.explorer-header label {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
}
.explorer-header .r-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent1);
  min-width: 60px;
  font-family: var(--font-mono);
}
.explorer-header .r-zone {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 99px;
  font-weight: 600;
  font-family: var(--font-sans);
}
.explorer input[type=range] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--green), var(--accent1));
  border-radius: 2px;
  outline: none;
  margin: 6px 0 14px;
}
.explorer input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent1);
  cursor: pointer;
  box-shadow: 0 1px 3px var(--card-shadow);
}

/* ── Dimension Readouts ── */
.dim-readouts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.dim-read {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.dim-read .dim-name {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 2px;
  font-family: var(--font-sans);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dim-read .dim-val {
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent1);
}

/* ── Quality Grid ── */
.qg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.qg-item {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
}
.qg-item .qg-icon { font-size: 1.2rem; flex-shrink: 0; }
.qg-item .qg-name { color: var(--text); font-weight: 500; }
.qg-item .qg-note { color: var(--text-dim); font-size: 0.82rem; }
.qg-item.pass { border-color: rgba(45, 125, 70, 0.3); }
.qg-item.fail { border-color: rgba(179, 58, 58, 0.3); opacity: 0.6; }

/* ── Counters ── */
.counter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
}
.counter-item { text-align: center; min-width: 90px; }
.counter-num {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-sans);
  color: var(--accent1);
}
.counter-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 8px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 40px 0 20px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-dim);
  border-top: 1px solid var(--card-border);
  margin-top: 32px;
}

/* ── Code blocks ── */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}
code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent1);
}
pre {
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  line-height: 1.5;
}

/* ── Strong / emphasis academic styling ── */
strong { color: var(--text); font-weight: 600; }
em { font-style: italic; color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .main { padding: 24px 16px 60px; }
  .header h1 { font-size: 1.6rem; }
  .proj-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .qg-grid { grid-template-columns: 1fr 1fr; }
  .dim-readouts { grid-template-columns: 1fr 1fr; }
}

/* ── Print styles ── */
@media print {
  body { font-size: 12pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .back-link, .footer { display: none; }
  .header { border-bottom: 1px solid #000; }
}
