﻿/* ==========================================================================
   Rogue Fly Fish — site.css (cleaned)
   - One mobile drawer class: .mobile-nav.is-open
   - iOS/PWA-safe hamburger tap
   - Tagline uses --tagline variable
   ========================================================================== */

/* ---- CSS variables (colors & radii) ------------------------------------ */
:root {
  --bg: #0b1a29;
  --panel: rgba(17, 34, 51, 0.85);
  --panel-border: rgba(255,255,255,.06);
  --text: #e8efff;
  --muted: #9fb4cc;
  --brand: #10b981;
  --brand-weak: rgba(16,185,129,.22);
  --chip-bg: rgba(255,255,255,.05);
  --chip-br: rgba(255,255,255,.16);
  --chip-bg-hover: rgba(255,255,255,.10);
  --radius-xl: 18px;
  --radius-2xl: 22px;
  --focus: 0 0 0 3px rgba(16,185,129,.35);

  /* iOS safe areas */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 20% -10%, #0f2236, transparent),
              radial-gradient(900px 600px at 120% 0%, #0d2742, transparent),
              var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 10px;
}

body { padding-bottom: var(--safe-bottom); }

/* ---- Layout helpers ----------------------------------------------------- */
.container { width: min(1100px, 92vw); margin: 0 auto; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- Header & Top Nav --------------------------------------------------- */
.header {
  position: sticky; top: 0; z-index: 70;
  background: linear-gradient(180deg, rgba(7,17,28,.95), rgba(7,17,28,.75));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  padding-top: calc(6px + var(--safe-top));
  overflow: visible; /* don't clip menus */
}

/* Support bar */
.support-bar {
  display: block;
  padding: .4rem .5rem;
  text-align: center;
  font: 600 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: .06em;
  color: #fff;
  background: rgba(225,29,72,.92);
  text-decoration: none;
  position: relative; z-index: 10000; /* under hamburger */
}

/* Header row */
.header .container { display: flex; align-items: center; gap: .75rem; }
.header-row { display: flex; align-items: center; gap: .85rem; }

/* Brand */
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo {
  height: clamp(28px, 6.2vh, 44px);
  width: auto; object-fit: contain;
  -webkit-user-drag: none; user-select: none;
}

/* Tagline */
.tagline {
  display: inline-block;
  flex: 0 1 auto; min-width: 0;

  white-space: nowrap; letter-spacing: .6px;
  font-size: 1.05rem; font-weight: 700;
  color: var(--tagline, #39ff90);
  text-shadow: 0 0 8px color-mix(in srgb, var(--tagline, #39ff90) 45%, transparent);
}
@media (max-width: 420px) {
  .tagline { max-width: 56vw; overflow: hidden; text-overflow: ellipsis; }
}

/* Desktop links */
.desktop-links a {
  margin: 0 .75rem;
  padding: .25rem 0;
  color: white; font-weight: 500;
  transition: color .2s ease;
}
.desktop-links a:hover { color: #ffb347; text-decoration: underline; }

/* Desktop dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none; position: absolute; top: 100%; left: 0;
  min-width: 180px; z-index: 1000;
  background: rgba(25,25,25,.95); border-radius: 8px;
}
.dropdown-content a { display: block; padding: 8px 14px; color: white; }
.dropdown-content a:hover { background: rgba(255,255,255,.1); }
.dropdown:hover .dropdown-content { display: block; }

/* Hamburger (hidden on desktop, pinned right in row) */
.hamburger {
  display: none; margin-left: auto;
  background: none; border: none;
  font-size: 1.7rem; color: white; cursor: pointer;
  position: relative; z-index: 10010; /* above support bar & menus */
  pointer-events: auto; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.hamburger[hidden] { display: none !important; }

/* Mobile menu (drawer) — single source of truth */
.mobile-nav{
  display: none;
  position: absolute; top: 48px; right: 0;
  width: 220px; z-index: 10009;
  background: rgba(15,15,15,.96);
  border-radius: 8px; padding: 8px 0;
  flex-direction: column;
}
.mobile-nav.is-open { display: flex !important; }
.mobile-nav a,
.mobile-nav summary {
  color: white; text-decoration: none;
  padding: 10px 16px; display: block;
}
.mobile-nav summary { cursor: pointer; font-weight: 600; }
.mobile-nav details[open] a { padding-left: 26px; }

/* Responsive nav behavior */
@media (max-width: 820px) {
  .hamburger { display: block; }
  .desktop-links { display: none; }
}

/* ---- Scrollable chip nav (optional, if used) ---------------------------- */
.rff-topnav {
  display: flex; align-items: center; gap: .5rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; white-space: nowrap; flex-wrap: nowrap;
  padding: .5rem .25rem;
}
.rff-topnav::-webkit-scrollbar { display: none; }
.rff-topnav .nav-link {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  min-width: max-content; white-space: nowrap; line-height: 1;
  font-size: clamp(13px, 3.6vw, 15px);
  padding: .38rem .62rem; border-radius: 999px;
  border: 1px solid var(--chip-br);
  background: var(--chip-bg); color: var(--text);
  text-decoration: none;
}
.rff-topnav .nav-link:hover,
.rff-topnav .nav-link:focus-visible { background: var(--chip-bg-hover); }
.rff-topnav .nav-link[aria-current="page"] {
  background: var(--brand-weak); border-color: rgba(16,185,129,.45); color: #fff;
}
@media (max-width: 380px) {
  .rff-topnav { gap: .35rem; }
  .rff-topnav .nav-link { padding: .30rem .50rem; font-size: 13px; }
}
.rff-topnav-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.rff-topnav { padding-right: calc(10px + env(safe-area-inset-right)); scroll-padding-right: 24px; }

/* ---- Cards (“glass”) ---------------------------------------------------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-2xl);
  box-shadow:
    0 10px 30px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.04);
}
.panel { padding: 1rem; border-radius: var(--radius-xl); background: var(--panel); border: 1px solid var(--panel-border); }
.panel h2, .panel h3 { margin: 0 0 .5rem 0; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: .62rem 1rem; border-radius: 12px;
  color: #081521; background: #dbeafe; font-weight: 600;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(1px); }
.btn-emerald { background: #10b981; color: #02100c; }
.btn-sky     { background: #38bdf8; color: #001018; }
.btn-red     { background: #ef4444; color: #170404; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--chip-br); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .55rem; border-radius: 999px;
  background: var(--chip-bg); border: 1px solid var(--chip-br); color: var(--muted);
  font-size: .85rem; line-height: 1;
}

/* ---- Forms -------------------------------------------------------------- */
.input, .select, .textarea {
  width: 100%; color: var(--text); background: rgba(8,16,28,.6);
  border: 1px solid var(--panel-border); border-radius: 12px;
  padding: .7rem .8rem; outline: none;
}
.input::placeholder, .textarea::placeholder { color: #9fb4cc; opacity: .7; }
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { box-shadow: var(--focus); }

/* File preview */
#photo-preview, .rff-log-photo { border-radius: 12px; border: 1px solid var(--panel-border); }

/* ---- Tables ------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; color: var(--text); }
.table th, .table td { padding: .6rem .7rem; border-bottom: 1px solid var(--panel-border); text-align: left; }
.table thead th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .85rem; }

/* ---- Utilities ---------------------------------------------------------- */
.text-muted { color: var(--muted); }
.badge { padding: .2rem .5rem; border-radius: 8px; background: rgba(255,255,255,.08); border: 1px solid var(--panel-border); }

/* ---- Toast -------------------------------------------------------------- */
#log-toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: .6rem .9rem; border-radius: 12px; color: #041016;
  background: #34d399; transition: opacity .25s ease; opacity: 0; z-index: 9999;
  box-shadow: 0 10px 18px rgba(0,0,0,.4);
}
#log-toast.bg-red-500 { background: #f87171; color: #1b0b0b; }
#log-toast.bg-emerald-500 { background: #34d399; color: #051711; }

/* ---- Lightbox ----------------------------------------------------------- */
dialog#rff-lightbox { border: 0; padding: 0; background: transparent; }
dialog#rff-lightbox::backdrop { background: rgba(0,0,0,.75); }
#rff-lightbox-img {
  max-width: 92vw; max-height: 88vh;
  border-radius: 14px; border: 1px solid var(--panel-border);
  box-shadow: 0 20px 40px rgba(0,0,0,.6);
}

/* ---- Print -------------------------------------------------------------- */
@media print {
  .header, .footer, .rff-topnav-wrap, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .glass, .panel { background: #fff; border: 1px solid #ddd; box-shadow: none; }
}

/* ---- Theme hooks (example) --------------------------------------------- */
/* Example: seasonal class-driven tweaks (optional) */
body.theme-autumn-harvest .tagline::before { content: '🦃 '; margin-right: .25rem; }
body.theme-autumn-harvest .tagline::after  { content: ' 🍂'; margin-left:  .25rem; }

.hamburger { outline: 2px solid lime; }


/* keep the hamburger above everything and enlarge the tap target */
.hamburger{
  position: relative;
  z-index: 20000;                 /* higher than any header bits */
  padding: 8px 12px;              /* bigger finger target */
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-left: auto;
  margin-right: 10px;             /* ← nudge left a bit */
}

/* respect the iPhone notch but still keep a little padding */
.header .container{
  padding-right: calc(env(safe-area-inset-right) + 8px);
}

/* the mobile drawer */
.mobile-nav{
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  width: 220px;
  background: rgba(15,15,15,.96);
  border-radius: 8px;
  padding: 8px 0;
  z-index: 19990;
  flex-direction: column;
}
.mobile-nav.is-open{ display: flex !important; }

/* just in case this ghost button overlaps on some builds */

/* --- Counts → sparkline charts --- */
#counts .usgs-card .chart-wrap,
#counts .usgs-card .sparkline-wrap {
  position: relative;
  height: 64px;          /* explicit height so canvases don't collapse */
  overflow: visible;
}

#counts canvas {
  display: block;
  width: 100% !important;
  height: 64px !important;   /* critical for Chart.js / mini graphs */
  position: relative;
  z-index: 1;
}

/* make sure nothing invisible is sitting over the content */
.mobile-nav { pointer-events: none; }
.mobile-nav.is-open { pointer-events: auto; }

/* belt-and-suspenders: header layers stay above only the header */
.header { z-index: 70; }

#nav-nudge{ display: none !important; }
/* Default: desktop shows full links, no hamburger */
.hamburger { display: none; }
.desktop-links { display: flex; }

/* Only on real mobile OSes (class added by the detector) */
html.is-mobile .hamburger { display: block; margin-left: auto; }
html.is-mobile .desktop-links { display: none; }

/* Safety: never show the drawer on desktop even if JS toggles it */
html:not(.is-mobile) .mobile-nav { display: none !important; }
/* --- Counts → sparkline charts (fix 0px height) --- */
#counts .sparkline-wrap {
  position: relative;
  height: 64px;           /* critical: establishes height for the canvas */
  overflow: visible;
}
#counts canvas.spark {
  display: block;
  width: 100% !important;
  height: 64px !important;  /* don’t let layout collapse the canvas */
}

/* Header should not cover content below */
.header { z-index: 70; }

/* Mobile drawer should not intercept events when closed */
.mobile-nav { pointer-events: none; }
.mobile-nav.is-open { pointer-events: auto; }

/* Counts → compact sparkline */
#counts .sparkline-wrap {
  position: relative;
  height: 56px;            /* 48–64px is a good range */
  overflow: hidden;
}

#counts canvas.spark {
  display: block;
  width: 100% !important;
  height: 56px !important; /* match wrapper height */
}
/* Counts → compact sparkline */
#counts #counts-chart {
  display: block;
  width: 100% !important;
  height: 56px !important;   /* 48–64px is a good range */
}

/* --- Header layout refinement --- */

/* Keeps everything aligned horizontally */
.header .header-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* logo group left, nav right */
  gap: 1rem;
}

/* Groups logo + tagline tightly together */
.brand-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto; 
}

/* Slight left bias so it feels visually centered */
.header .brand-group {
  margin-left: 0.3rem;
}

/* Nav stays to the right but not glued to the edge */
.desktop-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-right: 1rem; /* gentle right margin for breathing room */
}

/* Tagline fine-tune */
.tagline {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tagline, #39ff90);
  text-shadow: 0 0 8px color-mix(in srgb, var(--tagline, #39ff90) 45%, transparent);
  letter-spacing: 0.5px;
  position: relative;
  top: 1px;          /* vertical centering with logo */
  white-space: nowrap;
}

/* --- FIX: Override Cast/Mirroring style that turns the text blue --- */
.header .container .tagline {
  color: #39ff90 !important; /* Force the neon green color */
  text-shadow: 0 0 8px color-mix(in srgb, #39ff90 45%, transparent) !important;
}