/* Tidekeeper website. Colours follow the app's palette (Tides/Design/Palette.swift):
   the page runs from the day's sky, through the water, into the night. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --sky: #EEF3F1;
  --ink: #0F3B4C;
  --ink-soft: #48636C;
  --now: #B4237A;
  --water-top: #2F8292;
  --water: #1A5566;
  --deep: #0F3742;
  --foam: #E8F1F2;
  --foam-soft: #B9CDD2;
  --sand: #E6DCC8;
  --night-top: #14284A;
  --night: #050B1A;
  --moon-now: #FF7CC4;
  --rule: rgba(15, 59, 76, 0.14);

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 64px);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky: #08161F;
    --ink: #E8F1F2;
    --ink-soft: #93AAB2;
    --now: #FF7CC4;
    --water-top: #1E6170;
    --water: #134652;
    --deep: #0B2C36;
    --rule: rgba(232, 241, 242, 0.14);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--now); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px;
  background: var(--ink); color: var(--sky); padding: 8px 14px; border-radius: 8px; z-index: 10;
}
.skip:focus { top: 12px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* Header */

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 22px; padding-bottom: 22px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font: 700 1.3rem/1 var(--display); letter-spacing: -0.015em; text-decoration: none;
}
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.site-header nav { display: flex; gap: 22px; font-size: 0.98rem; }
.site-header nav a { text-decoration: none; color: var(--ink-soft); }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--ink); text-decoration: underline; }

/* Hero: the day */

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  padding-top: clamp(24px, 6vw, 72px);
}
.hero h1 { font-size: clamp(2.6rem, 5.6vw, 4.7rem); font-weight: 750; }
.hero .lede { margin-top: 28px; max-width: var(--measure); font-size: 1.2rem; color: var(--ink-soft); }
.availability {
  margin-top: 36px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 20px 12px 14px;
  border: 1.5px solid var(--ink); border-radius: 999px;
  font-weight: 600;
}
.availability svg { width: 22px; height: 22px; flex: none; }
.availability-note { margin-top: 14px; color: var(--ink-soft); font-size: 0.95rem; }

.phone { position: relative; max-width: 300px; margin: 0 auto; }
.phone img {
  width: 100%;
  border-radius: 13.6% / 6.3%;
  box-shadow: 0 0 0 7px #0C1E27, 0 40px 70px -30px rgba(5, 25, 35, 0.55);
}
.hero .phone { max-width: 320px; margin-bottom: -150px; position: relative; z-index: 2; }

/* The tide band: today's curve with "now" at the visitor's own time of day */

