/*
 * GreenFold shared stylesheet.
 *
 * Loaded from <head> BEFORE each page's own <style> block, so any rule a page
 * still defines locally continues to win. This lets pages migrate onto the
 * shared tokens one at a time instead of in a single risky sweep.
 *
 * Contents:
 *   1. Design tokens  - the canonical values; per-page :root blocks are being
 *                       removed as each page is migrated.
 *   2. Site nav       - the flat top bar injected by site_nav.js.
 */

/* ---------------------------------------------------------------- 1. tokens */

:root {
  --bg: #f4ede0;
  --panel: rgba(255, 250, 242, 0.86);
  --panel-strong: rgba(255, 252, 247, 0.92);
  --ink: #1d1a17;
  --muted: #6a6258;
  --line: rgba(78, 58, 29, 0.14);
  --accent: #1f5a4f;
  --accent-dark: #163f38;
  --accent-warm: #b76531;
  --danger: #8b1d1d;
  --shadow: 0 24px 60px rgba(64, 44, 12, 0.12);

  /* Live height of the sticky nav, remeasured by site_nav.js (it wraps to two
     rows on narrow screens). Page-level sticky elements offset from this so
     they stop below the bar instead of sliding under it. */
  --gf-nav-height: 52px;
}

/* -------------------------------------------------------------- 2. site nav */

.gf-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 237, 224, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.gf-nav-inner {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 52px;
  flex-wrap: wrap;
}

.gf-nav-brand {
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.gf-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.gf-nav-links a {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.14s ease, background 0.14s ease;
}

.gf-nav-links a:hover {
  color: var(--accent-dark);
  background: rgba(31, 90, 79, 0.08);
}

/* The current section, so a page always says where it sits in the site. */
.gf-nav-links a[aria-current="page"] {
  color: var(--accent-dark);
  background: rgba(31, 90, 79, 0.12);
}

/* Internal is rendered hidden and revealed only after /v1/frontend_config
   confirms the internal home is exposed on this deployment. */
.gf-nav-links a.gf-nav-internal[hidden] {
  display: none;
}

.gf-nav-links a.gf-nav-internal {
  color: var(--accent-warm);
}

/* -------------------------------------------------------- 3. model selector */

/* Rendered by model_bar.js into #modelBar on the tool pages. */
.gf-model-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gf-model-bar-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gf-model-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  box-shadow: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.gf-model-button:hover {
  border-color: rgba(31, 90, 79, 0.34);
  background: rgba(255, 255, 255, 0.95);
}

.gf-model-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

@media (max-width: 640px) {
  .gf-model-button {
    padding: 7px 11px;
    font-size: 0.82rem;
  }
}

/* ------------------------------------------------- 4. section sibling strip */

.gf-subnav {
  width: min(1180px, calc(100% - 28px));
  margin: 16px auto -6px;
}

.gf-subnav-inner {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gf-subnav a {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 650;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.gf-subnav a:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(31, 90, 79, 0.32);
}

.gf-subnav a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* Two alternatives read better as tabs than as a pill row: they answer the same
   question ("give me something this model can run") in two different ways, so
   the strip sits directly on top of the panel it switches. */
.gf-subnav.is-tabs {
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.gf-subnav.is-tabs .gf-subnav-inner {
  gap: 4px;
}

/* No "tab merges into the panel below" trick: this strip sits outside
   .page-shell and the next thing is a rounded card, so a connecting seam would
   line up with nothing. A rule under the row plus a filled active item is the
   honest version. */
.gf-subnav.is-tabs a {
  border-color: transparent;
  border-radius: 12px 12px 0 0;
  background: transparent;
  padding: 10px 16px;
  font-size: 0.9rem;
}

.gf-subnav.is-tabs a:hover {
  background: rgba(255, 255, 255, 0.62);
}

.gf-subnav.is-tabs a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

@media (max-width: 640px) {
  .gf-nav-inner {
    gap: 8px;
    padding-block: 8px;
  }

  .gf-nav-links {
    margin-left: 0;
    width: 100%;
    gap: 2px;
  }

  .gf-nav-links a {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .gf-subnav {
    margin-top: 12px;
  }

  .gf-subnav a {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}
