﻿/* ===================================================================
   flockforecast.css
   Sky/Cloud theme for Bootstrap 5.3, ported from the original Tailwind
   design tokens. Light + night-sky dark mode (data-bs-theme="dark").

   Goes in:  /css/flockforecast.css
   Load AFTER bootstrap.min.css so these overrides win.
   =================================================================== */

/* ---- Fonts: self-hosted Inter (body) + Outfit (headings) ----
   Place the .woff2 files in css/fonts/ (paths are relative to this file). */
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('fonts/Inter-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal; font-weight: 500 800; font-display: swap;
  src: url('fonts/Outfit-Variable.woff2') format('woff2');
}

/* ---- Palette as raw HSL triplets (so we can build hsl()/alpha) ---- */
:root {
  --ff-background:        210 40% 98%;   /* very light blue-grey */
  --ff-foreground:        215 25% 27%;   /* deep stormy blue     */
  --ff-card:              0 0% 100%;
  --ff-primary:           200 80% 50%;   /* sky blue             */
  --ff-primary-foreground:0 0% 100%;
  --ff-secondary:         210 20% 90%;   /* light cloud          */
  --ff-muted:             210 20% 96%;
  --ff-muted-foreground:  215 15% 60%;
  --ff-accent:            45 90% 60%;     /* sun yellow           */
  --ff-accent-foreground: 215 25% 27%;
  --ff-destructive:       0 84% 60%;
  --ff-border:            210 20% 90%;
  --ff-ring:              200 80% 50%;
  --ff-radius: 0.75rem;

  /* Map onto Bootstrap's theme variables */
  --bs-body-bg:            hsl(var(--ff-background));
  --bs-body-color:         hsl(var(--ff-foreground));
  --bs-body-font-family:   'Inter', system-ui, sans-serif;
  --bs-border-color:       hsl(var(--ff-border));
  --bs-border-radius:      var(--ff-radius);
  --bs-border-radius-sm:   calc(var(--ff-radius) - 0.25rem);
  --bs-border-radius-lg:   calc(var(--ff-radius) + 0.25rem);

  --bs-primary:            hsl(var(--ff-primary));
  --bs-primary-rgb:        26, 161, 230;
  --bs-secondary:          hsl(var(--ff-secondary));
  --bs-secondary-rgb:      222, 226, 230;
  --bs-danger:             hsl(var(--ff-destructive));
  --bs-danger-rgb:         239, 67, 67;

  --bs-link-color:         hsl(var(--ff-primary));
  --bs-link-hover-color:   hsl(200 80% 42%);
}

/* ---- Night-sky dark mode ---- */
[data-bs-theme="dark"] {
  --ff-background:        222 47% 11%;
  --ff-foreground:        210 40% 98%;
  --ff-card:              222 47% 13%;
  --ff-primary:           200 80% 60%;
  --ff-primary-foreground:222 47% 11%;
  --ff-secondary:         217 33% 17%;
  --ff-muted:             217 33% 17%;
  --ff-muted-foreground:  215 20% 65%;
  --ff-border:            217 33% 17%;

  --bs-body-bg:    hsl(var(--ff-background));
  --bs-body-color: hsl(var(--ff-foreground));
  --bs-border-color: hsl(var(--ff-border));
  --bs-primary:    hsl(var(--ff-primary));
  --bs-primary-rgb: 77, 182, 240;
}

/* ---- Base ---- */
body {
  background-color: hsl(var(--ff-background));
  color: hsl(var(--ff-foreground));
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .ff-heading {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { text-decoration: none; }

/* ---- Buttons ---- */
.btn { border-radius: var(--ff-radius); font-weight: 600; }
.btn-primary {
  --bs-btn-bg: hsl(var(--ff-primary));
  --bs-btn-border-color: hsl(var(--ff-primary));
  --bs-btn-color: hsl(var(--ff-primary-foreground));
  --bs-btn-hover-bg: hsl(200 80% 44%);
  --bs-btn-hover-border-color: hsl(200 80% 44%);
  --bs-btn-hover-color: hsl(var(--ff-primary-foreground));
  --bs-btn-active-bg: hsl(200 80% 40%);
  --bs-btn-active-border-color: hsl(200 80% 40%);
  --bs-btn-disabled-bg: hsl(var(--ff-primary));
  --bs-btn-disabled-border-color: hsl(var(--ff-primary));
}
.btn-accent {
  --bs-btn-bg: hsl(var(--ff-accent));
  --bs-btn-border-color: hsl(var(--ff-accent));
  --bs-btn-color: hsl(var(--ff-accent-foreground));
  --bs-btn-hover-bg: hsl(45 90% 54%);
  --bs-btn-hover-border-color: hsl(45 90% 54%);
  --bs-btn-hover-color: hsl(var(--ff-accent-foreground));
  color: hsl(var(--ff-accent-foreground));
}
.btn-outline-primary {
  --bs-btn-color: hsl(var(--ff-primary));
  --bs-btn-border-color: hsl(var(--ff-primary));
  --bs-btn-hover-bg: hsl(var(--ff-primary));
  --bs-btn-hover-border-color: hsl(var(--ff-primary));
  --bs-btn-hover-color: hsl(var(--ff-primary-foreground));
}

/* ---- Focus ring in sky blue ---- */
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.btn-check:focus-visible + .btn {
  border-color: hsl(var(--ff-primary));
  box-shadow: 0 0 0 0.2rem hsla(var(--ff-primary) / 0.35);
}

/* ---- Navbar ---- */
.ff-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  width: 100%;
  border-bottom: 1px solid hsla(var(--ff-border) / 0.6);
  background-color: hsla(var(--ff-background) / 0.85);
  backdrop-filter: saturate(180%) blur(8px);
}
.ff-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: hsl(var(--ff-primary));
}
.ff-brand img { height: 2rem; width: 2rem; object-fit: contain; }
.ff-navlink {
  font-size: 0.9rem;
  font-weight: 500;
  color: hsl(var(--ff-muted-foreground));
  transition: color 0.15s ease;
  padding: 0.25rem 0;
}
.ff-navlink:hover { color: hsl(var(--ff-primary)); }
.ff-navlink.active { color: hsl(var(--ff-primary)); }

