﻿/* ══════════════════════════════════════════════════════════════════════════
   Fresh Intel — Unified Design System v2.0
   One CSS file, one token set, consistent across all pages.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────── */

:root {
  /* Colours */
  --fi-green:        #2d6a30;
  --fi-green-mid:    #4a9450;
  --fi-green-light:  #e8f5e9;
  --fi-accent:       #f4a222;
  --fi-bg:           #f6f8fa;
  --fi-surface:      #ffffff;
  --fi-text:         #1a1a1a;
  --fi-text-muted:   #5a6272;
  --fi-border:       #d0d7de;
  --fi-danger:       #d73a49;
  --fi-info:         #0056b3;

  /* Legacy aliases used by auth.js and existing partials */
  --primary-color:   var(--fi-bg);
  --dark-color:      var(--fi-text);
  --light-color:     var(--fi-surface);
  --grey-color:      #464646;

  /* Typography */
  --fi-font:         'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fi-radius:       8px;
  --fi-shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --fi-shadow-md:    0 4px 12px rgba(0,0,0,0.10);

  /* Layout */
  --fi-navbar-h:     64px;
  --fi-content-max:  1100px;
}

/* ── Base Reset ─────────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--fi-font);
  font-size: 1rem;
  color: var(--fi-text);
  background-color: var(--fi-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.75rem;
  line-height: 1.25;
  font-weight: 600;
}

h1 { font-size: 2rem;    color: var(--fi-text); }
h2 { font-size: 1.5rem;  color: var(--fi-green); }
h3 { font-size: 1.125rem; color: var(--fi-text); }

p { margin: 0 0 0.75rem; }

/* Only colour <a> links that are actual anchor elements, not all descendants */
a { color: var(--fi-green); text-decoration: none; }
a:hover { color: var(--fi-green-mid); text-decoration: underline; }

/* Plain text paragraphs inside cards should never be link-coloured */
.gallery-container p,
.gallery-container li,
.fi-card p,
.fi-card li,
.funding p,
.funding h3 { color: var(--fi-text); }

/* Ensure links within text remain distinct but not overwhelming */
.gallery-container p a,
.funding p a { color: var(--fi-green); font-weight: 500; }

ul, ol { padding-left: 1.25rem; margin: 0 0 0.75rem; }
li { margin-bottom: 0.3rem; }
ul li::marker { color: var(--fi-green); }

/* ── Layout Helpers ─────────────────────────────────────────────────────── */

main { padding: 2rem; flex: 1; }

main:has(rapi-doc) {
  padding: 0;
  height: calc(100% + 83px);
}

main:has(iframe) {
  padding: 0;
  height: calc(100% - var(--fi-navbar-h));
}

rapi-doc {
  display: block;
  margin: 0; padding: 0; border: 0;
  height: calc(100% + 83px);
}

iframe {
  display: block;
  margin: 0; padding: 0; border: 0;
  width: 100%; height: 100%;
}

.sticky {
  align-self: flex-start;
  max-height: 100vh;
  min-height: 85vh;
  margin: 0; width: 100%;
  justify-content: center;
  top: 0; position: sticky;
  padding-top: calc(var(--fi-navbar-h) + 80px);
  background-color: var(--fi-bg);
}

.buffer { height: 80px; }
.break { flex-basis: 100%; height: 0; }

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

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

.fi-card:hover {
  border-color: var(--fi-green-mid);
  box-shadow: var(--fi-shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.fi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.4rem;
  font-family: var(--fi-font);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--fi-radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

.fi-btn:hover { transform: scale(1.03); }

.fi-btn-primary {
  background: var(--fi-green);
  color: #fff;
  border-color: var(--fi-green);
}
.fi-btn-primary:hover { background: var(--fi-green-mid); }

.fi-btn-secondary {
  background: var(--fi-surface);
  color: var(--fi-text);
  border-color: var(--fi-border);
}
.fi-btn-secondary:hover { background: var(--fi-bg); }

/* ── Navbar ─────────────────────────────────────────────────────────────── */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--fi-surface) !important; /* always white, never inherits page bg */
  color: var(--fi-text);
  border-bottom: 1px solid var(--fi-border);
  width: 100%;
  height: var(--fi-navbar-h);
  /* No z-index here — adding z-index would create a stacking context that
     traps the mobile drawer (z:999) below the backdrop overlay (z:998) */
  position: relative;
  box-shadow: 0 1px 0 var(--fi-border);
}

.navbar:has(~ * iframe)  { border-bottom: none; }
.logo-img {
  width: 80px;
  margin-left: 1rem;
}

.navbar a:not(:has(img)) {
  text-decoration: none;
  color: var(--fi-text);
  padding: 1.1rem 1.25rem;
  font-size: 1rem;
  line-height: 1;
}

.navbar-right {
  display: flex;
  align-items: center;
  margin-right: 1.5rem;
}

.navbar a:not(:has(img)):hover {
  background-color: var(--fi-green-light);
  color: var(--fi-green);
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown .dropbtn { cursor: pointer; }

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow-md);
  z-index: 200;
  margin-top: 0.25rem;
  right: 0;
  left: auto;
  white-space: nowrap;
  min-width: 200px;
  overflow: hidden;
}

