:root {
  color-scheme: light;
  --sand: #efe6d2;
  --salt: #f9f7f2;
  --ink: #16252c;
  --ocean: #031b2f;
  --lagoon: #0a3a5c;
  --sunset: #d59d66;
  --foam: #d3e3f0;
  --card: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 45px rgba(10, 35, 48, 0.18);
  --rope: #caa06b;
  --navy: #021322;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='140' viewBox='0 0 360 140'%3E%3Cpath d='M-20 70 C30 40 90 40 140 70 C190 100 250 100 300 70 C350 40 410 40 460 70' fill='none' stroke='%23031b2f' stroke-opacity='0.12' stroke-width='3'/%3E%3Cpath d='M-40 105 C10 78 70 78 120 105 C170 132 230 132 280 105 C330 78 390 78 440 105' fill='none' stroke='%230a3a5c' stroke-opacity='0.1' stroke-width='2'/%3E%3C/svg%3E") repeat,
    radial-gradient(circle at 15% 10%, rgba(3, 27, 47, 0.14), transparent 55%),
    radial-gradient(circle at 85% 0%, rgba(10, 58, 92, 0.14), transparent 50%),
    linear-gradient(180deg, #d9e3f1 0%, #e3d9c9 55%, #f1ece2 100%);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 28px 20px 48px;
}

.ambient {
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      160deg,
      rgba(3, 27, 47, 0.08) 0px,
      rgba(3, 27, 47, 0.08) 18px,
      rgba(255, 255, 255, 0) 18px,
      rgba(255, 255, 255, 0) 36px
    );
  mix-blend-mode: multiply;
  pointer-events: none;
}

.shell {
  width: min(980px, 100%);
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}


.hero {
  padding: 24px 28px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(11, 58, 77, 0.15);
  animation: slideDown 700ms ease both;
}

.brand {
  font-family: "Fraunces", "Georgia", serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ocean);
  margin-bottom: 10px;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 8px;
}

.hero p {
  font-size: 1.05rem;
  color: rgba(22, 37, 44, 0.8);
}

.controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.toggle-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.toggle {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(11, 42, 58, 0.25);
  background: rgba(255, 255, 255, 0.82);
  color: var(--navy);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.toggle.active {
  background: linear-gradient(120deg, var(--ocean), var(--lagoon));
  color: #fff;
  box-shadow: 0 16px 35px rgba(2, 19, 34, 0.25);
  border-color: transparent;
}

.geo-notice {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(2, 19, 34, 0.9);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 16px 35px rgba(2, 19, 34, 0.25);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.geo-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.controls.is-emphasized select,
.controls.is-emphasized input[type="search"] {
  animation: inflating 700ms ease-in-out 2;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1 1 220px;
}

.is-hidden {
  display: none;
}

.field span {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(22, 37, 44, 0.7);
}

select {
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(11, 42, 58, 0.2);
  background: var(--salt);
  font-size: 1rem;
  box-shadow: var(--shadow);
  outline: none;
}

input[type="search"] {
  padding: 13px 16px;
  border-radius: 18px;
  border: 1px solid rgba(11, 42, 58, 0.25);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), #efe6d6);
  font-size: 1rem;
  box-shadow: 0 16px 35px rgba(10, 35, 48, 0.16);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

input[type="search"]:focus {
  border-color: rgba(11, 58, 77, 0.6);
  box-shadow: 0 18px 38px rgba(11, 58, 77, 0.2);
  transform: translateY(-1px);
}

input[type="search"]::placeholder {
  color: rgba(22, 37, 44, 0.5);
}

.primary {
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, var(--ocean), var(--lagoon));
  color: white;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(11, 58, 77, 0.28);
}

.secondary {
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(11, 42, 58, 0.25);
  background: rgba(255, 255, 255, 0.82);
  color: var(--navy);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 35px rgba(11, 42, 58, 0.2);
}

.summary {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-card {
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(11, 58, 77, 0.12);
  animation: fadeUp 720ms ease both;
}

.summary-card .label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(22, 37, 44, 0.65);
}

.summary-card .value {
  margin-top: 8px;
  font-size: 1.2rem;
  font-weight: 600;
}

.list {
  display: grid;
  gap: 12px;
}

.graph-card {
  padding: 18px 18px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(11, 58, 77, 0.12);
  animation: fadeUp 720ms ease both;
  position: relative;
  overflow: hidden;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(22, 37, 44, 0.65);
  margin-bottom: 12px;
}

.graph-card .graph-svg {
  width: 100%;
  height: 280px;
  display: block;
}

.graph-card .graph-svg.mobile {
  display: none;
}

.graph-card .line {
  fill: none;
  stroke: var(--navy);
  stroke-width: 5.5;
}

.graph-card .line.base {
  opacity: 0.35;
}

.graph-card .line.rise {
  stroke: #1c7a5c;
  stroke-width: 5.5;
}

.graph-card .line.fall {
  stroke: #c4503a;
  stroke-width: 5.5;
}

.graph-card .area {
  stroke: none;
  opacity: 0.22;
}

.graph-card .area.rise {
  fill: rgba(28, 122, 92, 0.28);
}

.graph-card .area.fall {
  fill: rgba(196, 80, 58, 0.28);
}

.graph-card .midline {
  stroke: rgba(2, 19, 34, 0.22);
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.graph-tooltip {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(2, 19, 34, 0.9);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.3;
  box-shadow: 0 12px 30px rgba(2, 19, 34, 0.3);
  opacity: 0;
  transform: translate(0, 0);
  transition: opacity 160ms ease;
  pointer-events: none;
  white-space: nowrap;
}

.graph-tooltip.is-visible {
  opacity: 1;
}

.tide-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--salt);
  box-shadow: var(--shadow);
  border: 1px solid rgba(11, 58, 77, 0.08);
  animation: fadeUp 760ms ease both;
}