/* ---- Avatar ---- */
.ff-avatar {
  height: 2rem; width: 2rem;
  border-radius: 50%;
  background: hsl(var(--ff-secondary));
  color: hsl(var(--ff-foreground));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.85rem;
  overflow: hidden;
}
.ff-avatar img { height: 100%; width: 100%; object-fit: cover; }

/* ---- Cards ---- */
.card {
  --bs-card-bg: hsl(var(--ff-card));
  --bs-card-border-color: hsl(var(--ff-border));
  --bs-card-border-radius: var(--ff-radius);
  box-shadow: 0 1px 3px hsla(215 25% 27% / 0.06), 0 1px 2px hsla(215 25% 27% / 0.04);
}
.ff-card-hover { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.ff-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px hsla(215 25% 27% / 0.10);
}

/* ---- Hero ---- */
.ff-hero {
  position: relative;
  border-radius: calc(var(--ff-radius) + 0.5rem);
  overflow: hidden;
  background: linear-gradient(135deg, hsl(200 80% 50%) 0%, hsl(200 85% 62%) 55%, hsl(190 80% 70%) 100%);
  color: #fff;
}
.ff-hero-overlay {
  background: linear-gradient(180deg, hsla(215 40% 20% / 0.15), hsla(215 40% 20% / 0.45));
}

/* ---- Muted helpers ---- */
.text-muted-2 { color: hsl(var(--ff-muted-foreground)) !important; }
.bg-muted-2 { background-color: hsl(var(--ff-muted)) !important; }
.text-primary-2 { color: hsl(var(--ff-primary)) !important; }
.text-accent { color: hsl(var(--ff-accent)) !important; }

/* ---- Badges ---- */
.ff-badge-official {
  background: hsla(var(--ff-accent) / 0.18);
  color: hsl(40 90% 32%);
  border: 1px solid hsla(var(--ff-accent) / 0.4);
  font-weight: 600;
}

/* ---- Weather icon colors ---- */
.wi-sunny  { color: hsl(45 90% 55%); }
.wi-cloudy { color: hsl(215 15% 60%); }
.wi-rain   { color: hsl(200 80% 50%); }
.wi-storm  { color: hsl(260 40% 55%); }
.wi-snow   { color: hsl(200 30% 75%); }

/* ---- Vote buttons ---- */
.ff-vote {
  border: 1px solid hsl(var(--ff-border));
  background: transparent;
  color: hsl(var(--ff-muted-foreground));
  border-radius: var(--ff-radius);
  padding: 0.25rem 0.6rem;
  font-weight: 600;
  transition: all 0.12s ease;
}
.ff-vote:hover { border-color: hsl(var(--ff-primary)); color: hsl(var(--ff-primary)); }
.ff-vote.up.active   { background: hsla(var(--ff-primary) / 0.12); border-color: hsl(var(--ff-primary)); color: hsl(var(--ff-primary)); }
.ff-vote.down.active { background: hsla(var(--ff-destructive) / 0.12); border-color: hsl(var(--ff-destructive)); color: hsl(var(--ff-destructive)); }

/* ---- Footer ---- */
.ff-footer {
  border-top: 1px solid hsl(var(--ff-border));
  background: hsla(var(--ff-muted) / 0.4);
  color: hsl(var(--ff-muted-foreground));
}
.ff-footer a { color: hsl(var(--ff-muted-foreground)); }
.ff-footer a:hover { color: hsl(var(--ff-primary)); }