.dropdown-content a {
  color: var(--fi-text);
  padding: 0.65rem 1rem;
  text-decoration: none;
  display: block;
  font-size: 0.9375rem;
}

.dropdown-content a:hover {
  background-color: var(--fi-green-light);
  color: var(--fi-green);
}

.dropdown:hover .dropdown-content { display: block; }

/* Section heading links in dropdown */
.dropdown-section-link {
  color: var(--fi-green) !important;
  font-weight: 600 !important;
  font-size: 0.8125rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 0.75rem !important;
  padding-bottom: 0.3rem !important;
  border-top: 1px solid var(--fi-border);
}

.dropdown-section-link:first-child { border-top: none; padding-top: 0.5rem !important; }
.dropdown-section-link:hover { background-color: var(--fi-green-light) !important; }

/* ── Hamburger (mobile) ─────────────────────────────────────────────────── */

.hamburger {
  display: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--fi-text);
}

.closebtn { display: none; }
.hide { display: none; }

/* ── Password toggle ────────────────────────────────────────────────────── */

#show-pwd { display: none; }
#unchecked { display: block; }
#checked   { display: none; }

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button { display: none !important; }

#show-pwd:checked + #unchecked { display: none; }
#show-pwd:checked ~ #checked   { display: block; }

label[for="show-pwd"] {
  position: absolute;
  align-self: flex-end;
  padding-right: 30px;
}

/* ── Forms (global) ─────────────────────────────────────────────────────── */

input, button, select, textarea {
  font-family: var(--fi-font);
  font-size: 1rem;
  border-radius: var(--fi-radius);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  border: 1px solid var(--fi-border);
  padding: 0.55rem 0.75rem;
  width: 100%;
  color: var(--fi-text);
  background: var(--fi-surface);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--fi-green);
  box-shadow: 0 0 0 3px rgba(45,106,48,0.12);
}

.calculator-main input:disabled,
.calculator-main select:disabled,
.calculator-main textarea:disabled {
  background: #eef1f3;
  border-color: #d4d9df;
  color: #7a848f;
  cursor: not-allowed;
}

button {
  font-weight: 600;
  cursor: pointer;
}

/* ── Gallery / Calculators page ─────────────────────────────────────────── */

.home {
  display: block;
}

.home img { margin: 10px; }

.gallery {
  --gallery-gap: 1rem;
  width: 90%;
  max-width: 1000px;
  display: flex;
  flex-wrap: nowrap;
  gap: var(--gallery-gap);
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.25rem 0.1rem 0.2rem;
  margin: 0.75rem auto 0.35rem;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.home-news {
  width: 90%;
  max-width: 900px;
  margin: 1.25rem auto 1.5rem;
}

.home-news-header h2 {
  margin: 0;
  color: var(--fi-text);
}

.home-news-header p {
  margin: 0.35rem 0 0;
  color: var(--fi-text-muted);
}

.home-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.home-news-card {
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow);
  overflow: hidden;
}

.home-news-card-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.home-news-card-link:hover {
  text-decoration: none;
}

.home-news-card:hover {
  border-color: var(--fi-green-mid);
  box-shadow: var(--fi-shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.home-news-card img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  margin: 0;
}

.home-news-card-content {
  padding: 0.9rem 1rem 1rem;
}

.home-news-card-content h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--fi-green);
}

.home-news-card-link:hover .home-news-card-content h3 {
  color: var(--fi-green-mid);
}

.home-news-date {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.875rem;
  color: var(--fi-text-muted);
}

.home-news-card-content p {
  margin: 0;
  color: var(--fi-text);
}

.home-news-card-empty .home-news-card-content {
  padding: 1rem;
}

.gallery-container {
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow);
  padding: 1.5rem;
  flex: 0 0 calc((100% - var(--gallery-gap)) / 2);
  max-width: calc((100% - var(--gallery-gap)) / 2);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  min-height: 260px;
}

.gallery-dots {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto 0.85rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
}

.gallery-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 0;
  background: #c8ced6;
  padding: 0;
  cursor: pointer;
}

.gallery-dot.active {
  background: var(--fi-green);
}

.gallery-container:hover {
  border-color: var(--fi-green-mid);
  box-shadow: var(--fi-shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gallery-container h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--fi-green);
}

.gallery-container b {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--fi-green);
}

.gallery-container p,
.gallery-container li { color: var(--fi-text); }

.gallery-container ul {
  padding-left: 1.25rem;
  margin: 0;
  flex: 1;
}

.gallery-container img {
  border-radius: calc(var(--fi-radius) - 2px);
  max-width: 100%;
  width: 100%;
  height: 200px;
  object-fit: cover;
  align-self: stretch;
}

/* Button sits at bottom, full width */
.gallery-container .commodity-action {
  margin-top: auto;
  align-self: stretch;
  text-align: center;
}

/* Robustness cards: green accent top border */
.gallery-container.public-calculator {
  border-top: 4px solid var(--fi-green);
}

.gallery-container.public-calculator h3 {
  color: var(--fi-green);
}

.gallery-container.public-calculator ul li::marker {
  color: var(--fi-accent);
}