.tide-item .time {
  font-size: 1rem;
  font-weight: 600;
}

.tide-item .meta {
  font-size: 0.9rem;
  color: rgba(22, 37, 44, 0.65);
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.badge.high {
  background: rgba(47, 113, 136, 0.25);
  color: #0b3a4d;
}

.badge.low {
  background: rgba(213, 157, 102, 0.35);
  color: #6d4116;
}

.footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: rgba(22, 37, 44, 0.65);
  padding: 0 8px;
  border-top: 1px dashed rgba(202, 160, 107, 0.6);
  padding-top: 12px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes inflating {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(11, 58, 77, 0);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 12px 24px rgba(11, 58, 77, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(11, 58, 77, 0);
  }
}

@media (max-width: 720px) {
  body {
    padding: 12px 14px 24px;
    background: linear-gradient(180deg, #0b2a3a 0%, #3f6a85 45%, #f1ece2 100%);
  }

  .shell {
    gap: 8px;
    display: flex;
    flex-direction: column;
  }

  .hero {
    padding: 18px 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    text-align: left;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 7vw, 2.6rem);
  }

  .hero p {
    font-size: 1rem;
  }

  .ambient {
    display: none;
  }

  .controls {
    display: grid;
    gap: 8px;
    padding: 12px 12px 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 36px rgba(2, 19, 34, 0.16);
    border: 1px solid rgba(11, 58, 77, 0.1);
    margin-top: -6px;
  }

  .toggle-group {
    flex-direction: row;
    justify-content: stretch;
    gap: 8px;
  }

  .toggle {
    flex: 1 1 0;
    padding: 8px 14px;
    font-size: 0.88rem;
    text-align: center;
  }

  .field {
    width: 100%;
    gap: 6px;
  }

  .field span {
    margin-top: 0;
  }

  .field span {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
  }

  select,
  input[type="search"] {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 0.98rem;
    min-height: 46px;
  }

  select,
  input[type="search"],
  .primary,
  .secondary {
    width: 100%;
  }

  .primary,
  .secondary {
    padding: 12px 18px;
    font-size: 0.98rem;
    min-height: 46px;
  }

  .geo-notice {
    display: none;
    font-size: 0.88rem;
    padding: 10px 12px;
  }

  .geo-notice.is-visible {
    display: block;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .graph-card {
    padding: 12px 12px;
    border-radius: 18px;
    height: min(70vh, 520px);
  }

  .graph-card .graph-svg {
    height: 100%;
  }

  .graph-card .graph-svg.desktop {
    display: none;
  }

  .graph-card .graph-svg.mobile {
    display: block;
  }

  .graph {
    margin-bottom: 6px;
  }

  .hero {
    order: 1;
  }

  .graph {
    order: 2;
  }

  .controls {
    order: 3;
  }

  .summary {
    order: 4;
  }

  .list {
    order: 5;
  }

  .footer {
    order: 6;
  }

  .tide-item {
    padding: 14px 16px;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}