.tideband { position: relative; margin-top: clamp(-40px, -2vw, 0px); }
.tideband svg { display: block; width: 100%; height: clamp(170px, 22vw, 300px); }
.tideband .water { fill: url(#water); }
.tideband .surface { fill: none; stroke: var(--sky); stroke-width: 3; vector-effect: non-scaling-stroke; opacity: 0.85; }
.tideband .crest { fill: none; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

.now-line { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; visibility: hidden; }
.now-line.is-set { visibility: visible; }
.now-line::before {
  content: ""; position: absolute; left: -1.5px; top: 46px; bottom: 0; width: 3px; background: var(--now);
}
.now-dot {
  position: absolute; left: -10px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--now); box-shadow: 0 0 0 3px var(--sky);
}
.now-label {
  position: absolute; top: 4px; transform: translateX(-50%);
  font: 700 0.95rem/1 var(--display); color: var(--now); white-space: nowrap;
  background: var(--sky); border: 1.5px solid currentColor; border-radius: 999px; padding: 8px 12px;
}

@media (prefers-reduced-motion: no-preference) {
  .tideband .tide { clip-path: inset(0 100% 0 0); animation: flood 1.6s cubic-bezier(.3,.7,.2,1) 0.15s forwards; }
  .now-line.is-set { animation: rise 0.6s ease-out 1.5s backwards; }
  @keyframes flood { to { clip-path: inset(0 0 0 0); } }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}

/* The water: what the app does */

.water-section {
  background: linear-gradient(var(--water), var(--deep));
  color: var(--foam);
  padding: 40px 0 clamp(80px, 10vw, 140px);
}
.water-section .hours {
  display: flex; justify-content: space-between;
  font: 500 0.85rem/1 var(--display); color: var(--foam-soft); opacity: 0.8;
  padding: 0 1.5%;
}
.water-section h2 { font-size: clamp(2rem, 4.4vw, 3.4rem); max-width: 18ch; }
.water-section .intro { padding-top: clamp(56px, 8vw, 110px); }
.water-section .intro p { margin-top: 20px; max-width: var(--measure); color: var(--foam-soft); font-size: 1.15rem; }

.showcase {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center; gap: clamp(32px, 7vw, 110px);
  margin-top: clamp(64px, 9vw, 120px);
}
.showcase.flip { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
.showcase.flip .phone { order: 2; }
.showcase h3 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.showcase p { margin-top: 16px; max-width: var(--measure); color: var(--foam-soft); font-size: 1.1rem; }
.showcase .phone img { box-shadow: 0 0 0 7px #071A21, 0 40px 70px -30px rgba(0, 0, 0, 0.6); }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 8px 56px; margin: clamp(80px, 10vw, 130px) 0 0; padding: 0;
}
.facts div { padding: 22px 0; border-top: 1px solid rgba(232, 241, 242, 0.18); }
.facts dt { font: 650 1.2rem/1.2 var(--display); letter-spacing: -0.01em; }
.facts dd { margin: 8px 0 0; color: var(--foam-soft); }

/* The night: sun, moon and privacy */

.night-section {
  position: relative; color: var(--foam);
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 28% 42%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 47% 12%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1px 1px at 63% 30%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 78% 8%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 88% 36%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 6% 66%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 70%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1px 1px at 38% 80%, rgba(255,255,255,.4), transparent 60%),
    linear-gradient(var(--deep), var(--night-top) 22%, var(--night));
  padding: clamp(40px, 8vw, 100px) 0 0;
}
.night-section .showcase { margin-top: 0; }
.night-section .showcase p { color: #AEB6DA; }

.promise { margin-top: clamp(100px, 12vw, 160px); padding-bottom: clamp(80px, 10vw, 130px); max-width: 46rem; }
.promise h2 { font-size: clamp(2rem, 4.4vw, 3.4rem); }
.promise p { margin-top: 20px; color: #AEB6DA; font-size: 1.15rem; max-width: var(--measure); }
.promise a { color: var(--foam); }

/* Footer */

.site-footer { background: var(--night); color: #8F9BBF; font-size: 0.92rem; }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 40px;
  padding-top: 32px; padding-bottom: 40px; border-top: 1px solid rgba(174, 182, 218, 0.16);
}
.site-footer nav { display: flex; gap: 22px; }
.site-footer a { color: var(--foam); }
.site-footer .fine { flex-basis: 100%; max-width: 60rem; font-size: 0.82rem; color: #6F7BA0; }

/* Text pages: privacy policy and support */

.page { padding: clamp(32px, 7vw, 80px) 0 clamp(80px, 10vw, 120px); }
.page .wrap { max-width: calc(44rem + 2 * var(--gutter)); }
.page h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.page .updated { margin-top: 14px; color: var(--ink-soft); }
.page .summary {
  margin-top: 36px; padding: 22px 24px; border-radius: 16px;
  background: color-mix(in srgb, var(--water-top) 12%, var(--sky));
  border: 1px solid color-mix(in srgb, var(--water-top) 30%, transparent);
}
.page .summary p + p { margin-top: 10px; }
.page h2 { font-size: 1.6rem; margin-top: 52px; }
.page h3 { font-size: 1.2rem; margin-top: 34px; letter-spacing: -0.01em; }
.page p, .page ul { margin-top: 14px; }
.page ul { padding-left: 1.2em; }
.page li + li { margin-top: 8px; }
.page strong { font-weight: 650; }
.contact-line { font: 650 1.35rem/1.3 var(--display); }

.qa { margin-top: 20px; border-top: 1px solid var(--rule); }
.qa details { border-bottom: 1px solid var(--rule); }
.qa summary {
  cursor: pointer; list-style: none; padding: 20px 36px 20px 0; position: relative;
  font: 650 1.15rem/1.3 var(--display); letter-spacing: -0.01em;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.qa details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.qa details > :not(summary) { margin: 0 0 20px; color: var(--ink-soft); }
.qa details > p + p { margin-top: -8px; }

.page-footer { background: var(--deep); color: var(--foam-soft); }
.page-footer .wrap { border-top: none; }
.page-footer .fine { color: #8FB0B8; }

/* Narrow screens */

@media (max-width: 820px) {
  .hero .wrap, .showcase, .showcase.flip { grid-template-columns: 1fr; }
  .showcase.flip .phone { order: 0; }
  .hero .phone { max-width: 250px; margin-bottom: 28px; }
  .showcase .phone { max-width: 250px; }
  .water-section .intro { padding-top: 48px; }
  .water-section .hours span:nth-child(even) { display: none; }
}

@media (max-width: 480px) {
  .site-header nav { gap: 16px; }
  .brand { font-size: 1.15rem; }
  .brand img { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