/* Free access tag */
.free-access-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background-color: var(--fi-green-light);
  color: var(--fi-green);
  border: 1px solid rgba(45,106,48,0.2);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: 0;
  text-transform: none;
}

/* Gallery section separator */
.gallery-section-label {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--fi-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0.5rem 0 0;
}

.gallery-section-label::before,
.gallery-section-label::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--fi-border);
}

/* News pages */
.news-feed,
.news-post {
  width: 90%;
  max-width: 900px;
  margin: 0 auto;
}

.news-feed-header,
.news-post-header {
  margin: 0 0 1.25rem;
}

.news-feed-header h1,
.news-post-header h1 {
  margin: 0;
  color: var(--fi-text);
}

.news-feed-subtitle {
  margin-top: 0.4rem;
  color: var(--fi-text-muted);
}

.news-card,
.news-post-content {
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow);
}

.news-card {
  margin-top: 1rem;
  padding: 1.25rem 1.35rem;
}

.news-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.news-card-link:hover {
  text-decoration: none;
}

.news-card:hover {
  border-color: var(--fi-green-mid);
  box-shadow: var(--fi-shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.news-card-body {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 1rem;
  align-items: start;
}

.news-card-image {
  display: block;
  width: 100%;
  max-width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: calc(var(--fi-radius) - 2px);
  margin: 0;
}

.news-card-copy {
  min-width: 0;
}

.news-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: var(--fi-green);
}

.news-card-link:hover h2 {
  color: var(--fi-green-mid);
}

.news-date {
  margin: 0 0 0.7rem;
  color: var(--fi-text-muted);
  font-size: 0.9rem;
}

.news-summary {
  margin: 0 0 1rem;
  color: var(--fi-text);
}

.news-post-content {
  margin-top: 1rem;
  padding: 1.25rem 1.35rem;
}

.news-post-content.has-featured-image {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.news-post-inline-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: calc(var(--fi-radius) - 2px);
  margin: 0;
}

.news-post-body-column {
  min-width: 0;
}

.news-post-content h2,
.news-post-content h3,
.news-post-content h4 {
  color: var(--fi-text);
}

.news-post-content p,
.news-post-content li {
  color: var(--fi-text);
}

.news-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--fi-radius) - 2px);
}

.news-post-content .wp-block-image,
.news-post-content figure.wp-block-image,
.news-post-content figure.wp-block-gallery,
.news-post-content .wp-block-quote,
.news-post-content .wp-block-pullquote,
.news-post-content .wp-block-table,
.news-post-content .wp-block-embed {
  margin: 1rem 0;
}

.news-post-content .wp-block-image img,
.news-post-content figure.wp-block-image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0;
}

.news-post-content .alignleft {
  float: left;
  width: min(44%, 320px);
  margin: 0.15rem 1rem 0.75rem 0;
}

.news-post-content .alignright {
  float: right;
  width: min(44%, 320px);
  margin: 0.15rem 0 0.75rem 1rem;
}

.news-post-content .aligncenter {
  float: none;
  clear: both;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1rem auto;
  text-align: center;
}

.news-post-content .alignwide {
  clear: both;
  max-width: min(100%, 980px);
  margin-left: auto;
  margin-right: auto;
}

.news-post-content .alignfull {
  clear: both;
  max-width: 100%;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.news-post-content .wp-block-gallery,
.news-post-content ul.blocks-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  padding: 0;
  list-style: none;
}

.news-post-content .wp-block-gallery .wp-block-image,
.news-post-content .wp-block-gallery .blocks-gallery-item,
.news-post-content .blocks-gallery-grid .blocks-gallery-item {
  margin: 0;
}

.news-post-content .wp-block-gallery .wp-block-image img,
.news-post-content .wp-block-gallery .blocks-gallery-item img,
.news-post-content .blocks-gallery-grid .blocks-gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.news-post-content .aligncenter img {
  display: inline-block;
  margin: 0 auto;
}

.news-post-content figure.wp-block-image.aligncenter {
  clear: both;
  float: none !important;
  width: 100%;
  margin: 1rem auto;
  text-align: center;
}

.news-post-content figure.wp-block-image.aligncenter img {
  margin: 0 auto;
}

.news-post-content .wp-block-quote {
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--fi-green-mid);
  border-radius: 0 8px 8px 0;
  background: rgba(10, 59, 40, 0.05);
}

.news-post-content .wp-block-quote p,
.news-post-content .wp-block-quote cite {
  margin: 0;
}

.news-post-content .wp-block-quote cite {
  display: block;
  margin-top: 0.55rem;
  color: var(--fi-text-muted);
  font-size: 0.9rem;
}

.news-post-content .wp-block-pullquote {
  padding: 1rem 1.2rem;
  border-top: 2px solid var(--fi-border);
  border-bottom: 2px solid var(--fi-border);
  text-align: center;
}

.news-post-content .wp-block-pullquote blockquote {
  margin: 0;
}

.news-post-content figcaption,
.news-post-content .wp-element-caption,
.news-post-content .blocks-gallery-item__caption {
  margin-top: 0.45rem;
  color: var(--fi-text-muted);
  font-size: 0.875rem;
}

