/* =========================================================
   Forecizer — Surfline-inspired minimal CSS
   ========================================================= */

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a2e;
  background: #ffffff;
  font-size: 14px;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */

.site-header {
  padding: 12px 0;
  border-bottom: 1px solid #e0e4ea;
  background: #fff;
}

.site-header-inner {
  display: flex;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: #1a1a2e;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.site-logo:hover {
  color: #2d7a2d;
}

main {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ---------------------------------------------------------
   Source dropdown
   --------------------------------------------------------- */

.source-select {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.source-select label {
  font-size: 0.9rem;
  color: #555;
}

.source-select select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

/* ---------------------------------------------------------
   Grid page
   --------------------------------------------------------- */

.grid-page h1 {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

.grid-header {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.forecast-grid {
  width: 100%;
  border-collapse: collapse;
}

.forecast-grid th,
.forecast-grid td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.forecast-grid thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.forecast-grid thead th.spot-col {
  text-align: left;
}

.spot-col {
  min-width: 160px;
}

.day-col {
  text-align: center;
  min-width: 80px;
}

.spot-name a {
  text-decoration: none;
  font-weight: 600;
  color: #1a1a2e;
}

.spot-name a:hover {
  text-decoration: underline;
  color: #2d7a2d;
}

.day-cell {
  text-align: center;
  vertical-align: middle;
  padding: 8px 6px;
}

.cell-height {
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 5px;
}

.cell-segs {
  display: flex;
  gap: 2px;
  width: 100%;
}

.cell-seg {
  flex: 1;
  height: 6px;
  border-radius: 2px;
}

.no-data {
  color: #ccc;
  font-size: 1rem;
}

/* ---------------------------------------------------------
   Colour classes — used on cell-bar, day-dot, time-indicator
   --------------------------------------------------------- */

.color-epic {
  background: #651DC9;
}

.color-good {
  background: #6751F4;
}

.color-fair-to-good {
  background: #009373;
}

.color-fair {
  background: #0AD678;
}

.color-poor-to-fair {
  background: #FDCF16;
}

.color-poor {
  background: #FF9300;
}

.color-very-poor {
  background: #FC466D;
}

.color-flat {
  background: #b0b8c1;
}

/* ---------------------------------------------------------
   Spot page
   --------------------------------------------------------- */

.spot-page {
  max-width: 860px;
  margin: 0 auto;
}


.spot-header {
  margin-bottom: 16px;
}

.spot-header h1 {
  font-size: 1.5rem;
  margin: 4px 0 12px;
}

.header-sub {
  font-size: 1rem;
  font-weight: 400;
  color: #888;
  margin-left: 6px;
}

.back-link {
  display: block;
  color: #555;
  font-size: 0.9rem;
  margin-bottom: 8px;
  text-decoration: none;
}

.back-link:hover {
  color: #1a1a2e;
  text-decoration: underline;
}

.buoy-note {
  background: #f0f8ff;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #2c5f8a;
  border: 1px solid #c8e0f4;
}

/* ---------------------------------------------------------
   Day accordion sections
   --------------------------------------------------------- */

.day-section {
  border-bottom: 1px solid #eee;
  margin-bottom: 4px;
}

.day-header {
  cursor: pointer;
  padding: 12px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  user-select: none;
}

.day-header:hover {
  background: #fafafa;
}

.day-label {
  flex: 1;
}

.day-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.day-toggle {
  color: #888;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   Hourly table
   --------------------------------------------------------- */

.hour-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.hour-table th {
  font-size: 0.78rem;
  font-weight: 600;
  color: #999;
  text-align: left;
  padding: 4px 10px 6px;
  border-bottom: 1px solid #eee;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.hour-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

.hour-table tr:last-child td {
  border-bottom: none;
}

.time-col {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.time-indicator {
  width: 4px;
  height: 20px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.height-col {
  font-variant-numeric: tabular-nums;
}

.period-col {
  font-variant-numeric: tabular-nums;
  color: #555;
}

.wind-col {
  white-space: nowrap;
}

.wind-arrow {
  font-size: 1.1rem;
  display: inline-block;
  margin-right: 2px;
  line-height: 1;
}

.temp-col {
  font-variant-numeric: tabular-nums;
  color: #555;
}

.rating-col {
  font-weight: 500;
}

/* Rating text colours override background-based colour classes */
.rating-col.color-epic {
  background: transparent;
  color: #651DC9;
}

.rating-col.color-good {
  background: transparent;
  color: #5238D6;
}

.rating-col.color-fair-to-good {
  background: transparent;
  color: #007A5E;
}

.rating-col.color-fair {
  background: transparent;
  color: #0B6B3D;
}

.rating-col.color-poor-to-fair {
  background: transparent;
  color: #8A6D00;
}

.rating-col.color-poor {
  background: transparent;
  color: #B25E00;
}

.rating-col.color-very-poor {
  background: transparent;
  color: #D11149;
}

.rating-col.color-flat {
  background: transparent;
  color: #888;
}

.no-data-msg {
  color: #aaa;
  font-style: italic;
  padding: 8px 4px;
  font-size: 0.9rem;
}

/* ---- Buoy grid row ---- */
.color-buoy {
  background: #6ab0d4;
}

.buoy-grid-row td {
  border-top: 1px solid #e0e6ef;
}

.buoy-grid-name {
  font-weight: 400;
  color: #555;
}

.buoy-grid-sub {
  display: block;
  font-size: 0.75rem;
  color: #aaa;
  font-weight: 400;
}

.buoy-arrows {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
}

.buoy-arrow {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  color: #6ab0d4;
}

.buoy-arrow-none {
  color: #ddd;
  font-size: 0.8rem;
}

/* ---------------------------------------------------------
   Forecast strip (spot page — surfline-style day overview)
   --------------------------------------------------------- */

.forecast-strip { display:flex; gap:6px; padding-bottom:6px; margin-bottom:20px; border-bottom:1px solid #eee; }
.fs-day { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; padding:6px 4px 8px; border-radius:6px; text-decoration:none; color:#1a1a2e; transition:background .12s ease; }
.fs-day:hover { background:#f5f7fa; }
.fs-day-empty { opacity:.5; }
.fs-label { font-size:.78rem; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:.4px; white-space:nowrap; }
.fs-height { font-size:.85rem; font-weight:600; color:#1a1a2e; font-variant-numeric:tabular-nums; white-space:nowrap; }
.fs-unit { font-weight:400; color:#888; font-size:.75rem; }
.fs-winds { display:flex; gap:4px; width:100%; justify-content:space-between; }
.fs-wind { flex:1; display:flex; flex-direction:column; align-items:center; gap:1px; min-width:0; }
.fs-wind .wind-arrow { font-size:.95rem; margin-right:0; color:#555; }
.fs-wind-spd { font-size:.68rem; color:#888; font-variant-numeric:tabular-nums; line-height:1; }
.fs-wind-none { color:#ccc; font-size:.8rem; line-height:1; }
.fs-segs { gap:2px; }
.fs-empty-note { font-size:.7rem; color:#aaa; font-style:italic; }
html { scroll-behavior:smooth; }
.day-section { scroll-margin-top:16px; }

/* =========================================================
   Mobile — max-width: 600px
   ========================================================= */

@media (max-width: 600px) {

  /* 1. Reduce main padding */
  main {
    padding: 12px;
  }

  /* Header inner padding matches */
  .site-header-inner {
    padding: 0 12px;
  }

  /* 2. Grid header: stack h1 + source-select vertically */
  .grid-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .grid-page h1 {
    font-size: 1.2rem;
    margin: 0;
  }

  /* 5. Forecast grid: make table horizontally scrollable without a wrapper div */
  .forecast-grid {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* restore collapsed borders inside block context */
    border-spacing: 0;
  }

  /* 10. Tighten cell padding on mobile */
  .forecast-grid th,
  .forecast-grid td {
    padding: 6px 8px;
  }

  .day-cell {
    padding: 6px 4px;
  }

  /* 3. Spot column narrower */
  .spot-col {
    min-width: 100px;
  }

  /* 4. Day columns narrower */
  .day-col {
    min-width: 56px;
  }

  /* 6. Spot header: ensure source-select doesn't overflow */
  .spot-header h1 {
    font-size: 1.25rem;
  }

  .source-select {
    flex-wrap: wrap;
  }

  .source-select select {
    max-width: 100%;
  }

  /* 7. Forecast strip: horizontal scroll, no wrap */
  .forecast-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }

  /* Keep strip items from shrinking too small */
  .fs-day {
    flex: 0 0 auto;
    min-width: 68px;
  }

  /* 8. Hour table: block + horizontal scroll */
  .hour-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Keep thead/tbody/tr rendering correctly after display:block on table */
  .hour-table thead,
  .hour-table tbody {
    display: block;
  }

  .hour-table tr {
    display: flex;
    align-items: center;
  }

  /* Fixed column widths so columns align across thead and tbody rows */
  .hour-table th,
  .hour-table td {
    flex-shrink: 0;
    padding: 6px 8px;
  }

  .hour-table .time-col   { width: 56px; }
  .hour-table .height-col { width: 54px; }
  .hour-table .period-col { width: 54px; }
  .hour-table .wind-col   { width: 72px; }
  .hour-table .temp-col   { width: 48px; }
  .hour-table .rating-col { width: 80px; }

  /* 9. Day accordion: larger tap target */
  .day-header {
    padding: 14px 4px;
    min-height: 44px;
  }

}
