:root {
  color-scheme: light;
  --bg: #edf2f2;
  --surface: #ffffff;
  --surface-dark: #f7faf9;
  --ink: #163234;
  --ink-invert: #ffffff;
  --muted: #7a8a88;
  --muted-dark: #647876;
  --line: #d7e1df;
  --line-light: #dce6e4;
  --accent: #0f6f72;
  --accent-dark: #0a4f52;
  --accent-soft: rgba(15, 111, 114, 0.08);
  --soft-blue: #e0eeee;
  --image-bg: #f7f7f7;
  --warning: #ad4d2b;
  --shadow: 0 14px 34px rgba(35, 68, 67, 0.08);
  --shadow-soft: 0 8px 22px rgba(35, 68, 67, 0.055);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -80px, rgba(15, 111, 114, 0.1), transparent 310px),
    linear-gradient(180deg, #f8fcfb 0, #edf2f2 380px),
    var(--bg);
  color: var(--accent-dark);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 5vw, 56px);
  padding: 10px 0 28px;
}

.brand-stack,
.masthead-content {
  min-width: 0;
}

.masthead-content {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.brand-mark {
  width: fit-content;
  margin: 0;
  color: var(--accent-dark);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: clamp(2.35rem, 5.8vw, 4.55rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: lowercase;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: #12383a;
  font-size: clamp(1.08rem, 1.65vw, 1.38rem);
  line-height: 1.12;
  letter-spacing: 0;
  text-align: center;
}

h1:empty {
  display: none;
}

h2 {
  margin: 0;
  color: #12383a;
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  margin: 0;
  color: #12383a;
}

.toolbar {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  justify-content: stretch;
  gap: 12px;
  width: min(460px, 100%);
  min-width: 320px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
}

.location-menu {
  position: relative;
}

.menu-button {
  width: 40px;
  padding: 0;
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: var(--ink-invert);
}

.menu-button:hover,
.menu-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink-invert);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.menu-button svg {
  width: 26px;
  height: 26px;
  overflow: visible;
}

.menu-button path {
  fill: none;
  stroke: #edf2f2;
  stroke-width: 5;
  stroke-linecap: round;
}

.location-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(240px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.location-menu-list a {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-radius: 7px;
  padding: 0 10px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.location-menu-list a:hover,
.location-menu-list a:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

#status {
  margin: 0;
  color: var(--muted-dark);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: right;
}

#status:empty {
  display: none;
}

.section-heading {
  margin-bottom: 10px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 9px;
}

.section-label .eyebrow {
  text-transform: lowercase;
}

.section-label::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.panel .section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel .section-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-light);
}

.home-view {
  padding-top: 4px;
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.location-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 249, 0.94));
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.location-card:hover {
  border-color: var(--accent);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 111, 114, 0.12);
}

.location-card:focus-visible {
  outline: 3px solid rgba(15, 111, 114, 0.2);
  outline-offset: 3px;
}

.location-copy {
  min-width: 0;
  flex: 1;
}

.location-card strong {
  display: block;
  color: #12383a;
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1.12;
}