.news-post-content .wp-block-table {
  overflow-x: auto;
}

.news-post-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
}

.news-post-content .wp-block-table th,
.news-post-content .wp-block-table td {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--fi-border);
}

.news-post-content .wp-block-embed iframe,
.news-post-content .wp-block-embed video {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: calc(var(--fi-radius) - 2px);
}

.news-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--fi-green);
}

.news-back-link:hover {
  color: var(--fi-green-mid);
}

@media (max-width: 760px) {
  .news-card-body {
    grid-template-columns: 1fr;
  }

  .news-card-image {
    margin: 0 auto;
  }

  .news-post-inline-image {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 0.9rem;
  }

  .news-post-content.has-featured-image {
    grid-template-columns: 1fr;
  }

  .news-post-content .alignleft,
  .news-post-content .alignright {
    float: none;
    width: 100%;
    margin: 0 auto 0.9rem;
  }
}

/* Commodity action buttons */
.commodity-action {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 0.65rem 1.4rem;
  color: #fff;
  background-color: var(--fi-green);
  border: 1px solid var(--fi-green);
  border-radius: var(--fi-radius);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  text-align: center;
}

.commodity-action:hover {
  background-color: var(--fi-green-mid);
  border-color: var(--fi-green-mid);
  color: #fff;
  text-decoration: none;
  transform: scale(1.02);
}

.commodity-action.public-access {
  background-color: var(--fi-green);
  border-color: var(--fi-green);
}

/* ── Funding section ────────────────────────────────────────────────────── */

.funding {
  width: 90%;
  max-width: 900px;
  text-align: center;
  color: var(--fi-text);
  margin: 2rem auto 2rem;
}

.funding p, .funding b { color: var(--fi-text); }

/* ── Auth pages ─────────────────────────────────────────────────────────── */

.auth-page_container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--fi-navbar-h) - 140px);
}

.login-form-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  margin-top: 2rem;
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  box-shadow: var(--fi-shadow-md);
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}

.login-form h2 {
  text-align: center;
  margin-bottom: 0.5rem;
}

.input-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  color: var(--fi-text-muted);
}

.input-group input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  width: 100%;
}

.input-group,
.login-btn,
.google-login-btn {
  width: 100%;
  justify-content: center;
  align-items: center;
  display: flex;
}

.terms-consent {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.terms-consent input { width: auto; margin-top: 0.2rem; }
.terms-consent label { margin: 0; text-align: left; }

.login-btn {
  background-color: var(--fi-green);
  border: 1px solid var(--fi-green);
  font-weight: 600;
  color: white;
  cursor: pointer;
  height: 2.5rem;
  font-size: 1rem;
  border-radius: var(--fi-radius);
  width: 100%;
  transition: background 0.15s, transform 0.1s;
}

.login-btn:hover {
  background-color: var(--fi-green-mid);
  transform: scale(1.02);
}

.google-login-btn {
  color: var(--fi-text);
  background-color: var(--fi-surface);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  transition: background 0.15s, transform 0.1s;
}

.google-login-btn:hover { background: var(--fi-bg); transform: scale(1.02); }
.google-btn-logo { width: 1.375em; }

.alt-signin-divider {
  margin: 1em 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--fi-text-muted);
}

.signup-link-container {
  text-align: center;
  margin-top: 0.75em;
}

.login-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fi-text);
  text-decoration: none;
  font-weight: 500;
  max-width: 10rem;
  margin-top: 1rem;
  height: 2.5rem;
  cursor: pointer;
  background-color: var(--fi-bg);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
}

.login-link-btn:hover { background-color: var(--fi-border); }

.error-msg {
  color: var(--fi-danger);
  font-size: 0.875rem;
  margin-top: 0.4em;
  text-align: center;
}

.info-msg {
  color: var(--fi-info);
  font-size: 0.875rem;
  margin-bottom: 0.6em;
  text-align: center;
}

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

footer {
  position: static;
  width: 100%;
  margin-top: 2rem;
  background-color: var(--grey-color);
  color: white;
  font-family: var(--fi-font);
  text-align: center;
  padding: 8px 0;
  font-size: 0.875rem;
}

.simple-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.simple-footer a {
  color: white;
  text-decoration: none;
  margin: 0 5px;
}

.simple-footer a:hover { text-decoration: underline; }

/* ── API / Keys page ────────────────────────────────────────────────────── */

.keys {
  border-radius: var(--fi-radius);
  padding: 1.5rem;
  width: 80%;
  margin: auto;
  box-shadow: var(--fi-shadow-md);
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
}

.keys-out { display: flex; }

.keys-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 10%;
}

.keys output { overflow: auto; }

.keys button {
  width: 50px;
  background-color: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  color: var(--fi-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  padding: 0.75rem 1rem;
  text-align: center;
  box-shadow: var(--fi-shadow);
  cursor: pointer;
  user-select: none;
}

/* ── Shiny iframe helper ─────────────────────────────────────────────────── */

#calc-frame {
  overflow-y: clip;
  height: 100%;
}

