:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: #102c35;
  background: #f2f6f5;
  --ink: #102c35;
  --muted: #49636c;
  --teal: #076a70;
  --high: #096a72;
  --low: #b24c38;
  --line: #dce7e5;
  --white: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 300px; margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #4d9a9e; outline-offset: 3px; }
h1, h2, p, figure { margin: 0; }
h1, h2 { letter-spacing: -.045em; }
h1 { font-size: clamp(1.65rem, 4vw, 2.15rem); line-height: 1; }
h2 { font-size: clamp(1.25rem, 3.8vw, 1.6rem); line-height: 1.15; }
a { color: var(--teal); text-underline-offset: .18em; }

.shell { width: min(100% - 36px, 880px); margin: 0 auto; padding: 30px 0 24px; }
.masthead, .brand, .place-button { display: flex; align-items: center; }
.masthead { justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.brand { gap: 12px; }
.brand-mark { width: 44px; height: 44px; }
.place-button {
  gap: 9px; min-width: 0; max-width: 58%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--white); font-weight: 650;
}
#place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-button:hover, .secondary-button:hover, .day-arrow:not(:disabled):hover { background: #eef6f5; }
.pin { flex: none; width: 12px; height: 12px; border: 2px solid var(--teal); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); margin: -4px 2px 0; }
.pin::after { content: ''; position: absolute; inset: 2px; background: var(--teal); border-radius: 50%; }
.chevron { display: inline-block; flex: none; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.chevron.down { transform: translateY(-2px) rotate(45deg); }
.chevron.left { transform: rotate(135deg); }
.chevron.right { transform: rotate(-45deg); }

.calendar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; align-items: stretch; margin-bottom: 18px; }
.day-arrow { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(66px, 1fr); gap: 6px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { display: grid; justify-items: center; gap: 3px; min-height: 56px; padding: 7px 3px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.day-label { font-size: .875rem; color: var(--muted); }
.day-number { font-size: 1.05rem; font-weight: 750; line-height: 1.15; }
.day[aria-pressed="true"] { border-color: #0b5962; background: #0b5962; color: white; }
.day[aria-pressed="true"] .day-label { color: #e1f3ef; }
.day:not([aria-pressed="true"]):hover { background: #e8f3f1; }
.day:focus-visible { outline-offset: -4px; }

.forecast { display: grid; gap: 14px; touch-action: pan-y pinch-zoom; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 2px 7px #102c3508; }
.overview, .tides, .notice { padding: 21px 23px; }
.overview-heading, .tides-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.date { color: var(--muted); font-size: .875rem; margin-bottom: 5px; }
.date::first-letter { text-transform: uppercase; }
.trend { flex: none; border-radius: 100px; padding: 7px 11px; color: #0b5d57; background: #e5f4ef; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.trend.falling { color: #954331; background: #f9ece7; }
.trend.steady { background: #edf2f2; color: var(--muted); }
.trend:empty { display: none; }
.current { display: grid; grid-template-columns: minmax(125px, 1fr) minmax(250px, 2fr); gap: 18px; align-items: center; margin-top: 19px; }
.level { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5px; }
.level-value { font-size: clamp(2.3rem, 7vw, 3.1rem); letter-spacing: -.07em; font-weight: 760; line-height: 1.04; font-variant-numeric: tabular-nums; }
.level-unit { font-size: 1.2rem; font-weight: 650; }
.level .muted { width: 100%; margin-top: 3px; }
.muted { color: var(--muted); font-size: .875rem; }
.cycle-track { position: relative; height: 6px; margin: 4px 5px 12px; background: #dbece9; border-radius: 10px; }
.cycle-fill { position: absolute; left: 0; top: 0; height: 6px; border-radius: 8px; background: #238c86; }
.cycle-marker { position: absolute; left: 0; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); background: #086a70; border: 2px solid var(--white); box-shadow: 0 0 0 1px #086a70; }
.neighbors { display: flex; justify-content: space-between; gap: 10px; }
.neighbor { display: grid; gap: 2px; font-size: .875rem; color: var(--muted); }
.neighbor:last-child { text-align: end; }
.neighbor strong { color: var(--ink); font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.neighbor:last-child .event-heading { justify-content: flex-end; }
.day-summary { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-top: 16px; }
.day-metric { display: grid; gap: 3px; }
.day-metric strong { font-size: 1.3rem; }

.tides-heading .muted { text-align: end; }
.tides-heading .chart-station { margin-top: 4px; text-align: start; }
.chart { margin-top: 14px; }
.chart-wrap { width: 100%; height: 254px; position: relative; }
#chart { display: block; width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 17px; margin: 3px 0 12px 4px; color: var(--muted); font-size: .875rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.high { background: var(--high); }
.legend-dot.low { background: var(--low); }
.legend-line { display: inline-block; height: 13px; border-left: 2px dashed #476970; }
.legend .sun-times { margin-left: auto; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-row { display: grid; grid-template-columns: 1fr auto 70px; gap: 10px; align-items: center; padding: 10px 1px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.event-heading { display: inline-flex; align-items: center; gap: 7px; }
.event-symbol { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.event-symbol.high { border-bottom: 7px solid var(--high); }
.event-symbol.low { border-top: 7px solid var(--low); }
.event-height { text-align: end; font-weight: 750; }
.event-time { font-weight: 650; }
.no-events { padding: 12px 0 0; }
.footer { display: flex; flex-wrap: wrap; gap: 5px 14px; padding: 2px 4px; color: var(--muted); font-size: .875rem; }
.attribution { flex-basis: 100%; line-height: 1.45; font-size: .8rem; }

.notice { min-height: 145px; }
.notice p { margin-bottom: 13px; }
.notice .secondary-button { margin-inline-end: 6px; }
.place-dialog { width: min(100% - 26px, 420px); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 80px #102c3540; }
.place-dialog::backdrop { background: #0c283666; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.dialog-body { display: grid; gap: 12px; padding: 0 18px 18px; }
.clear-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 1.55rem; }
.clear-button:hover { background: #edf4f3; }
.primary-button, .secondary-button { padding: 9px 13px; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: white; font-weight: 650; }
.primary-button { background: #0b5962; color: white; border-color: #0b5962; }
.primary-button:not(:disabled):hover { background: #074b54; }
.coordinates { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fields label { display: grid; gap: 5px; color: var(--muted); font-size: .875rem; }
.fields input { min-width: 0; width: 100%; min-height: 44px; padding: 9px; border: 1px solid #b4c7c6; border-radius: 9px; color: var(--ink); font-size: 1rem; }
.place-status { color: #954331; font-size: .875rem; }

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 880px); padding-top: 15px; }
  .masthead { margin-bottom: 16px; }
  .brand { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .place-button { font-size: .875rem; padding-inline: 8px; gap: 6px; }
  .calendar { margin-bottom: 12px; gap: 5px; grid-template-columns: 37px minmax(0, 1fr) 37px; }
  .days { grid-auto-columns: minmax(63px, 1fr); gap: 4px; }
  .day { min-height: 51px; }
  .overview, .tides, .notice { padding: 15px 13px; }
  .forecast { gap: 10px; }
  .overview-heading { align-items: start; }
  .trend { margin-top: 2px; font-size: .8125rem; padding-inline: 8px; }
  .current { grid-template-columns: minmax(0, 1fr); gap: 11px; margin-top: 12px; }
  .level .muted { width: auto; margin: 0 0 0 4px; }
  .cycle-track { margin-bottom: 9px; }
  .chart-wrap { height: 208px; }
  .legend .sun-times { margin-left: 0; }
  .event-row { padding-block: 9px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
