/* Trips — the hub around the trip pages: home (globe and years), accounts, the itinerary builder.
   Same palette and typeface as the Vietnam trip page, so a trip page and the hub read as one product.
   Pine carries actions; rust marks what's happening now and where trips go on the globe. */
:root {
  --pine: #223030;
  --espresso: #523d35;
  --sage: #959d90;
  --taupe: #bba58f;
  --linen: #e8d9cd;
  --mist: #efefe9;
  --rust: #865038;
  --cream: #fbf8f2;

  --bg: var(--cream);
  --surface: #fffefb;
  --panel: #f2eae0;
  --panel-2: #ebe1d5;
  --ink: var(--pine);
  --ink-2: var(--espresso);
  --muted: #586159;
  --line: #e2d9cd;
  --line-strong: #c8b8a5;
  --accent: var(--pine);
  --on-accent: var(--mist);
  --accent-soft: #e2e5dd;
  --now: var(--rust);
  --now-soft: #efe0d6;
  --ok-soft: #e3e8dd;
  --err-soft: #f3e0d5;
  --focus: #2e6f7a;

  /* globe */
  --g-ocean: #eaece5;
  --g-ocean-edge: #dfe2d9;
  --g-land: #e2d4c4;
  --g-land-line: #c9b6a1;
  --g-dest: #d2b79c;
  --g-grid: rgba(34, 48, 48, 0.075);
  --g-arc: rgba(34, 48, 48, 0.55);
  --g-dot: var(--rust);
  --g-label: var(--pine);
  --g-halo: rgba(251, 248, 242, 0.9);

  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(34, 48, 48, 0.05), 0 12px 32px rgba(34, 48, 48, 0.08);
  --head-h: 64px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161e1e;
    --surface: #1d2727;
    --panel: #1f2a29;
    --panel-2: #263231;
    --ink: #ecebe4;
    --ink-2: #e8d9cd;
    --muted: #a9afa3;
    --line: #34403f;
    --line-strong: #56605d;
    --accent: #e8d9cd;
    --on-accent: #172020;
    --accent-soft: #2b3836;
    --now: #d09a7e;
    --now-soft: #3a2c26;
    --ok-soft: #24332d;
    --err-soft: #3d2a24;
    --focus: #8cc7cf;
    --g-ocean: #1c2626;
    --g-ocean-edge: #263231;
    --g-land: #2e3b39;
    --g-land-line: #45534f;
    --g-dest: #56645c;
    --g-grid: rgba(236, 235, 228, 0.06);
    --g-arc: rgba(232, 217, 205, 0.6);
    --g-dot: #d09a7e;
    --g-label: #ecebe4;
    --g-halo: rgba(22, 30, 30, 0.85);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; outline: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
@media (min-width: 900px) { .wrap { padding-left: 36px; padding-right: 36px; } }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 10px; }

