﻿/* Tabletop Tornado / NC Weather - shared responsive styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 1rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #1a2332;
  background: #f4f7fb;
  max-width: 100%;
  overflow-x: hidden;
}

.site-header {
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid #1e4d7b;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #1e4d7b;
  font-weight: 700;
}

.wrap {
  width: 100%;
  max-width: min(72rem, 100%);
  margin: 0 auto;
  overflow-x: hidden;
}

.section {
  margin: 0 0 1.75rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(30, 77, 123, 0.06);
  max-width: 100%;
  overflow-x: hidden;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: #163a5c;
  font-weight: 650;
}

/* Single big-link sections (Windfinder, Windy, CORMP, AccuWeather) — minimal chrome */
.section-solo {
  padding: 1.1rem 1.15rem;
}

.section-solo .big-link {
  display: block;
  font-size: clamp(1.2rem, 4.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  color: #0b5cab;
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.section-solo .big-link:hover,
.section-solo .big-link:focus {
  color: #083f78;
  text-decoration: underline;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.links li {
  margin: 0 0 0.85rem;
}

.links a {
  color: #0b5cab;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  line-height: 1.4;
}

.links a:hover,
.links a:focus {
  color: #083f78;
}

/* Featured Fishweather FPS link — visually larger */
.links a.link-featured {
  font-size: 1.35rem;
  font-weight: 700;
  display: inline-block;
  padding: 0.2rem 0;
}

.links .url {
  display: block;
  font-size: 0.875rem;
  color: #4a5a6a;
  margin-top: 0.15rem;
}

.iframe-block {
  margin: 0.75rem 0 0;
  max-width: 100%;
}

/*
  Desktop defaults: full size, non-zero height.
  Mobile shrink is in the max-width: 900px block below (zoom + transform).
*/
.iframe-fit {
  --iw: 900;
  --ih: 1500;
  --fit: 1;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  height: calc(var(--ih) * 1px * var(--fit));
}

.iframe-fit-inner {
  width: calc(var(--iw) * 1px);
  height: calc(var(--ih) * 1px);
  transform-origin: top left;
}

iframe {
  display: block;
  max-width: 100%;
  border: 1px solid #c8d4e0;
  border-radius: 4px;
  background: #fff;
}

.iframe-fit iframe {
  display: block;
  max-width: none !important;
  width: calc(var(--iw) * 1px) !important;
  height: calc(var(--ih) * 1px) !important;
  border: 0;
  border-radius: 0;
}

/* Tides: crop Surfline About/footer below the chart */
.iframe-tides {
  --ih: 600;
}

/*
  MOBILE SHRINK
  1) Chrome/Chromium: CSS zoom on .iframe-fit-inner (DO NOT CHANGE — Chrome OK).
  2) Firefox: CSS transform has failed in production for cross-origin iframes.
     Primary fix is iframe-fit.js (inline transform from clientWidth / --iw).
     CSS below: overflow-x auto safety net + hardcoded scale fallbacks.
*/
@media (max-width: 900px) {
  .iframe-fit {
    --fit: calc((100vw - 2.5rem) / (var(--iw) * 1px) * 0.92);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    height: calc(var(--ih) * 1px * var(--fit));
  }

  .iframe-fit-inner {
    width: calc(var(--iw) * 1px);
    height: calc(var(--ih) * 1px);
    /* Chromium/Android Chrome: shrink layout + iframe paint */
    zoom: calc((100vw - 2.5rem) / (var(--iw) * 1px) * 0.92);
    transform-origin: top left;
  }
}

/* Firefox: do not fight JS scaler; allow horizontal pan if JS late/fails */
@supports (-moz-appearance: none) {
  @media (max-width: 900px) {
    .iframe-fit {
      width: 100%;
      max-width: 100%;
      /* Safety: never permanently clip unreachable content before/without JS */
      overflow-x: auto;
      overflow-y: hidden;
      -moz-scrollbars-horizontal: thin;
      height: auto;
      min-height: calc(var(--ih) * 1px * 0.34);
    }

    .iframe-fit-inner {
      zoom: normal !important;
      transform: none !important;
      width: calc(var(--iw) * 1px);
      height: calc(var(--ih) * 1px);
    }

    /* Hardcoded fallbacks if JS has not yet set inline transform */
    .iframe-fit.iframe-w900 iframe {
      display: block;
      width: 900px !important;
      max-width: none !important;
      transform: scale(0.42);
      transform-origin: top left;
      border: 0;
    }

    .iframe-fit.iframe-w1100 iframe {
      display: block;
      width: 1100px !important;
      max-width: none !important;
      transform: scale(0.34);
      transform-origin: top left;
      border: 0;
    }

    .iframe-fit.iframe-w900 {
      height: calc(var(--ih) * 1px * 0.42);
    }

    .iframe-fit.iframe-w1100 {
      height: calc(var(--ih) * 1px * 0.34);
    }
  }

  @media (max-width: 640px) {
    .iframe-fit.iframe-w900 iframe {
      transform: scale(0.38);
    }

    .iframe-fit.iframe-w1100 iframe {
      transform: scale(0.32);
    }

    .iframe-fit.iframe-w900 {
      height: calc(var(--ih) * 1px * 0.38);
    }

    .iframe-fit.iframe-w1100 {
      height: calc(var(--ih) * 1px * 0.32);
    }
  }
}

@-moz-document url-prefix() {
  @media (max-width: 900px) {
    .iframe-fit {
      overflow-x: auto;
      overflow-y: hidden;
    }

    .iframe-fit-inner {
      zoom: normal !important;
      transform: none !important;
    }
  }
}
.nav-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #c8d4e0;
}

.nav-footer a {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e4d7b;
}

/* Charge / image gallery pages */
.gallery img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  margin: 0 0.25rem 0.5rem 0;
  border-radius: 4px;
  border: 1px solid #d5dee8;
}

.gallery .row {
  margin-bottom: 0.75rem;
}

.caption {
  display: block;
  margin: 1rem 0 0.5rem;
  font-size: 1.05rem;
}

@media (max-width: 640px) {
  body {
    padding: 0.75rem;
  }

  .section {
    padding: 0.85rem;
    margin-bottom: 1.25rem;
  }

  .section-solo {
    padding: 1rem 0.95rem;
  }

  .section-solo .big-link {
    font-size: 1.35rem;
    padding: 0.35rem 0;
  }

  .links li {
    margin: 0 0 1.15rem;
  }

  .links a {
    font-size: 1.2rem;
    display: inline-block;
    padding: 0.25rem 0;
  }

  .links a.link-featured {
    font-size: 1.5rem;
    padding: 0.4rem 0;
  }

  .iframe-block:not(.iframe-fit) iframe {
    width: 100% !important;
  }

  /* Chrome path: tighter inset; Firefox overrides zoom via -moz block above */
  .iframe-fit {
    --fit: calc((100vw - 2rem) / (var(--iw) * 1px) * 0.92);
    height: calc(var(--ih) * 1px * var(--fit));
  }

  .iframe-fit-inner {
    zoom: calc((100vw - 2rem) / (var(--iw) * 1px) * 0.92);
  }
}