#calc-frame::before {
  content: '';
  position: absolute;
  z-index: 2;
  box-shadow: inset 0px 8px 16px -4px rgba(128,128,128,0.2);
  top: var(--fi-navbar-h);
  right: 0; bottom: 0; left: 0;
  pointer-events: none;
}

#uptime-frame::before {
  content: '';
  position: absolute;
  z-index: 2;
  box-shadow: inset 0px 8px 16px -4px rgba(128,128,128,0.2);
  top: var(--fi-navbar-h);
  right: 0; bottom: 0; left: 0;
  pointer-events: none;
}

rapi-doc {
  box-shadow: inset 0px 8px 16px -4px rgba(128,128,128,0.2);
}

.docs-main {
  padding: 0;
  flex: 1;
  min-height: calc(100vh - var(--fi-navbar-h));
}

.docs-main #placeholder,
.docs-main rapi-doc {
  display: block;
  width: 100%;
  height: calc(100vh - var(--fi-navbar-h));
  min-height: calc(100vh - var(--fi-navbar-h));
  margin: 0;
  border: 0;
}

/* ── Robustness breadcrumb (kept for backward compat but hidden) ─────────── */
.robustness-breadcrumb { display: none; }

/* ── Layout buffers (kept for legacy markup, no longer needed) ───────────── */
.buffer { height: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media screen and (max-width: 840px) {
  .buffer { height: 0; }
  .funding { width: 100%; }

  .navbar-right {
    position: fixed;
    top: 0; left: -100%;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--fi-surface);
    border-right: 1px solid var(--fi-border);
    box-shadow: 4px 0 16px rgba(0,0,0,0.12);
    overflow-x: hidden;
    overflow-y: auto;
    transition: left 0.35s ease;
    padding: 0;
    padding-top: 3.5rem; /* clear the close button */
    padding-bottom: 2rem;
    margin: 0;
    z-index: 999;
  }

  /* top strip inside the drawer — holds the close button */
  .closebtn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3.5rem;
    padding: 0 1rem;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--fi-text-muted);
    border-bottom: 1px solid var(--fi-border);
    background-color: var(--fi-surface);
  }

  /* top-level nav links */
  .navbar-right > a {
    display: block;
    color: var(--fi-text);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    border-bottom: 1px solid var(--fi-border);
    transition: background-color 0.15s;
  }

  .navbar-right > a:hover,
  .navbar-right > a:active {
    background-color: var(--fi-green-light);
    color: var(--fi-green);
  }

  /* suppress desktop hover highlight inside the drawer */
  .navbar a:hover { background-color: inherit; }

  /* dropdown wrapper */
  .dropdown {
    width: 100%;
    border-bottom: 1px solid var(--fi-border);
  }

  .dropdown .dropbtn {
    display: block;
    width: 100%;
    color: var(--fi-text);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
  }

  .dropdown .dropbtn:hover { background-color: var(--fi-green-light); color: var(--fi-green); }

  /* dropdown sub-items: always visible on mobile (no hover needed) */
  .dropdown-content {
    display: block;
    position: relative;
    width: 100%;
    right: auto;
    left: auto;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background-color: var(--fi-surface);
    overflow-y: visible;
    white-space: normal;
  }

  .dropdown-content a {
    display: block;
    text-align: left;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--fi-text);
    padding: 0.65rem 1.25rem 0.65rem 2rem;
    border: none;
    text-decoration: none;
  }

  .dropdown-content a:hover,
  .dropdown-content a:active {
    background-color: var(--fi-green-light);
    color: var(--fi-green);
  }

  /* section heading style preserved, left-aligned and indented */
  .dropdown-section-link {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--fi-green) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.65rem 1.25rem 0.3rem 1.25rem !important;
    border-top: 1px solid var(--fi-border) !important;
    background: none;
  }

  .dropdown-section-link:first-child { border-top: none !important; }

  .hamburger {
    display: block;
    position: absolute;
    right: 1rem;
    font-size: 2rem;
  }

  .simple-footer { flex-direction: column; padding: 0; }

  .gallery {
    width: 92%;
    max-width: 1000px;
    scroll-snap-type: x mandatory;
  }

  .gallery-container {
    flex: 0 0 100%;
    max-width: 100%;
    min-height: 0;
    padding: 1rem;
    scroll-snap-align: start;
  }
}
/* ── Info pages (supply chain, robustness overview) ─────────────────────── */

.info-hero {
  background: linear-gradient(135deg, var(--fi-green) 0%, var(--fi-green-mid) 100%);
  color: #fff;
  padding: 3rem 2rem 2.5rem;
}

.info-hero__inner {
  max-width: var(--fi-content-max);
  margin: 0 auto;
}

.info-hero h1 {
  color: #fff;
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.info-hero p {
  color: rgba(255,255,255,0.9);
  font-size: 1.125rem;
  max-width: 65ch;
  margin: 0;
}

.info-section {
  padding: 2.5rem 2rem;
}

.info-section--muted {
  background: var(--fi-surface);
  border-top: 1px solid var(--fi-border);
}

.info-section__inner {
  max-width: var(--fi-content-max);
  margin: 0 auto;
}

.info-section h2 { margin-bottom: 1rem; }

.full-bleed-main {
  padding: 0;
}

.info-lead {
  font-size: 1.05rem;
  color: var(--fi-text-muted);
  margin-bottom: 1.5rem;
}

/* Two-column split: text + video(s) */
.info-split {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.info-split__text { flex: 1 1 0; }
.info-split__media { flex: 0 0 420px; max-width: 420px; }

/* YouTube embed */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--fi-radius);
  background: #000;
}

