/* Make Trip Map: design tokens and components shared by every page. */

:root {
  --paper: #f5f0e6;
  --paper-deep: #ebe2d1;
  --card: #fffdf8;
  --ink: #1f2a33;
  --ink-soft: #46525d;
  --ink-muted: #737d86;
  --line: #ddd2bf;
  --line-strong: #c7b89f;
  --accent: #c4532f;
  --accent-strong: #a13f1f;
  --accent-soft: #f5e0d4;
  --sea: #2c6a64;
  --sea-soft: #dce9e5;
  --amber-soft: #f8ecd6;
  --amber-line: #ead3a8;
  --danger: #a3302b;
  --danger-soft: #f7dedb;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgb(31 42 51 / 0.08);
  --shadow: 0 12px 28px -14px rgb(31 42 51 / 0.35), 0 2px 6px rgb(31 42 51 / 0.06);
  --shadow-l: 0 24px 48px -28px rgb(31 42 51 / 0.38), 0 4px 12px rgb(31 42 51 / 0.07);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --header-h: 64px;
  --page-max: 1180px;
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: light;
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--paper);
  /* Faint paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.16 0 0 0 0 0.2 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--sea);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 520;
  font-variation-settings: "opsz" 72, "SOFT" 30;
  line-height: 1.1;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

p,
ol,
ul,
figure {
  margin: 0;
}

:focus-visible {
  outline: 3px solid rgb(44 106 100 / 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-soft);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 5000;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ type helpers */

.eyebrow {
  color: var(--accent);
  font: 500 12px/1.3 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stamp {
  color: var(--ink-muted);
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lede {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.6;
}

.muted {
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ header & footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgb(245 240 230 / 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-route .site-header-inner {
  max-width: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: italic 500 21px/1 var(--font-display);
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-s);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  background: rgb(31 42 51 / 0.06);
  color: var(--ink);
}

@media (max-width: 720px) {
  .nav-link {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand span {
    display: none;
  }
}

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

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 28px var(--gutter) 36px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: 7px;
  font: 600 15px/1 var(--font-body);
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.15s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  flex: none;
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn-large {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #fffdf8;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.16), 0 1px 1px rgb(31 42 51 / 0.12);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fffdf8;
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
}

.btn-ink:hover {
  background: #2d3b46;
  color: var(--paper);
}

.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--card);
  border-color: var(--ink-muted);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: rgb(31 42 51 / 0.06);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fffdf8;
}

.btn-danger:hover {
  background: #86241f;
  color: #fffdf8;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.btn.is-busy {
  cursor: progress;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover {
  background: rgb(31 42 51 / 0.07);
  color: var(--ink);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--sea);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------------ small components */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sea-soft);
  color: var(--sea);
  font: 500 12.5px/1.4 var(--font-body);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-tone="warm"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.notice {
  padding: 14px 16px;
  border: 1px solid var(--amber-line);
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--ink);
  font-size: 14.5px;
}

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgb(31 42 51 / 0.07) 0%,
    rgb(31 42 51 / 0.13) 40%,
    rgb(31 42 51 / 0.07) 80%
  );
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-title {
  width: 72%;
  height: 0.9em;
}

.skeleton-line {
  height: 0.75em;
  margin: 0.5em 0;
}

.skeleton-line.is-short {
  width: 58%;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ------------------------------------------------------------------ forms */

.field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--sea);
  outline: none;
  box-shadow: 0 0 0 3px rgb(44 106 100 / 0.18);
}

.field-hint {
  color: var(--ink-muted);
  font-size: 13px;
}

.form-error,
.form-success {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.form-success {
  background: var(--sea-soft);
  color: var(--sea);
}

/* ------------------------------------------------------------------ dialogs */

dialog.sheet {
  width: min(92vw, 480px);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-l);
}

dialog.sheet::backdrop {
  background: rgb(31 42 51 / 0.45);
  backdrop-filter: blur(2px);
}

dialog.sheet[open] {
  animation: dialog-in 0.22s var(--ease);
}

.sheet-body {
  position: relative;
  padding: 28px;
}

.sheet-title {
  margin: 6px 36px 8px 0;
  font-size: 27px;
}

.sheet-text {
  color: var(--ink-soft);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.share-url {
  width: 100%;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: 14px/1.4 var(--font-mono);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

dialog.lightbox {
  max-width: 96vw;
  max-height: 96vh;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

dialog.lightbox::backdrop {
  background: rgb(18 24 29 / 0.88);
}

.lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 6px;
  background: #111;
  box-shadow: var(--shadow-l);
  object-fit: contain;
}

.lightbox figcaption {
  margin-top: 12px;
  color: #e9e2d3;
  text-align: center;
}

.lightbox .icon-button {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
}

.lightbox .icon-button:hover {
  background: rgb(255 255 255 / 0.24);
  color: #fff;
}

/* ------------------------------------------------------------------ toasts */

.toast-region {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 3000;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-l);
  font-size: 14.5px;
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease);
  transition: opacity 0.2s, transform 0.2s;
}

.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--paper);
}

.toast[data-tone="success"]::before {
  background: #93d4a1;
}

.toast[data-tone="error"]::before {
  background: #f2a097;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