.card-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.location-card:hover .card-arrow {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.wind-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.wind-card,
.wave-stat-card,
.panel {
  border: 1px solid var(--line-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.wind-card,
.wave-stat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: start;
  gap: 8px;
  min-height: 0;
  padding: 10px;
}

.wind-card h3,
.wave-stat-card h3 {
  font-size: 0.95rem;
  line-height: 1.1;
}

.station-link {
  color: inherit;
  text-decoration: none;
}

.station-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.meta-link {
  color: inherit;
  text-decoration: none;
}

.meta-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.station-id {
  margin: 4px 0 0;
  color: var(--muted-dark);
  font-size: 0.74rem;
  white-space: nowrap;
}

.direction {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7faf9;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.skeleton {
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf4f3 0%, #f8fbfb 48%, #edf4f3 100%);
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-title {
  width: min(150px, 78%);
  height: 14px;
}

.skeleton-time {
  width: 54px;
  height: 10px;
  margin-top: 8px;
}

.skeleton-metric {
  width: 52px;
  height: 22px;
}

.skeleton-direction {
  width: 42px;
  height: 28px;
  justify-self: end;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

.direction-offshore {
  border-color: #a9d6bc;
  background: #e8f5ed;
  color: #1c6a3f;
}

.direction-onshore {
  border-color: #e0b2a8;
  background: #f8ebe8;
  color: #994432;
}

.direction-neutral {
  border-color: var(--line);
  background: #f7faf9;
  color: var(--accent-dark);
}

.wind-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

.wind-metrics div {
  min-height: 38px;
  border-radius: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line-light);
  background: #fbfdfd;
}

.wind-metrics dt {
  color: var(--muted-dark);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.wind-metrics dd {
  margin: 4px 0 0;
  color: #12383a;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.wind-metrics dd span {
  margin-left: 3px;
  color: var(--muted-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.wave-stats-panel {
  margin-bottom: 16px;
}

.wave-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wave-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 15px;
}

.tide-panel {
  margin-bottom: 12px;
}

.tide-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-light);
  padding-bottom: 10px;
  color: var(--muted-dark);
  font-size: 0.85rem;
}

.meta-title {
  min-width: 0;
}

.tide-meta strong {
  color: #12383a;
}

.meta-time {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line-light);
  border-radius: 8px;
  padding: 0 9px;
  background: #fbfdfd;
  color: var(--muted-dark);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.tide-readings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.tide-readings div {
  min-height: 54px;
  border: 1px solid var(--line-light);
  border-radius: 8px;
  padding: 8px 9px;
  background: #fbfdfd;
}

.tide-readings span,
.tide-readings em {
  display: block;
  color: var(--muted-dark);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.tide-readings strong {
  display: block;
  margin: 3px 0;
  color: #12383a;
  font-size: 0.95rem;
  line-height: 1;
}

.source-note {
  margin: 12px 0 0;
  color: var(--muted-dark);
  font-size: 0.88rem;
}

.app-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted-dark);
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.4;
}

.error {
  border: 1px solid var(--line-light);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
}

@media (max-width: 920px) {
  .masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
    align-items: end;
    gap: 18px;
  }

  .toolbar {
    max-width: none;
    justify-content: flex-end;
  }

  #status {
    text-align: right;
  }

  .wind-grid {
    grid-template-columns: 1fr;
  }

  .tide-readings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wind-card,
  .wave-stat-card {
    grid-template-columns: minmax(104px, 1fr) minmax(96px, 0.95fr) 42px;
    align-items: center;
  }

  .wind-metrics {
    grid-column: auto;
    margin: 0;
  }

  .wave-stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .masthead {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 8px 0 16px;
  }

  .brand-stack {
    text-align: center;
  }

  .masthead-content {
    justify-items: stretch;
  }

  .brand-mark {
    margin: 0 auto;
    font-size: clamp(1.75rem, 9vw, 2.6rem);
    line-height: 0.98;
  }

  .eyebrow {
    margin-bottom: 12px;
    font-size: 0.72rem;
  }

  h1 {
    font-size: 1.2rem;
    text-align: center;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  button {
    min-height: 42px;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 0.95rem;
  }

  .menu-button {
    width: 44px;
  }

  .location-menu-list {
    width: min(220px, calc(100vw - 20px));
  }

  #refresh {
    width: 44px;
    padding: 0;
  }

  #refresh .button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  #status {
    grid-column: 1 / -1;
    padding-left: 1px;
    font-size: 0.82rem;
    text-align: center;
  }

  .location-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-view {
    padding-top: 4px;
  }

  .location-card {
    min-height: 68px;
    padding: 14px;
  }

  .location-card strong {
    font-size: 1.02rem;
  }

  .card-arrow {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: 1.25rem;
  }

  .wind-card,
  .wave-stat-card {
    gap: 5px;
    padding: 7px;
  }

  .wind-card h3,
  .wave-stat-card h3 {
    font-size: 0.95rem;
  }

  .station-id {
    font-size: 0.7rem;
  }

  .direction {
    min-width: 42px;
    height: 28px;
    font-size: 0.82rem;
  }

  .wind-metrics {
    gap: 5px;
  }

  .wind-metrics div {
    min-height: 38px;
    padding: 5px;
  }

  .wind-metrics dt {
    font-size: 0.6rem;
  }

  .wind-metrics dd {
    font-size: 1.08rem;
  }

  .wind-metrics dd span {
    font-size: 0.68rem;
  }

  .panel {
    padding: 14px;
  }

}
