/* ==========================================================================
   GAIA Research — shared dark teal theme
   Used by research.html and all paper_*.html pages.
   Palette: #0D9E76 (teal) on #0A1628 (deep navy).
   ========================================================================== */

:root {
  --bg:        #0A1628;
  --bg-2:      #0c1c33;
  --surface:   #0f2238;
  --card:      #102843;
  --card-2:    #14304f;
  --border:    rgba(255,255,255,0.09);
  --border-2:  rgba(255,255,255,0.16);
  --teal:      #0D9E76;
  --teal-br:   #18c994;
  --teal-glow: rgba(13,158,118,0.16);
  --teal-soft: rgba(13,158,118,0.10);
  --amber:     #e0a83b;
  --rose:      #e0607a;
  --text:      #e8eff6;
  --muted:     #9bb1c6;
  --faint:     #647d96;
  --shadow:    0 8px 30px rgba(0,0,0,0.35);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(13,158,118,0.10), transparent 60%),
    radial-gradient(700px 500px at 5% 0%, rgba(20,48,79,0.6), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-br); text-decoration: none; transition: color .2s; }
a:hover { color: var(--teal); }

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.2; color: #fff; }

/* ---- Navigation ---------------------------------------------------------- */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,22,40,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1300px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 2rem; gap: 1.5rem;
}
.nav-logo {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 1.05rem; color: #fff; white-space: nowrap;
}
.nav-logo span { color: var(--teal-br); }
.nav-logo-sub {
  display: none; font-weight: 400; font-size: .72rem; color: var(--faint);
}
@media (min-width: 1100px) { .nav-logo-sub { display: inline; margin-left: .4rem; } }
.nav-links { display: flex; gap: 1.6rem; list-style: none; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-size: .875rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-links a.active { color: var(--teal-br); }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg-2);
    border-bottom: 1px solid var(--border); padding: .5rem 0;
  }
  .nav-links.open { display: flex; }
  .nav-links li { padding: .25rem 2rem; }
}

/* ---- Layout shell -------------------------------------------------------- */
.wrap { max-width: 1300px; margin: 0 auto; padding: 0 2rem; }

.breadcrumb {
  max-width: 1300px; margin: 0 auto; padding: 1.1rem 2rem .25rem;
  font-size: .8rem; color: var(--faint);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--teal-br); }
.breadcrumb span { color: var(--faint); margin: 0 .45rem; }
.breadcrumb .current { color: var(--text); }

/* paper layout: content + sticky sidebar */
.paper-layout {
  max-width: 1300px; margin: 0 auto; padding: 1rem 2rem 4rem;
  display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 2.5rem;
  align-items: start;
}
@media (max-width: 980px) {
  .paper-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---- Sidebar ------------------------------------------------------------- */
.sidebar {
  position: sticky; top: 80px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.25rem; box-shadow: var(--shadow);
}
.sidebar h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: .5rem; }
.sidebar .s-title { font-size: .92rem; color: #fff; font-weight: 600; line-height: 1.3; margin-bottom: .35rem; }
.sidebar .s-authors { font-size: .78rem; color: var(--muted); margin-bottom: 1rem; }
.sidebar nav.fig-nav { display: block; }
.sidebar .fig-nav a {
  display: block; font-size: .82rem; color: var(--muted);
  padding: .3rem 0 .3rem .7rem; border-left: 2px solid var(--border);
}
.sidebar .fig-nav a:hover { color: var(--teal-br); border-left-color: var(--teal); }
.sidebar .s-actions { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: 'Inter', sans-serif; font-size: .82rem; font-weight: 600;
  padding: .55rem .95rem; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--card-2); color: var(--text);
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--teal); color: #fff; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #06231a; }
.btn-primary:hover { background: var(--teal-br); border-color: var(--teal-br); color: #06231a; }
.btn-sm { font-size: .75rem; padding: .4rem .7rem; }
.btn-block { justify-content: center; width: 100%; }

/* ---- Badges -------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .03em;
  padding: .25rem .6rem; border-radius: 999px; text-transform: uppercase;
}
.badge-working    { background: var(--teal-soft); color: var(--teal-br); border: 1px solid rgba(13,158,118,0.4); }
.badge-forthcoming{ background: rgba(224,168,59,0.12); color: var(--amber); border: 1px solid rgba(224,168,59,0.4); }
.badge-preliminary{ background: rgba(224,96,122,0.12); color: var(--rose); border: 1px solid rgba(224,96,122,0.4); }
.badge-published  { background: rgba(86,150,255,0.12); color: #7db0ff; border: 1px solid rgba(86,150,255,0.4); }
.badge-doi        { background: var(--card-2); color: var(--muted); border: 1px solid var(--border-2); text-transform: none; }

/* ---- Paper header -------------------------------------------------------- */
.paper-head .eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--teal-br); font-weight: 600; margin-bottom: .6rem; }
.paper-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin-bottom: .8rem; }
.paper-head .authors { font-size: .95rem; color: var(--text); margin-bottom: .25rem; }
.paper-head .affil { font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
.paper-head .meta-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.3rem; }
.paper-head .abstract {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--teal); border-radius: 10px;
  padding: 1.1rem 1.3rem; color: var(--muted); font-size: .95rem; margin-bottom: 1.2rem;
}
.paper-head .abstract strong { color: var(--text); }
.paper-head .head-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }

/* ---- Sections ------------------------------------------------------------ */
.section { margin: 2.6rem 0; }
.section > h2 { font-size: 1.35rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem; }
.section > h2::before { content: ""; width: 4px; height: 1.1em; background: var(--teal); border-radius: 2px; }
.section p { color: var(--muted); margin-bottom: .9rem; }

