/* Porto Seguro — roteiro
   Paleta: areia + tinta do mar + urucum. Escala de espaço base 4px. */

:root {
  --paper: oklch(98.5% 0.006 200);
  --paper-2: oklch(95.5% 0.014 200);
  --ink: oklch(25% 0.035 235);
  --ink-2: oklch(42% 0.03 235);
  --line: oklch(89% 0.014 215);
  --sea: oklch(46% 0.085 210);
  --sea-tint: oklch(92% 0.03 205);
  --urucum: oklch(54% 0.15 38);
  --urucum-tint: oklch(93% 0.04 45);
  --focus: oklch(55% 0.14 210);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius: 12px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --f-display: "Figtree", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, sans-serif;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--s4);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s5));
}

::selection { background: var(--urucum-tint); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
a { color: var(--sea); text-underline-offset: 3px; }
strong, b { font-weight: 600; }

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding-left: max(var(--s4), env(safe-area-inset-left));
  padding-right: max(var(--s4), env(safe-area-inset-right));
}

h1, h2, h3 { text-wrap: balance; margin: 0; }
p, dd, li { text-wrap: pretty; }
p, dd, .plan span { max-width: 34em; }

/* ---------- Masthead ---------- */
.masthead {
  padding-top: env(safe-area-inset-top);
  padding-bottom: var(--s6);
  border-bottom: 1px solid var(--line);
}
.masthead h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.75rem, 13vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.dates { margin: var(--s3) 0 0; color: var(--ink-2); }
.status {
  margin: var(--s5) 0 0;
  font-size: 1.125rem;
}
.jump[hidden] { display: none; }
.status strong { color: var(--urucum); font-weight: 600; }
.jump {
  display: inline-flex; align-items: center;
  min-height: 44px; margin-top: var(--s3);
  padding: 0 var(--s4);
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  text-decoration: none; font-weight: 600;
}