/* ---- Toast / alert region ---- */
#ff-toasts {
  position: fixed;
  top: 4.5rem; right: 1rem;
  z-index: 1080;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: 22rem;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===================================================================
   POLISH LAYER (Option B) - visual refinement only, no markup changes.
   Evokes the original shadcn/ui feel: softer shadows, hover lifts,
   tighter rhythm, refined type. Appended last so it wins.
   =================================================================== */

/* Smoother base rendering + type rhythm */
body {
  line-height: 1.6;
  letter-spacing: -0.006em;
}
h1 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1.15; }
h2 { line-height: 1.2; }
.small, small { letter-spacing: 0; }

/* Cards: softer, layered shadow + smooth hover lift */
.card {
  --bs-card-border-color: hsl(var(--ff-border) / 0.7);
  box-shadow: 0 1px 2px hsl(215 25% 27% / 0.04),
              0 2px 8px hsl(215 25% 27% / 0.05);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: 0 4px 12px hsl(215 25% 27% / 0.08),
              0 12px 28px hsl(215 25% 27% / 0.07);
  border-color: hsl(var(--ff-primary) / 0.25);
}

/* Buttons: subtle depth + lift on hover */
.btn {
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.15s ease;
}
.btn-primary {
  box-shadow: 0 1px 2px hsl(var(--ff-primary) / 0.25),
              0 4px 12px hsl(var(--ff-primary) / 0.18);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px hsl(var(--ff-primary) / 0.30),
              0 8px 20px hsl(var(--ff-primary) / 0.22);
}
.btn-primary:active { transform: translateY(0); }
.btn-outline-primary:hover { transform: translateY(-1px); }
.btn-sm { border-radius: calc(var(--ff-radius) - 0.2rem); }

/* Inputs: softer borders, refined focus */
.form-control, .form-select {
  border-color: hsl(var(--ff-border) / 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control::placeholder { color: hsl(var(--ff-muted-foreground) / 0.7); }
.form-label { font-weight: 500; margin-bottom: 0.35rem; }

/* Navbar: deeper blur + hairline shadow */
.ff-navbar {
  box-shadow: 0 1px 0 hsl(var(--ff-border) / 0.5),
              0 2px 12px hsl(215 25% 27% / 0.04);
  backdrop-filter: saturate(180%) blur(12px);
}
.ff-navlink { position: relative; }
.ff-navlink.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.4rem;
  height: 2px; border-radius: 2px; background: hsl(var(--ff-primary));
}

/* Avatars: ring + gradient fill for a finished look */
.ff-avatar {
  background: linear-gradient(135deg, hsl(var(--ff-primary) / 0.9), hsl(200 85% 62%));
  color: #fff;
  box-shadow: inset 0 0 0 1px hsl(0 0% 100% / 0.15),
              0 1px 3px hsl(215 25% 27% / 0.15);
}

/* Badges: a touch more padding + weight */
.badge { font-weight: 600; padding: 0.4em 0.7em; letter-spacing: 0.01em; }

/* Vote buttons: smoother states */
.ff-vote {
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px hsl(215 25% 27% / 0.04);
}
.ff-vote:hover { transform: translateY(-1px); box-shadow: 0 2px 8px hsl(215 25% 27% / 0.08); }

/* Tables: airier rows */
.table > :not(caption) > * > * { padding: 0.9rem 0.75rem; }
.table-hover > tbody > tr { transition: background-color 0.12s ease; }

/* Nav pills: pill container background like the original tabs */
.nav-pills {
  background: hsl(var(--ff-muted));
  padding: 0.25rem;
  border-radius: var(--ff-radius);
  gap: 0.25rem;
}
.nav-pills .nav-link {
  color: hsl(var(--ff-muted-foreground));
  border-radius: calc(var(--ff-radius) - 0.25rem);
  font-weight: 600;
  padding: 0.4rem 0.9rem;
}
.nav-pills .nav-link.active {
  background: hsl(var(--ff-card));
  color: hsl(var(--ff-foreground));
  box-shadow: 0 1px 3px hsl(215 25% 27% / 0.10);
}

/* Muted section blocks a hair softer */
.bg-muted-2 { background-color: hsl(var(--ff-muted) / 0.6) !important; }

/* Spinners inherit primary */
.spinner-border { color: hsl(var(--ff-primary)); }

/* Dropdown menu: softer shadow + rounding */
.dropdown-menu {
  border-color: hsl(var(--ff-border) / 0.7);
  border-radius: var(--ff-radius);
  box-shadow: 0 4px 24px hsl(215 25% 27% / 0.12);
  padding: 0.35rem;
}
.dropdown-item { border-radius: calc(var(--ff-radius) - 0.3rem); padding: 0.5rem 0.75rem; }

/* Toned links */
a { transition: color 0.12s ease; }

/* Normalize page width: all Bootstrap .container pages match explore's
   72rem (max-w-6xl). Loaded after bootstrap.min.css so this wins. */
.container { max-width: 72rem; }

/* Bootstrap collapse vs Tailwind .collapse{visibility:collapse} conflict.
   Higher specificity restores visibility when Bootstrap opens/animates it
   (fixes blank mobile menu). */
.collapse.show, .collapsing { visibility: visible; }

/* Bootstrap's .text-primary utility is !important, which outranks Tailwind's
   hover:text-primary-foreground (no !important) - so buttons using both never
   flipped their icon/text on hover. Restore the intended hover color. */
.hover\:text-primary-foreground:hover { color: hsl(var(--primary-foreground)) !important; }

/* Official-forecast "Details" collapse: flip the chevron when open. */
.ff-details-toggle { text-decoration: none; cursor: pointer; }
.ff-details-toggle .bi { transition: transform .2s; display: inline-block; }
.ff-details-toggle[aria-expanded="true"] .bi { transform: rotate(180deg); }

/* The night half of a forecast card. Tailwind's pt-4 isn't in the compiled
   build (only pt-1 is), so the divider padding lives here. */
.ff-night-sec { padding-top: .7rem; }

/* Bootstrap has no min-width:0 utility and it isn't in the compiled Tailwind
   build, so flex children with .text-truncate can't actually shrink -- they
   blow past the container. This supplies it. */
.ff-min0 { min-width: 0; }

/* -------------------------------------------------------------------
   Leaderboard list
   Grid rows, not a table. One column template drives the header and every
   row, so they stay aligned; the mobile layout is a different template on
   the same markup.
     >= 768px : rank | forecaster | location | forecasts | accuracy | score
     >= 576px : rank | forecaster | forecasts | accuracy
     <  576px : rank badge + name on line one, stat chips on line two
   ------------------------------------------------------------------- */
.lb-list { display: block; }

.lb-head,
.lb-row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1.5fr) minmax(0, 1fr) 5.5rem 5.5rem 5rem;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
}