.video-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: var(--fi-radius);
}

/* Team grid */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
  gap: 1.25rem;
  margin-top: 1rem;
}

.team-card {
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  padding: 1.25rem;
  box-shadow: var(--fi-shadow);
}

.team-photo-placeholder {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.75rem;
  color: var(--fi-text-muted);
}

.team-photo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 0.75rem;
}

.team-name { font-size: 1rem; margin-bottom: 0.2rem; }
.team-role { font-size: 0.875rem; color: var(--fi-green); font-weight: 600; margin-bottom: 0.5rem; }
.team-bio  { font-size: 0.875rem; color: var(--fi-text-muted); margin: 0; }

/* Funding logos row */
.funding-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin-top: 1rem;
}

@media screen and (max-width: 840px) {
  .info-split { flex-direction: column; }
  .info-split__media { flex: 1 1 auto; max-width: 100%; }
  .info-hero h1 { font-size: 1.75rem; }
}

/* ── Shared calculator components ───────────────────────────────────────── */

/* Unified page header — used by both shelf-life and robustness calculators */
.calc-page-header {
  max-width: var(--fi-content-max);
  margin: 1.25rem auto 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--fi-green);
}

.calc-page-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--fi-text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.calc-page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--fi-text-muted);
  font-size: 0.95rem;
}

/* Section headings inside calculator cards */
.fi-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fi-green);
  border-bottom: 1px solid var(--fi-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.fi-subsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fi-text);
  margin-top: 0.65rem;
  margin-bottom: 0.5rem;
}

/* Shared button system extensions (base .fi-btn defined above) */
.fi-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.84rem; }

.fi-btn-ghost {
  background: transparent;
  color: var(--fi-text-muted);
  border-color: var(--fi-border);
}
.fi-btn-ghost:hover { background: var(--fi-bg); color: var(--fi-text); }

.fi-btn:disabled,
.fi-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Shelf-life native calculator pages ─────────────────────────────────── */

.calculator-main {
  padding: 0;
  overflow-x: clip;
}

.calculator-main .page-header {
  background: var(--fi-surface);
  border-bottom: 1px solid var(--fi-border);
  padding: 1.2rem 2rem;
}

.calculator-main .page-header-copy {
  min-width: 0;
}

.calculator-main .page-header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--fi-green);
  margin: 0;
}

.calculator-main .page-subtitle {
  font-size: 0.875rem;
  color: var(--fi-text-muted);
  margin-top: 0.2rem;
  max-width: 64ch;
}

.calculator-main .page-description {
  font-size: 0.875rem;
  color: var(--fi-text);
  margin-top: 0.5rem;
  max-width: 80ch;
  line-height: 1.5;
}

.shelf-life-shell {
  display: block;
  overflow-x: clip;
}

.shelf-life-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  max-width: var(--fi-content-max);
}

/* Tabs */
.page-tabs {
  display: flex;
  gap: 0;
  background: var(--fi-surface);
  border-bottom: 2px solid var(--fi-border);
  padding: 0 2rem;
}

.page-tab {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fi-text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.page-tab:hover {
  color: var(--fi-text);
}

.page-tab.active {
  color: var(--fi-text);
  border-bottom-color: var(--fi-green);
}

/* Page sections */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* Background content (information tab) */
.page-body {
  padding: 0 2rem 2rem;
}

.background-content {
  max-width: 900px;
}

.bg-section {
  margin-bottom: 2rem;
}

.bg-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fi-green);
  margin-bottom: 0.75rem;
}

.bg-section dl {
  margin: 0;
}

.bg-section dt {
  font-weight: 700;
  color: var(--fi-green);
  margin-top: 1rem;
}

.bg-section dt:first-child {
  margin-top: 0;
}

.bg-section dd {
  margin: 0.25rem 0 0 0;
  color: var(--fi-text);
  line-height: 1.6;
}

/* Deprecated: old calculator section styles */
.calculator-section {
  display: none;
}

.calculator-section.active {
  display: block;
}

.guide-section {
  padding: 1.5rem;
}

.guide-content dl {
  margin: 0;
}

.guide-content dt {
  font-weight: 700;
  color: var(--fi-green);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.guide-content dt:first-child {
  margin-top: 0;
}

.guide-content dd {
  margin: 0 0 1rem 0;
  color: var(--fi-text);
  line-height: 1.6;
}

/* Form groups inside calculator cards */
.form-group {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.75rem;
  row-gap: 0;
}

.meta-grid .form-group label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#harvestDayGroup {
  max-width: 10.5rem;
}

#harvestDayGroup input[type="date"] {
  width: auto;
  inline-size: 9rem;
  max-width: 100%;
  min-width: 0;
  justify-self: start;
}