/* ---------- Seções ---------- */
.block { padding: var(--s7) 0 var(--s5); }
.block + .block { border-top: 1px solid var(--line); }
.block h2 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(1.875rem, 8vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.lede { margin: var(--s3) 0 var(--s6); color: var(--ink-2); max-width: 60ch; }
.sub {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.375rem;
  margin: var(--s7) 0 var(--s3);
}
.small { font-size: 0.9375rem; color: var(--ink-2); margin: var(--s2) 0 var(--s4); }

/* ---------- Dias ---------- */
.days-tools {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-bottom: var(--s3);
}
.wx-stamp { margin: 0; font-size: 0.8125rem; color: var(--ink-2); }
.toggle-all {
  margin-left: auto;
  min-height: 44px; padding: 0 var(--s4);
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 0.9375rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}

.days { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.day { border-top: 1px solid var(--line); scroll-margin-top: var(--s4); }

.day summary {
  display: grid;
  grid-template-columns: 3.25rem 1fr 24px;
  gap: var(--s3);
  align-items: center;
  padding: var(--s4) 0;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.day summary::-webkit-details-marker { display: none; }
.sum-main { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.sum-title { font-size: 1.125rem; line-height: 1.25; font-weight: 600; text-wrap: balance; }
.day summary .meta { margin: 0; }
.chev { width: 24px; height: 24px; color: var(--ink-2); transition: transform 200ms var(--ease); }
.day details[open] .chev { transform: rotate(180deg); }

.day-body { padding: 0 0 var(--s5); }
.day details[open] .day-body { animation: reveal 280ms var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.day-date { display: flex; flex-direction: column; align-items: flex-start; }
.dnum {
  font-family: var(--f-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 2.25rem;
  line-height: 1;
}
.dwk { font-size: 0.875rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin-top: var(--s1); }
.meta { display: flex; flex-wrap: wrap; gap: var(--s2); font-size: 0.8125rem; }
.wx-chip {
  display: inline-flex; align-items: center;
  padding: 2px var(--s2);
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink);
}
.wx-chip[hidden] { display: none; }

/* Previsão do dia */
.wx-day {
  margin: 0 0 var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}
.wx-day[hidden] { display: none; }
.wx-day p { margin: 0; }
.wx-day .wx-bits { color: var(--ink-2); margin-top: var(--s1); }
.wx-now { margin: var(--s2) 0 0; color: var(--ink-2); }
.wx-now[hidden] { display: none; }

/* Fotos */
.photo { margin: 0; }
.photo img, .hero img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: var(--radius);
  background: var(--paper-2);
}
.photo figcaption { margin-top: var(--s1); font-size: 0.75rem; color: var(--ink-2); }
.photo figcaption a { color: inherit; }
.day-photo { margin: 0 0 var(--s4); }
.day-photo.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.day-photo.two img { aspect-ratio: 1 / 1; }
.place-photo { margin-bottom: var(--s3); }
.spot-photo { margin: var(--s2) 0 var(--s2); }
.spot-photo img { aspect-ratio: 16 / 9; }

.hero { margin: 0 0 var(--s5); }
.hero img { border-radius: 0; aspect-ratio: 16 / 10; max-height: 46vh; }
.hero figcaption { padding: 0 var(--s4); }

.credits { padding: var(--s6) 0 var(--s5); border-top: 1px solid var(--line); }
.credits .sub { margin-top: 0; }
.credits ul { max-width: 34em; margin: 0; padding-left: var(--s4); font-size: 0.8125rem; color: var(--ink-2); }
.credits li { margin-bottom: var(--s1); }
.credits a { color: inherit; }
.pace, .tide {
  display: inline-flex; align-items: center;
  padding: 2px var(--s2);
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.long .pace { border-color: var(--urucum); color: var(--urucum); font-weight: 600; }
.tide { background: var(--sea-tint); border-color: transparent; color: var(--ink); }

.plan { list-style: none; margin: 0; padding: 0; }
.plan li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: var(--s3);
  padding: var(--s2) 0;
}
.plan time { font-weight: 600; font-size: 0.9375rem; color: var(--ink-2); padding-top: 1px; }
.plan .map { white-space: nowrap; }
.plan .map::before { content: "→ "; }

.note {
  margin: var(--s4) 0 0;
  padding: var(--s3) var(--s4);
  background: var(--paper-2);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

/* Alternativas do dia */
.alts {
  margin-top: var(--s5);
  padding: var(--s4);
  background: var(--sea-tint);
  border-radius: var(--radius);
}
.alts h4 {
  margin: 0 0 var(--s2);
  font-size: 0.9375rem; font-weight: 800;
  color: var(--sea);
}
.alts ul { list-style: none; margin: 0; padding: 0; }
.alts li { padding: var(--s2) 0; font-size: 0.9688rem; }
.alts li + li { border-top: 1px solid oklch(85% 0.03 205); }
.alts .map { white-space: nowrap; }
.alts .map::before { content: "→ "; }

/* Hoje */
.day.is-today summary .dnum { color: var(--urucum); }
.day.is-today .dwk::after { content: " · hoje"; color: var(--urucum); font-weight: 600; }
.day.is-past summary { opacity: 0.55; }

/* Marés */
.table-wrap { overflow-x: auto; }
.tides { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.tides th, .tides td { text-align: left; padding: var(--s2) var(--s3) var(--s2) 0; border-bottom: 1px solid var(--line); }
.tides th { font-weight: 600; color: var(--ink-2); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Praias ---------- */
.places { list-style: none; margin: 0; padding: 0; }
.places li { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.places li:first-child { border-top: 0; padding-top: 0; }
.place-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.places h3 { font-size: 1.1875rem; font-weight: 600; }
.dist { font-size: 0.875rem; color: var(--ink-2); }
.places p { margin: var(--s1) 0 var(--s2); }
.places .map {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 44px;
  font-weight: 600; text-decoration: none;
}
.places .map svg { width: 20px; height: 20px; }

/* ---------- Comer ---------- */
.filter { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.chip {
  min-height: 44px; padding: 0 var(--s4);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.town {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.25rem;
  margin: var(--s6) 0 var(--s2);
}
.eats { list-style: none; margin: 0; padding: 0; }
.eats li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "tier map" "name map" "desc desc";
  column-gap: var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}
.eats li:first-child { border-top: 0; }
.eats .tier { grid-area: tier; justify-self: start; }
.eats strong { grid-area: name; font-size: 1.0625rem; margin-top: var(--s1); }
.eats p { grid-area: desc; margin: var(--s1) 0 0; color: var(--ink-2); font-size: 0.9688rem; }
.eats .map {
  grid-area: map; align-self: center;
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: flex-end;
  font-weight: 600; font-size: 0.9375rem;
}
.eats li[hidden] { display: none; }

.tier {
  display: inline-block;
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.03em;
  padding: 1px var(--s2);
  border-radius: 6px;
}
.tier.cb { background: var(--sea-tint); color: var(--ink); }
.tier.sp { background: var(--urucum-tint); color: var(--ink); }

/* ---------- Definições ---------- */
.defs { margin: 0; }
.defs dt {
  font-weight: 600;
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
}
.defs dt:first-child { border-top: 0; padding-top: 0; }
.defs dt .map { font-size: 0.9375rem; min-height: 32px; display: inline-flex; align-items: center; }
.defs dd { margin: var(--s1) 0 var(--s3); color: var(--ink-2); }

/* ---------- Checklist ---------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks label {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--s3);
  align-items: start;
  min-height: 44px;
  padding: var(--s2) 0;
  cursor: pointer;
}
.checks input {
  appearance: none;
  width: 24px; height: 24px; margin: 1px 0 0;
  border: 2px solid var(--ink-2);
  border-radius: 6px;
  display: grid; place-content: center;
  background: transparent;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.checks input::after {
  content: "";
  width: 12px; height: 7px;
  border-left: 2.5px solid var(--paper);
  border-bottom: 2.5px solid var(--paper);
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  margin-top: -3px;
  transition: transform 150ms var(--ease);
}
.checks input:checked { background: var(--sea); border-color: var(--sea); }
.checks input:checked::after { transform: rotate(-45deg) scale(1); }
.checks input:checked + span { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--line); }

.reset {
  margin-top: var(--s5);
  min-height: 44px; padding: 0 var(--s4);
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 0.9375rem; cursor: pointer;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px oklch(25% 0.035 235 / 0.07);
  z-index: 10;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 48px;
  color: var(--ink-2); text-decoration: none;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tabbar .ico {
  display: grid; place-items: center;
  width: 56px; height: 30px;
  border-radius: 999px;
  transition: background-color 200ms var(--ease), transform 150ms var(--ease);
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar a:active .ico { transform: scale(0.92); }
.tabbar a.is-active { color: var(--ink); }
.tabbar a.is-active .ico { background: var(--urucum-tint); color: var(--urucum); }
.tabbar a:focus-visible { outline: none; }
.tabbar a:focus-visible .ico { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (min-width: 768px) {
  body { font-size: 1.125rem; }
  .day summary { grid-template-columns: 4.5rem 1fr 24px; gap: var(--s4); }
  .day-body { padding-left: calc(4.5rem + var(--s4)); }
  .dnum { font-size: 2.75rem; }
  .hero img { aspect-ratio: 21 / 9; }
  .plan li { grid-template-columns: 4rem 1fr; }
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: min(32rem, 100%); bottom: var(--s4); border: 1px solid var(--line); border-radius: 16px; height: var(--nav-h); padding-bottom: 0; box-shadow: 0 6px 24px oklch(20% 0.03 235 / 0.12); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