.lb-head {
  border-bottom: 1px solid hsl(var(--ff-border));
  background: hsl(var(--ff-muted) / .4);
  font-size: .78rem;
  font-weight: 600;
  color: hsl(var(--ff-muted-foreground));
  text-transform: uppercase;
  letter-spacing: .04em;
}

.lb-row {
  border-top: 1px solid hsl(var(--ff-border));
  color: inherit;
  text-decoration: none;
  transition: background-color .12s ease;
}
.lb-row:first-child { border-top: 0; }
.lb-row:hover { background: hsl(var(--ff-muted) / .45); color: inherit; }
.lb-hidden { display: none; }

.lb-rank { font-weight: 700; color: hsl(var(--ff-muted-foreground)); }
.lb-rank .bi { font-size: 1.05rem; }

.lb-user { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.lb-avatar { width: 2rem; height: 2rem; font-size: .8rem; flex: 0 0 auto; }
.lb-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.lb-loc   { color: hsl(var(--ff-muted-foreground)); min-width: 0; overflow-wrap: anywhere; }
.lb-count { text-align: center; }
.lb-acc   { text-align: center; font-weight: 700; color: hsl(var(--ff-primary)); }
.lb-score { text-align: center; font-weight: 600; }

.lb-empty { padding: 2.5rem 1rem; text-align: center; color: hsl(var(--ff-muted-foreground)); }

/* Tablet: drop Location and Score. */
@media (max-width: 767.98px) {
  .lb-head, .lb-row { grid-template-columns: 3rem minmax(0, 1fr) 5rem 4.5rem; }
  .lb-loc, .lb-score { display: none; }
}

/* Phone: three lines, same six fields as desktop. Rank badge spans all of
   them; location gets its own line; the three numbers become chips. */
@media (max-width: 575.98px) {
  .lb-head { display: none; }

  .lb-row {
    grid-template-columns: 1.9rem auto auto 1fr;
    grid-template-areas:
      "rank user  user user"
      "rank loc   loc  loc"
      "rank count acc  score";
    column-gap: .4rem;
    row-gap: .3rem;
    padding: .55rem .6rem;
  }

  .lb-rank {
    grid-area: rank;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .4rem;
    background: hsl(var(--ff-muted) / .55);
    font-size: .72rem;
  }
  .lb-rank .bi { font-size: .95rem; }

  .lb-user { grid-area: user; gap: .5rem; }
  .lb-avatar { width: 1.7rem; height: 1.7rem; }
  .lb-name { font-size: .875rem; line-height: 1.2; }

  .lb-loc {
    grid-area: loc;
    display: block;
    justify-self: end;
    text-align: right;
    font-size: .72rem;
    line-height: 1.2;
  }
  .lb-loc:empty { display: none; }

  /* All three numbers are chips: tiny label, bold value. */
  .lb-count, .lb-acc, .lb-score {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    padding: .15rem .5rem;
    border-radius: .4rem;
    line-height: 1.1;
    text-align: left;
    font-size: .8rem;
    font-weight: 700;
  }
  .lb-count::before,
  .lb-acc::before,
  .lb-score::before {
    content: attr(data-label);
    font-size: .52rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    opacity: .65;
  }
  .lb-count { grid-area: count; justify-self: start; background: hsl(var(--ff-muted) / .55); color: hsl(var(--ff-foreground)); }
  .lb-acc   { grid-area: acc;   justify-self: start; background: hsl(var(--ff-primary) / .10); }
  .lb-score { grid-area: score; justify-self: end;   background: hsl(var(--ff-muted) / .55); color: hsl(var(--ff-foreground)); }
}

/* -------------------------------------------------------------------
   Legal pages (Terms, Privacy)
   Plain prose. Tailwind's typography plugin isn't in the compiled build,
   so the vertical rhythm is set here.
   ------------------------------------------------------------------- */
.ff-legal { line-height: 1.65; }
.ff-legal h2 {
  margin: 2rem 0 .6rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ff-legal h2:first-child { margin-top: 1rem; }
.ff-legal p { margin: 0 0 .9rem; }
.ff-legal ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.ff-legal li { margin-bottom: .35rem; }
.ff-legal a { color: hsl(var(--ff-primary)); text-decoration: underline; }

/* Honeypot field: off-screen for people, present in the DOM for bots.
   display:none is skipped by some bots, so move it instead. */
.ff-hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* -------------------------------------------------------------------
   Home page "Top Forecasters" rows
   Wide: [#rank] [avatar] [name / location] .......... [85% / Accuracy]
   Narrow: the accuracy stat drops to its own line, aligned under the name,
   collapsed to a single "85% Accuracy" line so it costs one short row.
   ------------------------------------------------------------------- */
.ff-lb-row { flex-wrap: wrap; }
.ff-lb-rank { width: 2rem; height: 2rem; font-size: .85rem; }
.ff-lb-lbl { font-size: .72rem; }

@media (max-width: 575.98px) {
  .ff-lb-row { row-gap: .35rem; padding: .65rem !important; gap: .6rem; }
  .ff-lb-acc {
    width: 100%;
    text-align: left !important;
    /* line up with the name: rank + avatar + the two gaps between them */
    padding-left: calc(2rem + 2rem + 1.2rem);
  }
  .ff-lb-acc .ff-lb-pct,
  .ff-lb-acc .ff-lb-lbl { display: inline; }
  .ff-lb-lbl { margin-left: .25rem; }

  /* The panel that holds the rows. Only this panel -- the section container
     around it is shared with other blocks and is left alone. */
  .ff-lb-panel { padding: .85rem !important; gap: 1.25rem !important; }
}

/* Leader rows and card bylines: long screen names WRAP rather than getting
   cut off. overflow-wrap:anywhere handles single-token names with no break
   opportunity (e.g. "WeatherWizard9000000") and, unlike word-break, it also
   shrinks the element's min-content width so the flex row can actually fit. */
.ff-lb-name { overflow-wrap: anywhere; }

.ff-byline { max-width: 100%; }
.ff-byline > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------
   Button reset
   The compiled Tailwind build ships without Preflight, and Bootstrap's
   reboot keeps `-webkit-appearance: button`. Any <button> that isn't a
   Bootstrap .btn therefore renders with native OS chrome -- the beveled
   border and inner shadow. Reset it at the element level (specificity
   0,0,1) so every utility class and every .btn rule still overrides.
   ------------------------------------------------------------------- */
button {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  background-image: none;
  border: 0 solid hsl(var(--ff-border));
  color: inherit;
  font: inherit;
  line-height: inherit;
  margin: 0;
  cursor: pointer;
}
button:disabled { cursor: default; }

/* -------------------------------------------------------------------
   Icon button (nav hamburger, and any square icon action)
   ------------------------------------------------------------------- */
.ff-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: .65rem;
  color: hsl(var(--ff-foreground));
  transition: background-color .15s ease, color .15s ease;
}
.ff-icon-btn:hover { background: hsl(var(--ff-primary) / .10); color: hsl(var(--ff-primary)); }
.ff-icon-btn:active { background: hsl(var(--ff-primary) / .18); }
.ff-icon-btn:focus-visible { outline: 2px solid hsl(var(--ff-primary)); outline-offset: 2px; }
/* The icon crossfades to an X while the panel is open. */
.ff-icon-btn .bi { font-size: 1.5rem; line-height: 1; transition: transform .18s ease; }
.ff-icon-btn[aria-expanded="true"] { background: hsl(var(--ff-primary) / .12); color: hsl(var(--ff-primary)); }
.ff-icon-btn[aria-expanded="true"] .bi { transform: rotate(90deg); }

/* -------------------------------------------------------------------
   Hourly / details actions inside a forecast cell -- quiet pills, not
   native buttons.
   ------------------------------------------------------------------- */
.ff-hourly-btn,
.ff-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  text-decoration: none;
  color: hsl(var(--ff-primary));
  background: hsl(var(--ff-primary) / .09);
  transition: background-color .15s ease, color .15s ease;
}
.ff-hourly-btn:hover,
.ff-details-toggle:hover { background: hsl(var(--ff-primary) / .18); color: hsl(var(--ff-primary)); }
.ff-hourly-btn:focus-visible,
.ff-details-toggle:focus-visible { outline: 2px solid hsl(var(--ff-primary)); outline-offset: 1px; }

/* On an inverted night cell the pill needs a light-on-dark treatment. */
.ff-wg-cell[data-night="1"] .ff-hourly-btn,
.ff-wg-cell[data-night="1"] .ff-details-toggle {
  background: hsl(200 80% 72% / .16);
  color: hsl(200 80% 78%) !important;
}
.ff-wg-cell[data-night="1"] .ff-hourly-btn:hover,
.ff-wg-cell[data-night="1"] .ff-details-toggle:hover { background: hsl(200 80% 72% / .28); }

/* -------------------------------------------------------------------
   Compact page header (Explore, Leaderboard)
   Horizontal: icon tile on the left, title + subtitle stacked right. Keeps
   the fold on mobile instead of a centered stack eating half the screen.
   ------------------------------------------------------------------- */
.ff-phead {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding-bottom: .9rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid hsl(var(--ff-border));
  position: relative;
}
/* A short accent underline that fades out, echoing the icon tile. */
.ff-phead::after {
  content: "";
  position: absolute; left: 0; bottom: -1px;
  width: 4.5rem; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, hsl(var(--ff-primary)), hsl(var(--ff-primary) / 0));
}
.ff-phead-icon {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: .7rem;
  color: hsl(var(--ff-primary-foreground));
  background: linear-gradient(135deg, hsl(var(--ff-primary)), hsl(var(--ff-accent)));
  box-shadow: 0 4px 12px -4px hsl(var(--ff-primary) / .55);
  font-size: 1.15rem; line-height: 1;
}
.ff-phead-text { min-width: 0; }
.ff-phead-title {
  margin: 0;
  font-size: 1.35rem; font-weight: 700; line-height: 1.15;
  letter-spacing: -0.01em;
}
.ff-phead-sub {
  margin: .15rem 0 0;
  font-size: .8rem; line-height: 1.35;
  color: hsl(var(--ff-muted-foreground));
  /* Two lines max on phones; the full sentence returns at sm and up. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 640px) {
  .ff-phead { gap: 1rem; padding-bottom: 1.1rem; margin-bottom: 1.5rem; }
  .ff-phead-icon { width: 3rem; height: 3rem; border-radius: .8rem; font-size: 1.4rem; }
  .ff-phead-title { font-size: 1.75rem; }
  .ff-phead-sub { font-size: .9rem; -webkit-line-clamp: none; display: block; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .ff-phead-icon { box-shadow: none; }
}

/* -------------------------------------------------------------------
   Weather.gov forecast strip
   Cells are tinted by condition and inverted at night, so the row reads
   as a day/night sequence instead of a grid of identical grey boxes.
   Per-condition accents are set on the cell via [data-cond]; everything
   else inherits from the theme tokens.
   ------------------------------------------------------------------- */
.ff-wg-cell, .ff-wg-col { min-width: 0; }

.ff-wg-cell {
  --wg-accent: var(--ff-primary);
  --wg-tint: 200 80% 50%;
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--ff-border));
  background:
    linear-gradient(hsl(var(--wg-tint) / .10), hsl(var(--wg-tint) / .02) 60%),
    hsl(var(--ff-card));
  transition: transform .15s ease, box-shadow .15s ease;
}
.ff-wg-cell:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -8px hsl(var(--wg-tint) / .45); }

