:root {
  --night: #08131c;
  --noon: #10293a;
  --ink: #eef5f6;
  --soft: rgba(238, 245, 246, 0.6);
  --line: rgba(238, 245, 246, 0.14);
  --accent: #63d6c6;
  --warm: #f1c27d;
}

/* The stage is sized on width AND height, so the whole page fits the phone box at every point of the scroll. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--night); }
body {
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.viaggio { position: relative; height: 500vh; }
.palco {
  --day: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: clamp(10px, 3vh, 34px) clamp(14px, 4vw, 48px);
  /* the sky: night at both ends of the day, a deeper blue around noon */
  background:
    radial-gradient(120% 70% at 50% -10%, color-mix(in srgb, var(--accent) calc(var(--day) * 16%), transparent), transparent 70%),
    color-mix(in srgb, var(--noon) calc(var(--day) * 100%), var(--night));
}
@supports (height: 100lvh) { .palco { height: 100lvh; } }

.tide { width: min(940px, 100%); height: 100%; max-height: 660px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(70px, 1fr) auto; gap: clamp(6px, 1.800vh, 18px); }

.tide__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 640; }
.tide__place { display: flex; align-items: center; gap: 8px; font-stretch: 106%; letter-spacing: 0.01em; white-space: nowrap; }
.tide__place svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.500; stroke-linecap: round; }
.tide__day { color: var(--soft); font-weight: 580; }
.tide__roll { display: block; overflow: hidden; }
.tide__roll > span { display: block; white-space: nowrap; }

.tide__read { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tide__now { display: flex; flex-direction: column; gap: clamp(2px, 0.800vh, 8px); min-width: 0; }
/* the digits get heavier as the water rises (--w is set from the height) */
.tide__time { --w: 560; font-size: clamp(38px, min(13vw, 11vh), 84px); line-height: 0.92; font-variation-settings: "wght" var(--w), "wdth" 108; letter-spacing: -0.03em; }
.tide__trend { display: flex; align-items: center; gap: 7px; font-size: clamp(13px, 2.200vh, 15px); font-weight: 660; color: var(--accent); }
.tide__arrow { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.tide__trend .tide__roll { height: 1.3em; line-height: 1.3; }
.tide__level { display: flex; align-items: flex-end; gap: clamp(10px, 2vw, 18px); }
.tide__height { display: flex; align-items: baseline; gap: 4px; padding-bottom: 2px; }
.tide__height b { font-size: clamp(22px, min(7vw, 6vh), 40px); font-weight: 700; font-stretch: 106%; letter-spacing: -0.02em; }
.tide__height i { font-style: normal; font-size: 13px; font-weight: 620; color: var(--soft); }
.tide__glass { width: clamp(42px, min(13vw, 12vh), 66px); height: auto; aspect-ratio: 56 / 72; flex: none; overflow: visible; }
.tide__water { fill: color-mix(in srgb, var(--accent) 26%, transparent); }
.tide__skin { fill: none; stroke: var(--accent); stroke-width: 1.600; stroke-linecap: round; }
.tide__staff path { fill: none; stroke: var(--soft); stroke-width: 1; stroke-linecap: round; }
.tide__rim { fill: none; stroke: rgba(238, 245, 246, 0.26); stroke-width: 1.200; }

.tide__chart { position: relative; min-height: 0; }
.tide__chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tide__night { fill: rgba(3, 8, 13, 0.34); }
.tide__ticks line { stroke: var(--line); stroke-width: 1; }
.tide__ticks text { fill: var(--soft); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.tide__ghost { fill: none; stroke: rgba(238, 245, 246, 0.2); stroke-width: 1.500; stroke-dasharray: 2 5; stroke-linecap: round; }
.tide__line { fill: none; stroke: var(--accent); stroke-width: 2.200; stroke-linecap: round; stroke-linejoin: round; }
.tide__area { fill: url(#fill); }
.tide__caps line { stroke: var(--soft); stroke-width: 1.500; stroke-linecap: round; transition: stroke 0.3s ease; }
.tide__caps line.is-past { stroke: var(--ink); }
.tide__drop { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.7; }
.tide__dot { fill: var(--night); stroke: var(--accent); stroke-width: 2.200; }
.tide__sun { position: absolute; top: 0; font-size: 10px; font-weight: 640; letter-spacing: 0.02em; color: var(--warm); white-space: nowrap; opacity: 0.85; }
.tide__sun[data-sunrise] { padding-left: 6px; border-left: 1px solid color-mix(in srgb, var(--warm) 60%, transparent); }
.tide__sun[data-sunset] { padding-right: 6px; border-right: 1px solid color-mix(in srgb, var(--warm) 60%, transparent); transform: translateX(-100%); }

/* the four waters of the day: passed ones dim, the next one carries the time left */
.tide__list { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tide__item { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 8px; height: clamp(36px, 9.500vh, 58px); padding: 0 11px 0 9px; border-radius: 13px; background: rgba(238, 245, 246, 0.05); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease; }
.tide__item svg { width: 16px; height: 16px; fill: none; stroke: var(--soft); stroke-width: 1.700; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.3s ease; }
.tide__item b { display: block; font-size: 12.5px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tide__item small { display: block; font-size: 10.5px; font-weight: 580; color: var(--soft); white-space: nowrap; }
.tide__item small:empty { display: none; }
.tide__item em { font-style: normal; font-size: 12.5px; font-weight: 640; color: var(--soft); white-space: nowrap; }
.tide__item.is-past { opacity: 0.5; }
.tide__item.is-next { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); }
.tide__item.is-next svg { stroke: var(--accent); }
.tide__item.is-next small { color: var(--accent); }

@media (min-width: 720px) {
  .tide__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .tide__item { padding: 0 14px 0 12px; border-radius: 15px; }
  .tide__item b { font-size: 13.5px; }
  .tide__ticks text { font-size: 11.5px; }
  .tide__sun { font-size: 11px; }
  .tide__head { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .tide__item, .tide__caps line { transition: none; }
}
