/* ==========================================================================
   WaterLakeLevel.com Master Stylesheet
   Mobile-First, Accessible, Theme-Aware (Light & Dark)
   ========================================================================== */

:root {
  /* Color Tokens - Light Mode (Default) */
  --bg: #F5F9FC;
  --surface: #FFFFFF;
  --surface-2: #EAF2F8;
  --text: #243746;
  --text-muted: #4A6072;
  --primary: #087EAB;
  --primary-strong: #065F82;
  --accent: #20B8B0;
  --navy: #102A43;
  --border: #D5E3EE;
  --warn: #B45309;
  --danger: #B42318;
  --success: #047857;

  /* Typography & Layout Tokens */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(16, 42, 67, 0.08);
  --shadow-md: 0 4px 12px rgba(16, 42, 67, 0.08);
  --shadow-lg: 0 10px 25px rgba(16, 42, 67, 0.12);
  --container-max: 1200px;
  --header-height: 72px;
  --min-tap: 44px;
}

[data-theme="dark"] {
  /* Color Tokens - Dark Mode */
  --bg: #0B1B29;
  --surface: #112638;
  --surface-2: #17334A;
  --text: #E8F0F6;
  --text-muted: #A9BDCC;
  --primary: #4DC0E8;
  --primary-strong: #7DD3F0;
  --accent: #36D1C8;
  --navy: #0B1B29;
  --border: #2A4760;
  --warn: #F5A65B;
  --danger: #FF8A7A;
  --success: #34D399;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
}

/* Typography Standards */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  line-height: 1.25;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.85rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin-top: 1.5rem; }
h3 { font-size: 1.25rem; margin-top: 1.25rem; }
h4 { font-size: 1.1rem; }

p, ul, ol, dl, table, blockquote, figure {
  margin-bottom: 1rem;
}

p {
  color: var(--text);
  font-size: 1rem;
}

.text-muted {
  color: var(--text-muted);
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover, a:focus-visible {
  color: var(--primary-strong);
  text-decoration-thickness: 2px;
}

/* Container & Structure */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Header & Navigation */
.site-header {
  background-color: var(--navy);
  color: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-height: var(--min-tap);
}

.brand-logo-svg {
  height: 44px;
  width: auto;
  max-width: 240px;
  display: block;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover, .nav-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* Dropdown Menu */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.3;
}

.nav-dropdown-item:hover, .nav-dropdown-item:focus {
  background-color: var(--surface-2);
  color: var(--primary);
  text-decoration: none;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  min-height: 38px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  gap: 0.35rem;
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--min-tap);
  min-height: var(--min-tap);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  cursor: pointer;
}

.mobile-nav-toggle svg {
  width: 24px;
  height: 24px;
}

.mobile-menu {
  display: none;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-md);
}

.mobile-menu.open {
  display: block;
}

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-list a {
  display: block;
  padding: 0.75rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-sm);
  min-height: var(--min-tap);
  display: flex;
  align-items: center;
}

.mobile-nav-list a:hover {
  background-color: var(--surface-2);
  color: var(--primary);
}

/* Search Bar Component */
.search-box-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  min-height: var(--min-tap);
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 126, 171, 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

/* Card & Panels */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.card-header {
  margin-bottom: 0.75rem;
}

.card-title {
  margin: 0;
  font-size: 1.2rem;
}

.card-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Grid Layouts */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: 1rem; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  line-height: 1.2;
}

.badge-approved, .badge-success {
  background-color: rgba(4, 120, 87, 0.12);
  color: var(--success);
  border: 1px solid rgba(4, 120, 87, 0.3);
}

.badge-provisional, .badge-warn {
  background-color: rgba(180, 83, 9, 0.12);
  color: var(--warn);
  border: 1px solid rgba(180, 83, 9, 0.3);
}

.badge-stale, .badge-danger {
  background-color: rgba(180, 35, 24, 0.12);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.3);
}

.badge-info {
  background-color: var(--surface-2);
  color: var(--primary-strong);
  border: 1px solid var(--border);
}