/* Condition accents (keys come from the shortForecast text). Shared by the
   forecast cells and the hourly modal rows so both read from one palette. */
.ff-wg-cell[data-cond="clear"],  .ff-hour-row[data-cond="clear"]  { --wg-tint:  42 95% 55%; }
.ff-wg-cell[data-cond="partly"], .ff-hour-row[data-cond="partly"] { --wg-tint: 205 75% 55%; }
.ff-wg-cell[data-cond="cloud"],  .ff-hour-row[data-cond="cloud"]  { --wg-tint: 213 18% 52%; }
.ff-wg-cell[data-cond="rain"],   .ff-hour-row[data-cond="rain"]   { --wg-tint: 212 78% 48%; }
.ff-wg-cell[data-cond="storm"],  .ff-hour-row[data-cond="storm"]  { --wg-tint: 265 62% 55%; }
.ff-wg-cell[data-cond="snow"],   .ff-hour-row[data-cond="snow"]   { --wg-tint: 190 55% 62%; }
.ff-wg-cell[data-cond="fog"],    .ff-hour-row[data-cond="fog"]    { --wg-tint: 210 12% 58%; }
.ff-wg-cell[data-cond="smoke"],  .ff-hour-row[data-cond="smoke"]  { --wg-tint:  25 40% 50%; }
.ff-wg-cell[data-cond="wind"],   .ff-hour-row[data-cond="wind"]   { --wg-tint: 175 45% 45%; }