/* Shipment leg list */
.shipment-legs {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.shipment-leg {
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  background: #fafbfc;
  padding: 0.65rem 0.85rem;
  display: grid;
  gap: 0.45rem;
  transition: box-shadow 0.15s;
}

.shipment-leg:hover {
  box-shadow: var(--fi-shadow);
}

.leg-heading {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fi-green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.shipment-leg-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.65rem;
}

.leg-field {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.leg-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  min-width: 0;
}

.leg-field label {
  font-size: 0.78rem;
  color: var(--fi-text-muted);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

.slider-readout {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fi-text);
  white-space: nowrap;
}

/* Slider rows */
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.slider-row input[type="range"] {
  width: 100%;
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--fi-green) 0%, var(--fi-border) 0%);
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fi-green);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: background 0.15s;
}

.slider-row input[type="range"]:hover::-webkit-slider-thumb {
  background: var(--fi-green-mid);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--fi-green);
  cursor: pointer;
}

.slider-value {
  font-variant-numeric: tabular-nums;
}

/* Screen-reader only — hides duplicate number inputs visually */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Leg add/remove action row */
.leg-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Calculator status bar */
.calc-status {
  min-height: 1.4rem;
  font-size: 0.92rem;
  color: var(--fi-text-muted);
  margin: 0.25rem 0 0.75rem;
}

.calc-status-success { color: var(--fi-green); }
.calc-status-warning { color: var(--fi-accent); }
.calc-status-error   { color: var(--fi-danger); }

/* Empty state (before first prediction) */
.calc-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--fi-text-muted);
}

.calc-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.calc-empty-state p {
  font-size: 0.95rem;
  margin: 0;
}

/* Shelf-life panels — no fixed heights; let content drive height so the page scrolls */
.shelf-life-form,
.shelf-life-results {
  height: auto;
  min-height: 0;
  overflow: hidden;
}

/* Functional panels don't get hover highlighting (only navigation cards do) */
.shelf-life-form:hover,
.shelf-life-results:hover {
  border-color: var(--fi-border);
  box-shadow: var(--fi-shadow);
}

/* Info panel with descriptive text */
.info-panel {
  margin-bottom: 1.5rem;
}

.calc-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--fi-text);
}

/* Plotly chart container */
.shelf-life-chart {
  width: 100%;
  height: 260px;
  min-height: 260px;
  margin-bottom: 1.25rem;
  border-radius: var(--fi-radius);
  overflow: hidden;
  visibility: hidden;
}

.shelf-life-timeline {
  width: 100%;
  min-height: 205px;
  padding: 0.55rem 0.4rem 0.45rem;
}

.distribution-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 1fr);
  gap: 0.45rem;
  align-items: center;
  --tray-align-shift: 0px;
}

.distribution-main {
  min-width: 0;
}

.produce-tray-widget {
  border: none;
  border-radius: var(--fi-radius);
  background: transparent;
  padding: 0.42rem;
  transform: translateY(var(--tray-align-shift));
}

.produce-tray-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.produce-tray-item {
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  line-height: 1;
  border-radius: 0;
  border: none;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  background: var(--tray-color);
  overflow: hidden;
}

.produce-tray-item.tray-edge-top {
  border-top: 1px solid var(--tray-edge);
}

.produce-tray-item.tray-edge-right {
  border-right: 1px solid var(--tray-edge);
}

.produce-tray-item.tray-edge-bottom {
  border-bottom: 1px solid var(--tray-edge);
}

.produce-tray-item.tray-edge-left {
  border-left: 1px solid var(--tray-edge);
}

@media (max-width: 799px) {
  .distribution-layout {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    justify-items: center;
  }

  .distribution-main {
    width: 100%;
  }

  .shelf-life-timeline {
    min-height: 0;
    padding: 0.35rem 0.2rem 0.2rem;
  }

  .produce-tray-widget {
    padding: 0.38rem;
    width: 100%;
    max-width: 220px;
    justify-self: center;
    transform: none;
  }
}

.shelf-life-timeline.timeline-refresh {
  animation: fi-timeline-refresh 240ms ease-out;
}

.shelf-life-timeline svg {
  width: 100%;
  height: auto;
  display: block;
}

.shelf-life-timeline svg text {
  font-family: "Open Sans", sans-serif;
}

@keyframes fi-timeline-refresh {
  0% { opacity: 0.6; transform: translateY(2px) scale(0.996); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-life-timeline.timeline-refresh {
    animation: none;
  }
}

/* Tables */
.table-responsive { overflow-x: auto; }

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.result-table th,
.result-table td {
  border: 1px solid var(--fi-border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-size: 0.9rem;
}

.result-table th {
  background: var(--fi-bg);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fi-text-muted);
}

.calc-interval-caption {
  margin: -0.2rem 0 0.55rem;
  font-size: 0.82rem;
  color: var(--fi-text-muted);
}

.result-table-compact th,
.result-table-compact td {
  text-align: center;
  padding: 0.38rem 0.45rem;
}

.result-table-compact td {
  font-weight: 600;
  color: var(--fi-text);
}

/* Chilling injury gauge */
.gauge-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gauge-track {
  flex: 1;
  height: 16px;
  border-radius: 999px;
  background: #e6ebef;
  overflow: hidden;
}

.gauge-fill {
  width: 0%;
  height: 100%;
  background: var(--fi-green);
  transition: width 0.25s;
}

.gauge-fill.gauge-warning { background: var(--fi-accent); }
.gauge-fill.gauge-danger  { background: var(--fi-danger); }

/* Stone fruit value cards */
.value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.value-card {
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  background: var(--fi-bg);
  padding: 0.85rem;
  text-align: center;
  transition: box-shadow 0.15s;
}

.value-card:hover {
  box-shadow: var(--fi-shadow);
}

.value-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fi-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.value-value {
  margin: 0.3rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fi-green);
}