/* ---------------- header ---------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(10px); backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-row { height: var(--head-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.nav-link { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: 15.5px; }
.nav-link:hover, .nav-link[aria-current] { background: var(--accent-soft); }
.nav-account { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 13.5px; font-weight: 600; }
@media (max-width: 420px) { .hide-xs { display: none; } }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 15.5px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--bg)); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover, .btn-ghost[aria-current] { background: var(--accent-soft); border-color: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); background: var(--accent-soft); border-color: transparent; }
.btn-danger { background: var(--now); border-color: var(--now); color: var(--cream); }
.btn-danger:hover { background: color-mix(in srgb, var(--now) 85%, #000); }
.btn-sm { min-height: 34px; padding: 6px 13px; font-size: 14.5px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 16.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 500; }

/* ---------------- flash and forms ---------------- */
.flash { padding: 11px 14px; border-radius: var(--r-sm); font-size: 15px; margin-bottom: 18px; }
.flash-ok { background: var(--ok-soft); }
.flash-err { background: var(--err-soft); color: var(--ink); }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; font-size: 14.5px; font-weight: 500; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 400; line-height: 1.4;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field .hint { font-weight: 400; font-size: 13.5px; color: var(--muted); }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.code-input { text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------------- hero: globe and years ---------------- */
.hero { padding: 40px 0 28px; position: relative; overflow: hidden; }
.hero-grid { display: grid; gap: 24px; align-items: center; }
@media (min-width: 900px) {
  .hero { padding: 56px 0 40px; }
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; }
}
.hero-text { display: grid; gap: 14px; align-content: center; }
.hello { font-size: 17px; color: var(--muted); font-weight: 500; }
.hero h1 { font-size: clamp(40px, 6.4vw, 72px); letter-spacing: -0.03em; line-height: 1.02; }
.hero-out h1 { font-size: clamp(38px, 5.6vw, 64px); max-width: 13ch; }
.hero-sum { font-size: 19px; color: var(--ink-2); max-width: 34ch; }
.hero-lede { font-size: 19px; color: var(--ink-2); max-width: 38ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.invite-note { font-size: 14.5px; color: var(--muted); }

.hero-globe { position: relative; justify-self: center; width: 100%; max-width: 620px; }
.globe { position: relative; width: 100%; aspect-ratio: 1; touch-action: pan-y; cursor: grab; }
.globe.is-dragging { cursor: grabbing; }
.globe canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.globe-hint { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 899px) { .hero-globe { max-width: 440px; order: 2; } }

/* the year ruler: a scale bar, one tick per year with trips */
.years { margin-top: 18px; }
.year-ruler {
  list-style: none; margin: 0; padding: 0 0 0; display: flex; gap: 0; position: relative;
  border-top: 1.5px solid var(--ink); overflow-x: auto; scrollbar-width: none;
}
.year-ruler::-webkit-scrollbar { display: none; }
.year-ruler li { flex: 0 0 auto; }
.year-ruler a {
  position: relative; display: grid; gap: 2px; padding: 16px 22px 6px 0; min-width: 96px;
  text-decoration: none; color: var(--muted);
}
.year-ruler a::before { content: ''; position: absolute; left: 0; top: -1.5px; width: 1.5px; height: 10px; background: var(--ink); }
.year-ruler a::after { content: ''; position: absolute; left: -4px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--ink); opacity: 0; transition: opacity .2s; }
.year-ruler .yr { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.year-ruler .yr-count { font-size: 14px; }
.year-ruler a:hover .yr, .year-ruler a.is-active .yr { color: var(--now); }
.year-ruler a.is-active::after, .year-ruler a:hover::after { opacity: 1; border-color: var(--now); background: var(--now); }

/* ---------------- years and trip carousels ---------------- */
.years-list { padding-bottom: 24px; }
.year { padding: 28px 0 32px; }
.year-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.year-n { font-size: clamp(56px, 9vw, 112px); line-height: 0.86; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.year-rule { flex: 1; height: 0; border-top: 1px solid var(--line-strong); margin-bottom: 10px; }
.year-count { color: var(--muted); font-size: 15px; margin-bottom: 4px; white-space: nowrap; }

.carousel { position: relative; }
.trip-track {
  list-style: none; margin: 0; padding: 4px 2px 18px; display: grid; grid-auto-flow: column;
  grid-auto-columns: min(320px, 80vw); gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: thin; overscroll-behavior-x: contain;
}
@media (min-width: 900px) { .trip-track { grid-auto-columns: 340px; gap: 22px; } }
.trip-card {
  position: relative; scroll-snap-align: start; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  transition: border-color .15s, transform .2s;
}
@media (hover: hover) { .trip-card:hover { border-color: var(--line-strong); } .trip-card:hover .tc-title a { text-decoration: underline; } }
.trip-card:focus-within { border-color: var(--ink); }
.tc-cover { position: relative; aspect-ratio: 16 / 10; background: var(--panel); overflow: hidden; }
.tc-cover img { width: 100%; height: 100%; object-fit: cover; }
.tc-cover canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tc-cover.no-photo img { display: none; }
.tc-status {
  position: absolute; left: 12px; top: 12px; z-index: 2; padding: 4px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--ink); font-size: 13.5px; font-weight: 600;
}
.tc-status.is-now { background: var(--now); color: var(--cream); }
.tc-status.is-soon { background: var(--accent); color: var(--on-accent); }
.tc-body { padding: 15px 18px 14px; display: grid; gap: 4px; }
.tc-title { font-size: 21px; letter-spacing: -0.02em; }
.tc-link { text-decoration: none; }
.tc-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.tc-link:focus-visible { outline: none; }
.tc-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--r-lg); }
.tc-dates { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.tc-places { font-size: 14.5px; color: var(--muted); }
.tc-foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 10px 18px 14px; font-size: 13.5px; color: var(--muted); }
.tc-edit, .tc-credit a { position: relative; z-index: 2; }
.tc-edit { font-weight: 600; color: var(--ink); }
.tc-credit { font-size: 12.5px; }
.car-nav {
  position: absolute; top: calc(50% - 32px); z-index: 3; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow);
}
.car-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.car-prev { left: -10px; } .car-next { right: -10px; }
@media (max-width: 899px) { .car-nav { display: none; } }

