/* ==========================================================================
   Tidefall.xyz — Design System
   Ultra-modern 2026. Refined minimalism with editorial depth.
   ========================================================================== */

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

/* CSS Variables */
:root {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-card: #fafaf8;
  --bg-inset: #f0f0ec;

  /* Text */
  --text-primary: #0f0f0f;
  --text-secondary: #6b6b6b;
  --text-muted: #a8a8a8;

  /* Accent — deep ocean green, used sparingly */
  --accent: #006d5b;
  --accent-hover: #005a4a;
  --accent-light: #e8f4f1;
  --accent-border: #b8ddd8;

  /* Borders */
  --border: #e8e8e4;
  --border-strong: #d4d4ce;

  /* Dive type colours — muted, sophisticated */
  --type-reef: #006d5b;
  --type-wall: #1a5276;
  --type-wreck: #7d4e1e;
  --type-drift: #4a3570;
  --type-muck: #4a5420;
  --type-cave: #4a4a5a;

  /* Dive type tints — rgba for true colour association */
  --type-reef-tint: rgba(0, 109, 91, 0.08);
  --type-wall-tint: rgba(26, 82, 118, 0.08);
  --type-wreck-tint: rgba(125, 78, 30, 0.08);
  --type-drift-tint: rgba(74, 53, 112, 0.08);
  --type-muck-tint: rgba(74, 84, 32, 0.08);
  --type-cave-tint: rgba(74, 74, 90, 0.08);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* Layout */
  --max-width: 1200px;
  --content-width: 720px;

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 100ms ease;
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

/* ==========================================================================
   Component: Section Headers (editorial chapter feel)
   ========================================================================== */

.section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

/* ==========================================================================
   Component: Badges / Tags (pill style)
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 100px;
  line-height: 1.4;
  transition: background 150ms ease;
  white-space: nowrap;
}

.tag-reef { background: var(--type-reef-tint); color: var(--type-reef); }
.tag-wall { background: var(--type-wall-tint); color: var(--type-wall); }
.tag-wreck { background: var(--type-wreck-tint); color: var(--type-wreck); }
.tag-drift { background: var(--type-drift-tint); color: var(--type-drift); }
.tag-muck { background: var(--type-muck-tint); color: var(--type-muck); }
.tag-cave, .tag-cavern { background: var(--type-cave-tint); color: var(--type-cave); }

/* Default/neutral tag */
.tag-neutral {
  background: var(--bg-inset);
  color: var(--text-secondary);
}

/* Larger tag variant for page headers */
.tag-lg {
  padding: 5px 14px;
  font-size: 12px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Header tags strip */
.header-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-md);
}

/* ==========================================================================
   Component: Cards
   ========================================================================== */

.card {
  display: block;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  color: var(--text-primary);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.card:hover .card-title {
  color: var(--accent);
}

.card-body {
  padding: var(--space-lg);
}

.card-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
  transition: color 150ms ease;
}

.card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.card-img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Country card — clean bordered, no gradient */
.card-country {
  padding: 32px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  position: relative;
}

/* Animated bottom border: grows left-to-right on hover */
.card-country::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  transition: width 250ms ease;
}

.card-country:hover::after {
  width: 100%;
}