/* Buttons & Interactive Elements */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--min-tap);
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  gap: 0.5rem;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-strong);
  color: #FFFFFF;
  text-decoration: none;
}

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

.btn-secondary:hover {
  background-color: var(--border);
  text-decoration: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--surface-2);
  text-decoration: none;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.95rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-control {
  width: 100%;
  min-height: var(--min-tap);
  padding: 0.65rem 0.85rem;
  font-size: 1rem; /* iOS zoom prevention */
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 126, 171, 0.2);
}

/* Tables (Responsive scroll container with card pattern) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th, td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

tr:nth-child(even) {
  background-color: rgba(234, 242, 248, 0.4);
}

[data-theme="dark"] tr:nth-child(even) {
  background-color: rgba(23, 51, 74, 0.4);
}

/* Hero Section */
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, rgba(8, 126, 171, 0.15) 100%), var(--bg);
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 760px;
  margin-bottom: 1.5rem;
}

/* Breadcrumbs */
.breadcrumbs {
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.breadcrumbs li::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--border);
}

.breadcrumbs li:last-child::after {
  content: "";
}

.breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Stat Blocks / Dashboard Metrics */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.metric-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Percentile Bar Visualizer */
.percentile-bar-container {
  margin: 1.5rem 0;
}

.percentile-bar {
  position: relative;
  height: 24px;
  background-color: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: visible;
}

.percentile-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 25%;
  width: 50%;
  background-color: rgba(32, 184, 176, 0.25);
  border-left: 2px dashed var(--accent);
  border-right: 2px dashed var(--accent);
}

.percentile-median {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 50%;
  width: 3px;
  background-color: var(--navy);
  transform: translateX(-50%);
}

.percentile-marker {
  position: absolute;
  top: -8px;
  width: 18px;
  height: 40px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.percentile-marker-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--warn);
  border: 2px solid #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.percentile-marker-line {
  width: 2px;
  height: 26px;
  background-color: var(--warn);
}

/* Boating Go/No-Go Strip */
.go-no-go-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.go-no-go-card {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--border);
}

.go-no-go-card.status-go {
  background-color: rgba(4, 120, 87, 0.08);
  border-color: rgba(4, 120, 87, 0.3);
}

.go-no-go-card.status-caution {
  background-color: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.3);
}

.go-no-go-card.status-no-go {
  background-color: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.3);
}

.boat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.boat-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.boat-status {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

/* Author Box */
.author-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.author-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.author-meta h3 {
  margin: 0;
  font-size: 1.2rem;
}

.author-title {
  font-size: 0.85rem;
  color: var(--primary-strong);
  font-weight: 600;
}

.author-bio {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
}

/* AdSense Slot Reservation */
.ad-slot-wrapper {
  margin: 2rem 0;
  padding: 0.75rem;
  text-align: center;
  background-color: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  clear: both;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Site Footer */
.site-footer {
  background-color: var(--navy);
  color: #FFFFFF;
  padding: 3rem 0 1.5rem;
  border-top: 3px solid var(--primary);
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: 1.05rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--surface-2);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-disclaimer-box {
  background-color: rgba(11, 27, 41, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #D5E3EE;
}

.footer-disclaimer-box a {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

/* Responsive Media Queries */
@media (min-width: 480px) {
  .hero-title { font-size: 2.2rem; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .author-box { flex-direction: row; }
}

@media (min-width: 768px) {
  h1 { font-size: 2.3rem; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: row; justify-content: space-between; text-align: left; }
}

@media (min-width: 1024px) {
  .nav-desktop { display: flex; }
  .mobile-nav-toggle { display: none; }
  .hero { padding: 4rem 0 3.5rem; }
  .hero-title { font-size: 2.75rem; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}

@media (min-width: 1280px) {
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Print Stylesheet */
@media print {
  .site-header, .site-footer, .theme-toggle-btn, .ad-slot-wrapper, .btn {
    display: none !important;
  }
  body, .card {
    background: #FFFFFF !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: 1px solid #CCCCCC !important;
  }
}
