:root {
  color-scheme: dark;
  --base: #090f1b;
  --panel: #111d2e;
  --line: #35455c;
  --ink: #f6f2e9;
  --muted: #b3c2d4;
  --gold: #ffd180;
  font-family: Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 46px);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 4%, #1e324d 0%, #111e31 37%, transparent 68%),
    var(--base);
}

.directory {
  width: min(100%, 1040px);
}

.brand {
  display: grid;
  justify-items: center;
  text-align: center;
}
.route-art {
  position: relative;
  width: min(300px, 72vw);
  aspect-ratio: 2 / 1;
  margin: 0 auto 6px;
}
.route-map {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(1.78) saturate(1.12) drop-shadow(0 8px 26px #070c15b3);
}
h1 {
  margin: 0;
  font: 600 clamp(2rem, 7.1vw, 4.6rem)/1.03 Georgia, serif;
  letter-spacing: -.057em;
  text-wrap: balance;
}
.brand p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(.9rem, 2.3vw, 1.12rem);
  line-height: 1.45;
  text-wrap: balance;
}
.brand::after {
  content: "";
  display: block;
  width: 62px;
  height: 2px;
  margin-top: clamp(14px, 2.5vh, 25px);
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.1vw, 24px);
  margin-top: clamp(16px, 3.3vh, 34px);
}
.choice-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: clamp(250px, 35vh, 352px);
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    linear-gradient(180deg, #101c2ff2 8%, #111e32e8 36%, #0a1322e8),
    var(--group-photo) center / cover,
    var(--panel);
  box-shadow: 0 14px 48px #02071060;
}
.choice-group--federal { --group-photo: url('mapa-federal-fundo.webp'); }
.choice-group--local { --group-photo: url('mapa-lagos-fundo.webp'); }
.choice-group h2 {
  margin: 0;
  color: var(--ink);
  font: 800 clamp(1.38rem, 3vw, 2rem)/1 'Barlow Condensed', Impact, system-ui, sans-serif;
  letter-spacing: .015em;
}
.choice-group p {
  margin: 5px 0 clamp(10px, 2vh, 16px);
  color: var(--muted);
  font-size: .83rem;
}
.choice-list {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.choice-group--federal .choice-list { grid-template-rows: minmax(86px, 1.6fr) minmax(54px, 1fr); }
.choice {
  position: relative;
  min-width: 0;
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: end;
  flex-direction: column;
  gap: 9px;
  padding: 9px 5px;
  color: var(--ink);
  border: 1px solid #8294ae8f;
  border-radius: 11px;
  background-color: var(--panel);
  background-image: linear-gradient(0deg, #08111cf5 3%, #0a1525a3 45%, #08111c20 84%), var(--tile-photo);
  background-position: center, var(--tile-position, center);
  background-size: cover;
  font: 800 clamp(.8rem, 1.75vw, 1.03rem)/1.15 Inter, system-ui, sans-serif;
  text-shadow: 0 1px 6px #000;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.choice:hover {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px #ffd18042;
}
.choice-group--federal .choice { color: #ffe0a6; }
.choice--pf { --tile-photo: url('mapa-operacional-pf.webp'); --tile-position: center 65%; }
.choice--prf { --tile-photo: url('mapa-operacional-prf.webp'); --tile-position: center 69%; }
.choice--combined {
  --tile-photo: url('mapa-operacional-combinado.webp');
  --tile-position: center 31%;
  grid-column: 1 / -1;
}
.choice--saquarema { --tile-photo: url('saquarema-turismo-nazare.webp'); --tile-position: center 56%; }
.choice--arraial { --tile-photo: url('arraial-turismo-pontal.webp'); --tile-position: 61% center; }
.choice--arraial img { border-radius: 4px; }
.choice-list--local .choice { padding-bottom: clamp(14px, 3vh, 24px); }
.choice img {
  width: clamp(30px, 5vw, 48px);
  height: clamp(30px, 5vw, 48px);
  object-fit: contain;
  filter: drop-shadow(0 2px 4px #000b);
}
.choice span { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

dialog {
  width: min(calc(100% - 28px), 550px);
  max-height: min(86svh, 640px);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(16px, 4vw, 28px);
  box-shadow: 0 32px 64px #02060cb3;
}
dialog::backdrop { background: #030911bf; }
dialog[data-course] {
  background: linear-gradient(90deg,#0b1628fa,#0b1628e8 58%,#0b16288c),
    var(--dialog-photo, none) center 47% / cover, var(--panel);
}
dialog[data-course="saquarema"] { --dialog-photo: url('saquarema-turismo-nazare.webp'); }
dialog[data-course="arraial"] { --dialog-photo: url('arraial-turismo-pontal.webp'); }
dialog[data-course="pf"] { --dialog-photo: url('mapa-operacional-pf.webp'); }
dialog[data-course="prf"] { --dialog-photo: url('mapa-operacional-prf.webp'); }
dialog[data-course="combined"] { --dialog-photo: url('mapa-operacional-combinado.webp'); }
dialog header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
dialog h2 { font: 800 clamp(1.55rem,4vw,2.2rem)/1.05 'Barlow Condensed', Impact, system-ui,sans-serif; margin: 3px 0 0; }
.close {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 11px;
  border: 1px solid #62728a;
  border-radius: 8px;
  color: var(--muted);
  background: #0a1323ba;
  font: 700 .84rem/1 system-ui,sans-serif;
  cursor: pointer;
}
.close:hover { color: var(--gold); border-color: var(--gold); }
.objectives { display: grid; gap: 8px; margin: 17px 0 0; padding: 0; list-style: none; }
.objectives a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: center;
  min-height: 65px;
  padding: 11px 13px;
  color: var(--ink);
  background: #091324d6;
  border: 1px solid #657897a3;
  border-radius: 9px;
  text-decoration: none;
}
.objectives a::after { content: "→"; grid-column: 2; grid-row: 1 / 3; color: var(--gold); font-size: 1.1rem; }
.objectives a:hover { border-color: var(--gold); }
.objectives span { color: var(--muted); font-size: .82rem; }
.tourism-credits:not([hidden]) { display: inline-block; margin-top: 12px; color: var(--gold); font-size: .76rem; text-underline-offset: 3px; }
.photo-credit-page {
  width: min(100%, 760px);
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.photo-credit-page h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
.photo-credit-page img { display: block; width: 100%; height: auto; margin: 16px 0; border-radius: 10px; }
.photo-credit-page p { color: var(--muted); }
.photo-credit-page a { color: var(--gold); }

@media (max-width: 550px) {
  body { padding: 12px; }
  .route-art { width: min(185px, 52vw); margin-bottom: 4px; }
  .brand p { margin-top: 7px; }
  .brand::after { margin-top: 12px; }
  .choices { gap: 8px; margin-top: 13px; }
  .choice-group { min-height: clamp(202px, 31svh, 240px); padding: 8px; border-radius: 12px; }
  .choice-group h2 { font-size: clamp(1.15rem, 4vw, 1.55rem); }
  .choice-group p { margin: 4px 0 8px; font-size: .7rem; line-height: 1.2; }
  .choice-list { gap: 5px; }
  .choice-group--federal .choice-list { grid-template-rows: minmax(74px, 1.45fr) minmax(46px, 1fr); }
  .choice { min-height: 46px; padding: 6px 3px; font-size: clamp(.67rem, 3.15vw, .88rem); border-radius: 8px; }
  .choice-list--local { grid-template-columns: 1fr; }
  .choice-list--local .choice { justify-content: center; flex-direction: row; padding: 5px; gap: 5px; }
  .choice img { width: 23px; height: 23px; }
}

@media (max-width: 550px) and (orientation: portrait) {
  body { align-items: start; padding-top: clamp(28px, 14svh, 105px); }
}

@media (max-height: 500px) and (orientation: landscape) {
  body { padding-block: 8px; }
  .route-art { width: 108px; margin-bottom: 2px; }
  h1 { font-size: clamp(1.85rem,5vw,2.7rem); }
  .brand p { margin-top: 5px; }
  .brand::after { margin-top: 9px; }
  .choices { margin-top: 12px; }
  .choice-group { min-height: 174px; padding: 8px; }
  .choice-group--federal .choice-list { grid-template-rows: minmax(55px,1.45fr) minmax(44px,1fr); }
  .choice { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .choice { transition: none; } }