/* ---------------- plan your trip ---------------- */
.plan { background: var(--panel); border-top: 1px solid var(--line); padding: 64px 0 72px; }
.plan-grid { display: grid; gap: 36px; }
@media (min-width: 980px) { .plan-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; align-items: start; } }
.plan-intro { display: grid; gap: 16px; align-content: start; justify-items: start; }
.plan-intro h2 { font-size: clamp(32px, 4.4vw, 48px); letter-spacing: -0.03em; max-width: 12ch; }
.plan-intro p { font-size: 17.5px; color: var(--ink-2); max-width: 46ch; }
.plan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 720px) { .plan-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.plan-steps li {
  counter-increment: step; position: relative; display: grid; gap: 8px; align-content: start;
  padding: 22px 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.plan-steps svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.plan-steps li::before {
  content: counter(step); position: absolute; right: 18px; top: 16px;
  font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
}
.plan-steps h3 { font-size: 19px; }
.plan-steps p { font-size: 15.5px; color: var(--muted); }

/* ---------------- footer ---------------- */
.site-foot { border-top: 1px solid var(--line); padding: 22px 0 calc(22px + env(safe-area-inset-bottom, 0px)); font-size: 14px; color: var(--muted); }
.pg-home .site-foot { border-top: 0; background: var(--panel); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.foot-links { display: flex; gap: 16px; }

/* ---------------- log in, create account, small pages ---------------- */
.auth { padding: 48px var(--gutter) 64px; display: grid; justify-items: center; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 26px 26px; box-shadow: var(--shadow); }
.auth h1 { font-size: 32px; letter-spacing: -0.025em; margin-bottom: 8px; }
.auth-sub { color: var(--muted); margin-bottom: 22px; font-size: 16px; }
.auth-alt { margin-top: 18px; font-size: 15px; }
.auth-fine { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.plan-new .auth-card { max-width: 520px; }

/* ---------------- my account ---------------- */
.page-head { padding: 36px 0 8px; }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(34px, 5vw, 48px); letter-spacing: -0.03em; }
.page-sub { color: var(--muted); margin-top: 6px; }
.account { padding-top: 18px; padding-bottom: 64px; display: grid; gap: 22px; }
.acct-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 22px 24px; }
.acct-sec h2 { font-size: 23px; letter-spacing: -0.02em; }
.sec-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-sub { color: var(--muted); font-size: 15px; margin: 6px 0 16px; }
.acct-cols { display: grid; gap: 22px; }
@media (min-width: 900px) { .acct-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
.empty { display: grid; gap: 12px; justify-items: start; padding: 8px 0 4px; color: var(--muted); }
.trip-rows { list-style: none; margin: 0; padding: 0; display: grid; }
.trip-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.trip-row:first-child { border-top: 0; padding-top: 4px; }
.tr-thumb { position: relative; width: 96px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--panel); }
.tr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tr-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-text h3 { font-size: 18.5px; }
.tr-text h3 a { text-decoration: none; }
.tr-text h3 a:hover { text-decoration: underline; }
.tr-text p { font-size: 14.5px; color: var(--muted); }
.tr-status { color: var(--ink-2) !important; font-weight: 500; }
.tr-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .trip-row { grid-template-columns: 72px minmax(0, 1fr); }
  .tr-thumb { width: 72px; }
  .tr-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
details.confirm { position: relative; }
details.confirm summary { list-style: none; }
details.confirm summary::-webkit-details-marker { display: none; }
.confirm-box {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: min(300px, 80vw);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  display: grid; gap: 10px; font-size: 14.5px;
}
@media (max-width: 640px) { .confirm-box { left: 0; right: auto; } }

/* a year with one trip: one wide card, photo beside the text */
@media (min-width: 760px) {
  .trip-track.is-solo { grid-auto-columns: min(820px, 100%); overflow: visible; }
  .trip-track.is-solo .trip-card { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); grid-template-rows: 1fr auto; }
  .trip-track.is-solo .tc-cover { grid-row: 1 / span 2; aspect-ratio: auto; min-height: 300px; }
  .trip-track.is-solo .tc-body { padding: 26px 26px 10px; align-content: start; gap: 8px; }
  .trip-track.is-solo .tc-title { font-size: 30px; letter-spacing: -0.025em; }
  .trip-track.is-solo .tc-dates { font-size: 17px; }
  .trip-track.is-solo .tc-places { font-size: 16px; }
  .trip-track.is-solo .tc-foot { padding: 12px 26px 22px; flex-direction: column; align-items: flex-start; }
}
