:root {
  --forest: #1a3a2a;
  --moss: #2d6a4f;
  --fern: #52b788;
  --mist: #b7e4c7;
  --bark: #3d2b1f;
  --stone: #8c7b6e;
  --fog: #f0ede8;
  --white: #fafaf8;
  --emergency: #c0392b;
  --emergency-light: #fde8e6;
  --text: #1c1c1a;
  --text-light: #5a5a54;
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--white);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* TYPOGRAPHY */
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; color: var(--forest); }
h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 700; line-height: 1.2; color: var(--forest); margin-bottom: 0.75rem; }
h3 { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--moss); margin-bottom: 0.5rem; }
p { font-size: 1rem; line-height: 1.7; color: var(--text-light); margin-bottom: 1rem; }
a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; }

/* HEADER */
.site-header {
  background: var(--forest);
  color: var(--white);
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.site-header .logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--mist);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-header .logo svg { width: 22px; height: 22px; fill: var(--fern); }
.offline-badge {
  font-size: 0.65rem;
  background: var(--moss);
  color: var(--white);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  letter-spacing: 0.05em;
  font-family: 'Courier New', monospace;
}

/* HERO */
.hero {
  background: linear-gradient(160deg, var(--forest) 0%, #0d2318 100%);
  color: var(--white);
  padding: 2.5rem 1.25rem 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2352b788' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { color: var(--white); font-size: clamp(1.5rem, 6vw, 2.4rem); margin-bottom: 0.5rem; }
.hero .subtitle { color: var(--mist); font-size: 0.95rem; line-height: 1.5; opacity: 0.9; margin-bottom: 1.5rem; }
.hero .signal-warning {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(82,183,136,0.15);
  border: 1px solid rgba(82,183,136,0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--mist);
}
.hero .signal-warning svg { flex-shrink: 0; width: 20px; height: 20px; }

/* INSTALL BANNER */
.install-banner {
  background: var(--moss);
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  display: none;
}
.install-banner.show { display: flex; }
.install-banner p { margin: 0; font-size: 0.85rem; color: rgba(255,255,255,0.9); }
.install-banner strong { color: var(--white); }
.btn-install {
  background: var(--white);
  color: var(--moss);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  font-family: inherit;
}

/* MAIN CONTENT */
main { max-width: 680px; margin: 0 auto; }
.content-section { padding: 1.5rem 1.25rem; }
.content-section + .content-section { border-top: 1px solid rgba(0,0,0,0.07); }

/* CARDS */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--fog);
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
  min-height: 100px;
}
.card:hover { border-color: var(--fern); background: var(--white); text-decoration: none; }
.card .card-icon { font-size: 1.75rem; margin-bottom: 0.5rem; line-height: 1; }
.card .card-label { font-size: 0.85rem; font-weight: 700; color: var(--forest); line-height: 1.2; }
.card .card-desc { font-size: 0.75rem; color: var(--text-light); margin-top: 0.25rem; line-height: 1.3; }
.card.emergency-card {
  background: var(--emergency-light);
  border-color: var(--emergency);
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
}
.card.emergency-card .card-label { color: var(--emergency); font-size: 1rem; }

/* INFO LIST */
.info-list { list-style: none; }
.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 0.95rem;
  line-height: 1.5;
}
.info-list li:last-child { border-bottom: none; }
.info-list .icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 0.1rem; }

/* TRAIL CARDS */
.trail-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.trail-card {
  background: var(--fog);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--stone);
}
.trail-card.easy { border-left-color: var(--fern); }
.trail-card.moderate { border-left-color: #f4a261; }
.trail-card.hard { border-left-color: var(--emergency); }
.trail-card .trail-name { font-weight: 700; font-size: 1rem; color: var(--forest); margin-bottom: 0.25rem; }
.trail-card .trail-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.trail-card .trail-tag {
  font-size: 0.72rem;
  font-family: 'Courier New', monospace;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: var(--text-light);
}
.trail-card p { font-size: 0.85rem; margin: 0; }

/* EMERGENCY PAGE */
.emergency-header {
  background: var(--emergency);
  color: var(--white);
  padding: 2rem 1.25rem;
  text-align: center;
}
.emergency-header h1 { color: var(--white); font-size: 2rem; margin-bottom: 0.5rem; }
.emergency-header p { color: rgba(255,255,255,0.9); margin: 0; }
.phone-grid { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.phone-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--fog);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  border: 2px solid transparent;
  text-decoration: none;
  color: var(--text);
}
.phone-card:hover { border-color: var(--emergency); text-decoration: none; }
.phone-card .phone-label { font-weight: 700; font-size: 0.9rem; color: var(--forest); }
.phone-card .phone-number { font-size: 1.3rem; font-weight: 700; color: var(--emergency); font-family: 'Courier New', monospace; letter-spacing: 0.05em; }
.phone-card .phone-desc { font-size: 0.75rem; color: var(--text-light); margin-top: 0.1rem; }
.call-btn {
  background: var(--emergency);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  min-width: 70px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* PILL TAGS */
.difficulty-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}
.difficulty-pill.easy { background: #d8f3dc; color: #1a5c32; }
.difficulty-pill.moderate { background: #fdebd0; color: #7a4a10; }
.difficulty-pill.hard { background: var(--emergency-light); color: var(--emergency); }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--forest);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-decoration: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.15s, background 0.15s;
  min-height: 44px;
  border-top: 3px solid transparent;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item:hover, .nav-item.active {
  color: var(--fern);
  border-top-color: var(--fern);
  text-decoration: none;
}
.nav-item.emergency-nav { color: rgba(255,100,80,0.7); }
.nav-item.emergency-nav:hover, .nav-item.emergency-nav.active { color: #ff6b6b; border-top-color: #ff6b6b; }

/* SECTION INTRO */
.section-intro {
  background: var(--forest);
  color: var(--white);
  padding: 1.5rem 1.25rem;
}
.section-intro h1 { color: var(--white); }
.section-intro p { color: var(--mist); margin-bottom: 0; opacity: 0.85; font-size: 0.9rem; }

/* ALERTS */
.alert {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.alert.warning { background: #fff3cd; border-left: 4px solid #f4a261; color: #7a4a10; }
.alert.info { background: #d8f3dc; border-left: 4px solid var(--fern); color: #1a5c32; }
.alert.danger { background: var(--emergency-light); border-left: 4px solid var(--emergency); color: #7a1c12; }
.alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 0.1rem; }

/* TIDE TABLE */
.tide-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 0.75rem; }
.tide-table th { background: var(--forest); color: var(--mist); padding: 0.6rem 0.75rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tide-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.07); }
.tide-table tr:last-child td { border-bottom: none; }
.tide-table .high { color: var(--moss); font-weight: 700; }
.tide-table .low { color: var(--stone); }

/* OFFLINE NOTICE */
.offline-notice {
  background: var(--fog);
  border: 1px dashed var(--stone);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 1rem;
}

@media (min-width: 480px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .card.emergency-card { grid-column: span 3; }
}