.card-country .card-title {
  font-size: 22px;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.card-country .count {
  font-size: 13px;
  color: var(--text-muted);
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* ==========================================================================
   Component: Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Component: Inset Card (Divemaster Notes)
   ========================================================================== */

.inset-card {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--space-lg) var(--space-lg) var(--space-lg) 28px;
}

.inset-card .section-label {
  color: var(--accent);
  border-bottom-color: var(--accent-border);
}

.inset-card .prose {
  font-size: 15px;
}

/* ==========================================================================
   Component: Quick Facts Sidebar
   ========================================================================== */

.info-card {
  background: var(--bg-inset);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.info-card .section-label {
  border-bottom: none;
  margin-bottom: var(--space-md);
}

.fact-list {
  list-style: none;
}

.fact-list .fact-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.fact-list .fact-row:last-child {
  border-bottom: none;
}

.fact-label {
  font-family: 'Berkeley Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fact-value {
  font-family: 'Berkeley Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  transition: background 200ms ease;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo:hover { color: var(--text-primary); }

.logo-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: color 200ms ease;
}

.logo:hover .logo-icon {
  color: var(--accent);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.site-header nav a {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: color 100ms ease, background 100ms ease;
}

.site-header nav a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Hero Section (Homepage)
   ========================================================================== */

.hero {
  padding: 72px 0 40px;
  text-align: center;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 68px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-xl);
  line-height: 1.7;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: var(--space-xl) 0 var(--space-2xl);
}

/* section-alt: no background change — white throughout, cards define structure */
.section-alt {
  background: var(--bg-primary);
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  padding: var(--space-lg) 0 var(--space-md);
  line-height: 1.5;
}

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

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

/* ==========================================================================
   Dive Site Page
   ========================================================================== */

.dive-site-page {
  padding-bottom: var(--space-3xl);
}

.dive-site-page h1 {
  font-size: 52px;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.site-location {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.site-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-2xl);
  align-items: start;
  margin-top: var(--space-xl);
}

/* Content sections */
.content-section {
  margin-bottom: 48px;
}

.content-section .section-label {
  margin-bottom: var(--space-md);
}

.prose {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text-primary);
}

.prose p {
  margin-bottom: 1em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose ul, .prose ol {
  margin: 0 0 1em 1.5em;
}

.prose li {
  margin-bottom: 0.4em;
}

/* Divemaster Notes */
.divemaster-notes {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--space-lg) var(--space-lg) var(--space-lg) 28px;
}

.divemaster-notes .section-label {
  color: var(--accent);
  border-bottom-color: var(--accent-border);
}

.divemaster-notes .prose {
  font-size: 15px;
}

/* Location card */
.coords {
  font-family: 'Berkeley Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-lg);
}

/* Related / Nearby Sites */
.related-sites {
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.related-sites .section-label {
  margin-bottom: var(--space-lg);
}

/* ==========================================================================
   Region Hub Page
   ========================================================================== */

.region-header {
  margin-bottom: var(--space-xl);
}

.region-header h1 {
  font-size: 48px;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.region-count {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.region-description {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: var(--content-width);
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-group + .filter-group {
  margin-left: var(--space-md);
  padding-left: var(--space-md);
  border-left: 1px solid var(--border);
}

.filter-pill {
  padding: 6px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
  line-height: 1;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Region sections on country hub */
.region-section {
  margin-bottom: var(--space-2xl);
}

.region-section .section-label {
  font-size: 13px;
}

.region-section .section-label a {
  color: var(--text-muted);
  text-decoration: none;
}

.region-section .section-label a:hover {
  color: var(--accent);
}

/* ==========================================================================
   Dive Sites Index
   ========================================================================== */

.index-header {
  margin-bottom: var(--space-xl);
}

.index-header h1 {
  font-size: 48px;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.index-count {
  font-size: 14px;
  color: var(--text-muted);
}

/* ==========================================================================
   Hero Image (dive site page)
   ========================================================================== */

.hero-img {
  margin: var(--space-md) 0 var(--space-lg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 480px;
}

.hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   404 / 500 Pages
   ========================================================================== */

.error-page {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.error-page h1 {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  font-size: 17px;
}

/* ==========================================================================
   Card excerpt
   ========================================================================== */

.card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
  font-size: 17px;
}

/* ==========================================================================
   Page fade-in
   ========================================================================== */

main {
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Responsive: Tablet (768px)
   ========================================================================== */

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-layout {
    grid-template-columns: 1fr 300px;
    gap: var(--space-xl);
  }

  .hero h1 {
    font-size: 52px;
  }

  .dive-site-page h1 {
    font-size: 42px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }

  /* Hero */
  .hero {
    padding: 64px 0 48px;
  }

  .hero h1 {
    font-size: 40px;
    letter-spacing: -0.02em;
  }

  .hero-sub {
    font-size: 15px;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  /* Dive site page */
  .dive-site-page h1 {
    font-size: 32px;
  }

  .site-location {
    font-size: 14px;
  }

  .site-layout {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  /* Move sidebar above content on mobile for quick access */
  .site-sidebar {
    order: -1;
  }

  /* Section spacing */
  .section {
    padding: var(--space-lg) 0 var(--space-xl);
  }

  .content-section {
    margin-bottom: var(--space-xl);
  }

  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .filter-group + .filter-group {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
  }

  /* Region header */
  .region-header h1,
  .index-header h1 {
    font-size: 36px;
  }

  /* Country cards */
  .card-country {
    padding: var(--space-lg);
  }

  /* Related sites */
  .related-sites {
    margin-top: var(--space-2xl);
  }

  /* Header tags */
  .header-tags {
    margin-top: var(--space-sm);
  }

  /* Prose */
  .prose {
    font-size: 15.5px;
  }
}

/* ==========================================================================
   Hero Wave (decorative depth contour)
   ========================================================================== */

.hero-wave {
  display: block;
  width: 100%;
  height: 70px;
  margin-top: var(--space-xl);
  pointer-events: none;
}

/* ==========================================================================
   Dive Type Tag Icons
   ========================================================================== */

.tag svg.tag-icon {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ==========================================================================
   Dive Site Page Header Silhouette
   ========================================================================== */

.dive-site-page .container {
  position: relative;
}

.header-silhouette {
  position: absolute;
  top: 0;
  right: 0;
  width: 160px;
  height: 160px;
  pointer-events: none;
  z-index: 0;
}

.header-silhouette svg {
  width: 100%;
  height: 100%;
}

.dive-site-page h1,
.dive-site-page .site-location,
.dive-site-page .header-tags,
.dive-site-page .breadcrumb {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .header-silhouette {
    display: none;
  }
}

/* ==========================================================================
   Footer links
   ========================================================================== */

.footer-links {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--text-secondary, #666);
  text-decoration: none;
  font-size: 0.9rem;
}
.footer-links a:hover {
  color: var(--text-primary, #1a1a1a);
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
  .site-header, .site-footer, .filter-bar, .btn { display: none; }
  .site-layout { grid-template-columns: 1fr; }
  body { font-size: 12pt; }
}