/* ── Home & Calculators landing pages ──────────────────────────────────── */

/* Extend info-hero with new selectors used on the home/calculators pages */
.info-hero__content {
  max-width: var(--fi-content-max);
  margin: 0 auto;
}

.info-hero__lead {
  color: rgba(255,255,255,0.9);
  font-size: 1.125rem;
  max-width: 65ch;
  margin: 0 0 1.25rem;
}

.info-hero__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Section spacing wrapper */
.page-section {
  max-width: var(--fi-content-max);
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

/* Home / calculators card grid */
.home-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  max-width: 800px; /* Limit to 2 columns max */
  gap: 1.25rem;
}

/* Hover lift for explicit hover-enabled cards */
.fi-card-hover {
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.fi-card-hover:hover {
  border-color: var(--fi-green-mid);
  box-shadow: var(--fi-shadow-md);
  transform: translateY(-2px);
}

/* Calculator card imagery */
.calc-card-img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: calc(var(--fi-radius) - 2px);
  margin: 1rem 0;
}

/* Calculator card action row */
.calc-card-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* Free/public access badge */
.fi-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.fi-badge-free {
  background: var(--fi-green-light);
  color: var(--fi-green);
  border: 1px solid var(--fi-green-mid);
}

/* Category page shell aligned to robustness home */
.category-shell {
  max-width: var(--fi-content-max);
  margin: 1.25rem auto 2rem;
  padding: 0 1.5rem;
}

.category-shell .home-hero {
  background: var(--fi-surface);
  color: var(--fi-text);
  border-radius: var(--fi-radius);
  border: 1px solid var(--fi-border);
  border-left: 4px solid var(--fi-green);
  box-shadow: var(--fi-shadow-md);
  margin: 0 0 1rem;
  padding: 1.5rem 2rem;
}

.category-shell .home-hero * { color: var(--fi-text); }

.category-shell .home-kicker {
  color: var(--fi-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.category-shell .home-intro-title {
  color: var(--fi-green);
  font-size: 1.5rem;
  margin: 0.35rem 0 0.6rem;
}

.category-shell .home-panel {
  background: var(--fi-surface);
  border-radius: var(--fi-radius);
  border: 1px solid var(--fi-border);
  box-shadow: var(--fi-shadow);
  margin: 0 0 1rem;
  padding: 1.5rem;
}

.category-shell .home-section-title {
  color: var(--fi-green);
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--fi-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.category-shell .home-split-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 1rem;
  align-items: center;
}

.category-shell .home-split-panel--reverse {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

.category-shell .home-split-panel--reverse .home-panel-copy {
  order: 2;
}

.category-shell .home-split-panel--reverse .home-panel-media {
  order: 1;
}

.category-shell .home-video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--fi-radius);
  background: #000;
}

.category-shell .home-panel-media {
  width: 100%;
  max-width: 420px;
}

.category-shell .home-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.category-shell .home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.category-shell .home-card {
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius);
  padding: 1rem;
  box-shadow: var(--fi-shadow);
}

.category-shell .home-card h3 {
  margin-bottom: 0.45rem;
}

.category-shell .home-card .home-card-btn {
  width: 100%;
  margin-top: 0.75rem;
}

@media (max-width: 980px) {
  .shelf-life-grid {
    grid-template-columns: 1fr;
    margin: 0.75rem auto;
    padding: 0 0.75rem;
  }

  .meta-grid,
  .value-grid {
    grid-template-columns: 1fr;
  }

  .shipment-leg-fields {
    grid-template-columns: 1fr;
  }

  .calculator-main .page-header {
    padding: 1.2rem 1rem;
  }

  .page-tabs {
    padding: 0 1rem;
  }

  .page-body {
    padding: 0 1rem 1.5rem;
  }

  .category-shell {
    padding: 0 1rem;
  }

  .category-shell .home-hero {
    padding: 1.25rem;
  }

  .category-shell .home-split-panel {
    grid-template-columns: 1fr;
  }

  .category-shell .home-split-panel--reverse .home-panel-copy,
  .category-shell .home-split-panel--reverse .home-panel-media {
    order: initial;
  }
}
@media (max-width: 600px) {
  .calculator-main .page-header {
    padding: 0.85rem 0.75rem;
  }

  .calculator-main .page-header h1 {
    font-size: 1.3rem;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .shelf-life-grid {
    margin: 0.5rem;
  }

  /* Contain table scroll inside its card */
  .shelf-life-results {
    overflow: hidden;
    min-width: 0;
  }
}