/* ---- Figure cards -------------------------------------------------------- */
.figure {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.4rem 1.5rem 1.2rem; margin: 1.6rem 0;
  box-shadow: var(--shadow); scroll-margin-top: 90px;
}
.figure .fig-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .2rem; }
.figure .fig-title { font-size: 1.05rem; color: #fff; font-weight: 600; }
.figure .fig-sub { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.figure .chart-box { position: relative; width: 100%; }
.figure .fig-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .9rem; flex-wrap: wrap; }
.figure .fig-source { font-size: .74rem; color: var(--faint); }
.fig-loading { color: var(--faint); font-size: .85rem; padding: 2rem 0; text-align: center; }

/* ---- Stat / finding boxes ------------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 1rem; margin: 1.2rem 0; }
.stat-box {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem 1.3rem;
}
.stat-box .stat-val { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 700; color: var(--teal-br); line-height: 1; }
.stat-box .stat-lbl { font-size: .82rem; color: var(--muted); margin-top: .5rem; }

.finding {
  background: var(--teal-soft); border: 1px solid rgba(13,158,118,0.35);
  border-left: 4px solid var(--teal); border-radius: 10px;
  padding: 1rem 1.2rem; margin: 1rem 0;
}
.finding .f-num { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal-br); font-weight: 700; }
.finding .f-stat { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; color: #fff; margin: .2rem 0; }
.finding .f-text { font-size: .9rem; color: var(--muted); }

/* key-finding box used on hub cards */
.keyfind {
  background: var(--teal-soft); border: 1px solid rgba(13,158,118,0.35);
  border-radius: 9px; padding: .7rem .85rem; margin: .8rem 0;
  font-size: .85rem; color: var(--text);
}
.keyfind .kf-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal-br); font-weight: 700; display: block; margin-bottom: .25rem; }

/* ---- Tags ---------------------------------------------------------------- */
.tag {
  display: inline-block; font-size: .7rem; font-weight: 500;
  padding: .2rem .55rem; border-radius: 999px;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--border);
}
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---- Research hub -------------------------------------------------------- */
.hub-head { max-width: 1300px; margin: 0 auto; padding: 2.5rem 2rem 1rem; }
.hub-head .eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--teal-br); font-weight: 600; margin-bottom: .6rem; }
.hub-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: .6rem; }
.hub-head p { color: var(--muted); max-width: 680px; font-size: 1rem; }

.controls { max-width: 1300px; margin: 0 auto; padding: 1.5rem 2rem .5rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search-wrap input {
  width: 100%; padding: .6rem .9rem; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text); font: inherit; font-size: .9rem;
}
.search-wrap input::placeholder { color: var(--faint); }
.search-wrap input:focus { outline: none; border-color: var(--teal); }
.filter-btns { display: flex; flex-wrap: wrap; gap: .45rem; }
.filter-btn {
  font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer;
  padding: .4rem .8rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border-2); color: var(--muted);
  transition: all .15s;
}
.filter-btn:hover { color: #fff; border-color: var(--teal); }
.filter-btn.active { background: var(--teal); border-color: var(--teal); color: #06231a; }

.card-grid {
  max-width: 1300px; margin: 0 auto; padding: 1.5rem 2rem 4rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 1.5rem;
}
.paper-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.4rem 1.5rem; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.paper-card:hover { transform: translateY(-3px); border-color: var(--teal); }
.paper-card .pc-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.paper-card .pc-date { font-size: .76rem; color: var(--faint); }
.paper-card h3 { font-size: 1.12rem; line-height: 1.3; margin-bottom: .5rem; }
.paper-card h3 a { color: #fff; }
.paper-card h3 a:hover { color: var(--teal-br); }
.paper-card .pc-authors { font-size: .82rem; color: var(--muted); margin-bottom: .7rem; }
.paper-card .pc-abstract { font-size: .88rem; color: var(--muted); margin-bottom: .2rem; flex: 1; }
.paper-card .pc-foot { margin-top: 1rem; display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
.no-results { max-width: 1300px; margin: 0 auto; padding: 2rem; color: var(--faint); text-align: center; }

/* ---- Toast --------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--teal); color: #06231a; font-weight: 600; font-size: .85rem;
  padding: .65rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Footer -------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--border); background: var(--bg-2);
  padding: 2rem; margin-top: 2rem;
}
.footer-inner { max-width: 1300px; margin: 0 auto; }
.footer-logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: .95rem; color: var(--muted); margin-bottom: .4rem; }
.footer-logo span { color: var(--teal-br); }
footer p { color: var(--faint); font-size: .8rem; margin-bottom: .35rem; }
footer a { color: var(--muted); }
footer a:hover { color: var(--teal-br); }

/* ---- Transmission chain / timeline (Brazil paper) ------------------------ */
.chain { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; justify-content: center; }
.chain-node {
  flex: 1; min-width: 150px; text-align: center;
  background: var(--card-2); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 1.1rem 1rem;
}
.chain-node .cn-icon { font-size: 1.4rem; }
.chain-node .cn-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: #fff; margin: .4rem 0 .25rem; font-size: .95rem; }
.chain-node .cn-sub { font-size: .76rem; color: var(--muted); }
.chain-arrow { display: flex; align-items: center; color: var(--teal-br); font-size: 1.6rem; padding: 0 .3rem; }
@media (max-width: 720px) { .chain-arrow { transform: rotate(90deg); } .chain { flex-direction: column; align-items: center; } .chain-node { width: 100%; } }
