:root {
  color-scheme: light dark;
  --bg: #f4f8f7;
  --surface: #ffffff;
  --surface-soft: #eaf3f1;
  --text: #152421;
  --muted: #5c6d68;
  --line: #cfddda;
  --brand: #0e766e;
  --brand-strong: #075d57;
  --accent: #c96d3a;
  --accent-soft: #fff0e5;
  --hero-text: #f9fffd;
  --shadow: 0 18px 50px rgb(13 53 48 / 10%);
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --shell: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071613;
    --surface: #0d211d;
    --surface-soft: #132e29;
    --text: #edf7f4;
    --muted: #a8bdb7;
    --line: #26443d;
    --brand: #70d3c8;
    --brand-strong: #99e4dc;
    --accent: #f2a36f;
    --accent-soft: #3a261d;
    --hero-text: #ffffff;
    --shadow: 0 18px 50px rgb(0 0 0 / 28%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.shell {
  width: min(calc(100% - 2rem), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--text);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.hero {
  position: relative;
  min-height: clamp(29rem, 68svh, 42rem);
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
  background: #0b4947;
}

.hero__image,
.hero__shade {
  position: absolute;
  inset: 0;
}

.hero__image {
  z-index: -2;
  background-image: url("assets/kaohsiung-harbor-hero.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.015);
}

.hero__shade {
  z-index: -1;
  background:
    linear-gradient(180deg, rgb(3 24 23 / 8%) 16%, rgb(3 24 23 / 84%) 100%),
    linear-gradient(90deg, rgb(2 28 26 / 60%), transparent 68%);
}

.hero__inner {
  padding-block: clamp(7rem, 16vw, 11rem) 3rem;
  color: var(--hero-text);
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  color: #d1fff8;
}

.hero h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 7.7rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.hero__lead {
  max-width: 34rem;
  margin: 1.25rem 0 0;
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.hero__facts span {
  padding: 0.42rem 0.8rem;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 999px;
  background: rgb(5 44 41 / 42%);
  font-size: 0.9rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.day-nav {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px);
}

.day-nav__inner {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-block: 0.65rem;
  scrollbar-width: none;
}

.day-nav__inner::-webkit-scrollbar {
  display: none;
}

.day-nav a {
  flex: 0 0 auto;
  padding: 0.48rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  text-decoration: none;
}

.day-nav a:hover,
.day-nav a:focus-visible {
  background: var(--surface-soft);
  color: var(--brand-strong);
}

.section-kicker {
  color: var(--accent);
}

h2,
h3,
p {
  overflow-wrap: anywhere;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.section-heading > p {
  margin: 0;
  color: var(--muted);
}

.status,
.error-card {
  margin: 3rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
}

.status__dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.25s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.section {
  padding: clamp(4rem, 9vw, 7rem) 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  gap: 2rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-heading > p {
  max-width: 31rem;
}

.map-link {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .map-link {
    color: #06211d;
  }
}

.map-link:hover {
  background: var(--brand-strong);
}

.map-link--place {
  border: 1px solid color-mix(in srgb, var(--brand) 55%, var(--line));
  background: var(--surface-soft);
  color: var(--brand-strong);
}

.map-link--place:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 16%, var(--surface));
}

.map-link::after {
  content: "↗";
}

.day-section + .day-section {
  margin-top: clamp(4rem, 8vw, 6rem);
}

.day-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.day-heading__badge {
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 850;
}

.day-heading h3 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  letter-spacing: -0.035em;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0.9rem;
}

.timeline::before {
  position: absolute;
  top: 1.5rem;
  bottom: 1.5rem;
  left: 6.7rem;
  width: 1px;
  background: var(--line);
  content: "";
}

.event-card {
  position: relative;
  display: grid;
  grid-template-columns: 5.8rem minmax(0, 1fr);
  gap: 2rem;
}

.event-card::before {
  position: absolute;
  top: 1.55rem;
  left: 6.43rem;
  width: 0.56rem;
  height: 0.56rem;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.event-card__time {
  padding-top: 1.15rem;
  color: var(--brand-strong);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1.35;
}

.event-card__body {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.event-card--current .event-card__body {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand), var(--shadow);
}

.event-card--next .event-card__body {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface));
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
}

.event-card__state {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.event-card__state:empty {
  display: none;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.state-badge--current {
  background: var(--brand);
  color: #fff;
}

.state-badge--next {
  background: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .state-badge--current {
    color: #06211d;
  }

  .state-badge--next {
    color: #2b1105;
  }
}

.event-card__body:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.event-card h4 {
  margin: 0;
  font-size: 1.13rem;
  line-height: 1.45;
}

.event-card__route,
.event-card__note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.event-card__route strong {
  color: var(--text);
}

.event-card__note {
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
}

.event-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.route-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  color: var(--accent);
  font-weight: 900;
}

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.footer p {
  margin: 0;
}

code {
  padding: 0.12rem 0.35rem;
  border-radius: 0.35rem;
  background: var(--surface-soft);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .shell {
    width: min(calc(100% - 1.25rem), var(--shell));
  }

  .hero {
    min-height: 31rem;
  }

  .hero__inner {
    padding-bottom: 2rem;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 0.75rem;
  }

  .timeline::before,
  .event-card::before {
    display: none;
  }

  .event-card {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .event-card__time {
    padding: 0 0.2rem;
  }

  .event-card__body {
    padding: 1rem;
  }

  .footer__inner {
    display: block;
  }

  .footer p + p {
    margin-top: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --text: #111;
    --muted: #444;
    --line: #bbb;
  }

  .hero {
    min-height: auto;
    background: #fff;
  }

  .hero__image,
  .hero__shade,
  .day-nav {
    display: none;
  }

  .hero__inner {
    padding: 2rem 0 1rem;
    color: #111;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .eyebrow,
  .hero__facts,
  .hero__lead {
    color: #333;
  }

  .event-card__body {
    break-inside: avoid;
    box-shadow: none;
  }
}