.ff-wg-icon { font-size: 1.9rem; line-height: 1; color: hsl(var(--wg-tint)); }

/* Night periods invert: deep sky, light type. */
.ff-wg-cell[data-night="1"] {
  background:
    linear-gradient(hsl(var(--wg-tint) / .22), transparent 70%),
    linear-gradient(hsl(222 47% 16%), hsl(222 47% 12%));
  border-color: hsl(222 30% 26%);
  color: hsl(210 40% 92%);
}
.ff-wg-cell[data-night="1"] .text-muted-foreground { color: hsl(215 20% 68%) !important; }
.ff-wg-cell[data-night="1"] .ff-wg-icon { color: hsl(var(--wg-tint) / .95); }

/* The leading period is the hero: ringed, with a "Now" eyebrow. */
.ff-wg-cell.is-now { border-color: hsl(var(--ff-primary)); box-shadow: 0 0 0 2px hsl(var(--ff-primary) / .22); }
.ff-wg-now {
  position: absolute; top: .4rem; right: .4rem;
  font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: .1rem .35rem; border-radius: .25rem;
  background: hsl(var(--ff-primary)); color: hsl(var(--ff-primary-foreground));
}

.ff-wg-temp { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.ff-wg-name { font-size: .8rem; font-weight: 600; line-height: 1.15; }

/* Precip as a bottom fill scaled to the chance, not a line of text. */
.ff-wg-precip { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: hsl(var(--ff-border) / .5); }
.ff-wg-precip > span { display: block; height: 100%; width: var(--p, 0%); background: hsl(212 85% 52%); }
.ff-wg-precip-label { font-size: .68rem; font-weight: 600; color: hsl(212 80% 45%); }
.ff-wg-cell[data-night="1"] .ff-wg-precip-label { color: hsl(205 85% 72%); }

/* Controls sitting inside an inverted night cell need light-on-dark. */
.ff-wg-cell[data-night="1"] .text-muted-2 { color: hsl(215 20% 68%) !important; }
.ff-wg-cell[data-night="1"] .text-primary-2,
.ff-wg-cell[data-night="1"] .ff-details-toggle,
.ff-wg-cell[data-night="1"] .ff-hourly-btn { color: hsl(200 80% 72%) !important; }
.ff-wg-cell[data-night="1"] .btn-outline-primary {
  color: hsl(200 80% 78%); border-color: hsl(200 60% 55%);
}
.ff-wg-cell[data-night="1"] .btn-outline-primary:hover {
  background: hsl(200 80% 55%); border-color: hsl(200 80% 55%); color: hsl(222 47% 12%);
}

/* Column widths: 2 per row on phones, 3 at sm, 4 at md, 5 at lg and up.
   The row always wraps -- never a horizontal scroller. */
.ff-wg-row { flex-wrap: wrap; }
@media (min-width: 992px) {
  .ff-wg-col { flex: 0 0 20%; max-width: 20%; }
}

@media (prefers-reduced-motion: reduce) {
  .ff-wg-cell, .ff-wg-cell:hover { transition: none; transform: none; }
}
/* Hourly modal rows. Each row carries its own condition tint: a colored
   rail on the left, a matching icon, and a temp ridge bar scaled across the
   period's own min/max so the shape of the hours is readable at a glance. */
.ff-hour-list { text-align: left; }
.ff-hour-row {
  --wg-tint: 213 18% 52%;
  display: flex; align-items: flex-start; gap: .3rem;
  padding: .3rem .35rem .3rem .4rem;
  font-size: .72rem; line-height: 1.2;
  border-top: 1px solid hsl(var(--border));
  border-left: 3px solid hsl(var(--wg-tint));
  border-radius: .25rem;
  background: linear-gradient(90deg, hsl(var(--wg-tint) / .10), transparent 55%);
}
.ff-hour-row:first-child { border-top: 0; }
.ff-hour-row[data-night="1"] { background: linear-gradient(90deg, hsl(var(--wg-tint) / .16), hsl(222 47% 30% / .08) 55%); }

/* Widths are sized to their longest real value: "12PM", "SW 15", "100%",
   "-10". The condition text is the only flexible column, and it's abbreviated
   server-side (app_wg_abbrev_cond) with the full phrase in a title tooltip. */
.ff-hr-time { width: 2.1rem; flex: 0 0 auto; color: hsl(var(--muted-foreground)); }
.ff-hr-i { width: 1rem; flex: 0 0 auto; color: hsl(var(--wg-tint)); text-align: center; font-size: .9rem; }
.ff-hr-cond { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.ff-hr-deg { width: 2rem; flex: 0 0 auto; font-weight: 700; }
.ff-hr-w { width: 3.6rem; flex: 0 0 auto; white-space: nowrap; color: hsl(var(--muted-foreground)); }
.ff-hr-h { width: 2.5rem; flex: 0 0 auto; white-space: nowrap; color: hsl(var(--muted-foreground)); }
.ff-hr-p { width: 2.75rem; flex: 0 0 auto; white-space: nowrap; color: hsl(var(--muted-foreground)); }
.ff-hr-p.is-wet { color: hsl(212 85% 52%); font-weight: 600; }
.ff-hour-row[data-night="1"] .ff-hr-p.is-wet { color: hsl(205 85% 72%); }

/* Column-description header at the top of the strip. Uses the same column
   spans as .ff-hour-row so labels line up over their values. */
.ff-hour-head {
  display: flex; align-items: flex-start; gap: .3rem;
  padding: .2rem .35rem .3rem .4rem;
  font-size: .72rem; line-height: 1.2; font-weight: 700;
  letter-spacing: .02em;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: .15rem;
}
.ff-hour-head span { flex: 0 0 auto; white-space: nowrap; overflow: hidden; }
.ff-hour-head .ff-hr-cond { flex: 1 1 0; min-width: 0; }

/* Phones: keep every column; condition is the only column that truncates. */
@media (max-width: 480px) {
  .ff-hour-row { gap: .28rem; }
}
@media (max-width: 400px) {
  .ff-hour-row { gap: .22rem; font-size: .69rem; }
}

/* Current conditions card. Reuses the same condition tint tokens as the
   official cells / hour rows via [data-cond]. */
.ff-current {
  --wg-tint: 213 18% 52%;
  position: relative;
  overflow: hidden;
  border-left: 3px solid hsl(var(--wg-tint));
  background: linear-gradient(90deg, hsl(var(--wg-tint) / .16), transparent 60%), hsl(var(--card));
}
.ff-current[data-cond="clear"]  { --wg-tint:  42 95% 55%; }
.ff-current[data-cond="partly"] { --wg-tint: 205 75% 55%; }
.ff-current[data-cond="cloud"]  { --wg-tint: 213 18% 52%; }
.ff-current[data-cond="rain"]   { --wg-tint: 212 78% 48%; }
.ff-current[data-cond="storm"]  { --wg-tint: 265 62% 55%; }
.ff-current[data-cond="snow"]   { --wg-tint: 190 55% 62%; }
.ff-current[data-cond="fog"]    { --wg-tint: 210 12% 58%; }
.ff-current[data-cond="smoke"]  { --wg-tint:  25 40% 50%; }
.ff-current[data-cond="wind"]   { --wg-tint: 175 45% 45%; }
.ff-current[data-night="1"] {
  background: linear-gradient(90deg, hsl(var(--wg-tint) / .22), hsl(222 47% 30% / .10) 60%), hsl(var(--card));
}
.ff-current h2 { color: hsl(var(--wg-tint)); position: relative; z-index: 1; }
.ff-current-bg {
  position: absolute;
  right: -.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8rem;
  line-height: 1;
  color: hsl(var(--wg-tint) / .14);
  pointer-events: none;
  z-index: 0;
}
.ff-current-body { position: relative; z-index: 1; }
.ff-current-icon { font-size: 2.6rem; color: hsl(var(--wg-tint)); line-height: 1; }
.ff-current-temp { font-size: 2.1rem; font-weight: 800; line-height: 1; color: hsl(var(--wg-tint)); }
.ff-current-meta { min-width: 0; }
.ff-current-cond { font-weight: 600; color: hsl(var(--wg-tint)); }
.ff-current-detail { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .2rem;
  font-size: .8rem; color: hsl(var(--muted-foreground)); }
.ff-current-detail i { color: hsl(var(--wg-tint)); }
.ff-current-when { margin-top: .5rem; font-size: .72rem; color: hsl(var(--muted-foreground)); position: relative; z-index: 1; }

/* Show/hide eye toggle on password inputs. */
.ff-pw-wrap { position: relative; display: block; }
.ff-pw-eye { position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
  border: 0; background: transparent; padding: .15rem; line-height: 1; cursor: pointer;
  color: hsl(var(--muted-foreground)); }
.ff-pw-eye:hover { color: hsl(var(--primary)); }