/* Seattle trip page: a travel journal under a night sky.
   Paper and ink, one evergreen accent, real photos doing the heavy lifting. */

:root {
  --paper: #f3eee4;
  --paper-2: #ebe4d6;
  --card: #fbf8f2;
  --ink: #1d1b18;
  --ink-2: #4a453d;
  --muted: #7b7468;
  --rule: #d9d0bf;
  --green: #2c5a4b;
  --rust: #b4502b;
  --night: #0b1020;
  --star: #e8a63a;
  --panel: var(--night);
  --stars-empty: #d7cfbf;
  --placeholder: rgba(29, 27, 24, .22);
  --placeholder-l: 84%;
  --badge-bg: rgba(251, 248, 242, .94);
  --pill-border: #c9d5cf;
  --pill-hover: #e5ede9;
  --num-rule: #bfb4a1;
  --num-focus: #fffdf8;
  --dash: #c4b9a5;
  --tint: rgba(44, 90, 75, .07);
  --tint-strong: rgba(44, 90, 75, .11);
  --shadow: rgba(29, 27, 24, .25);
  color-scheme: light;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, sans-serif;
  --gutter: clamp(1rem, 5vw, 3.5rem);
  --max: 1180px;
}

/* Dark: ink-on-night instead of ink-on-paper. Follows the system unless the visitor picked one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12151c; --paper-2: #1c212b; --card: #181d26; --ink: #ece6da; --ink-2: #c3bcae; --muted: #8f897e; --rule: #2c323d;
    --green: #86c0a8; --rust: #e3916a; --panel: #0a0e19; --stars-empty: #3a404c; --placeholder: rgba(236, 230, 218, .18); --placeholder-l: 24%;
    --badge-bg: rgba(18, 21, 28, .88); --pill-border: #35514a; --pill-hover: #1d2c29; --num-rule: #4a505b; --num-focus: #1a1f29;
    --dash: #3d4450; --tint: rgba(134, 192, 168, .08); --tint-strong: rgba(134, 192, 168, .14); --shadow: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12151c; --paper-2: #1c212b; --card: #181d26; --ink: #ece6da; --ink-2: #c3bcae; --muted: #8f897e; --rule: #2c323d;
  --green: #86c0a8; --rust: #e3916a; --panel: #0a0e19; --stars-empty: #3a404c; --placeholder: rgba(236, 230, 218, .18); --placeholder-l: 24%;
  --badge-bg: rgba(18, 21, 28, .88); --pill-border: #35514a; --pill-hover: #1d2c29; --num-rule: #4a505b; --num-focus: #1a1f29;
  --dash: #3d4450; --tint: rgba(134, 192, 168, .08); --tint-strong: rgba(134, 192, 168, .14); --shadow: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background: var(--paper); transition: background-color .3s ease, color .3s ease; color: var(--ink); font: 400 16.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
::selection { background: var(--tint-strong); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- hero ---------- */
.hero { position: relative; height: 100svh; min-height: 520px; background: var(--night); color: #f4efe6; overflow: hidden; }
#sky, .hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#sky { opacity: 0; transition: opacity 1.4s ease; background: radial-gradient(120% 70% at 50% 75%, #2a2140 0%, #0d1328 45%, #05070f 100%); }
#sky.is-ready, #sky.is-fallback { opacity: 1; }
.hero-video { opacity: 0; transition: opacity 1.5s ease; }
.hero-video.is-playing { opacity: 1; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(to bottom, transparent, rgba(5, 7, 15, .55)); pointer-events: none; }

.hero-text { position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(2.2rem, 9vh, 5.5rem); z-index: 2; max-width: 900px; }
.hero h1 { font: 300 clamp(4.2rem, 17vw, 12.5rem)/.86 var(--serif); font-variation-settings: "opsz" 144; letter-spacing: -.035em; margin: .2em 0 .25em -.04em; }
.hero-when { font: italic 400 clamp(1.05rem, 2.2vw, 1.35rem)/1.3 var(--serif); color: #e9dfcd; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.hero-countdown { color: #b9c4d8; font-style: normal; font-family: var(--sans); font-size: .82em; letter-spacing: .02em; align-self: center; }
.hero-who { max-width: 44ch; font-size: clamp(1rem, 1.6vw, 1.15rem); color: #cfd3dc; }

/* light/dark switch, top-left of the hero */
.theme-toggle { position: absolute; top: .85rem; left: var(--gutter); z-index: 5; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #c9cfdb; opacity: .75; transition: opacity .2s, background-color .2s; }
.theme-toggle:hover { opacity: 1; background: #ffffff14; color: #fff; }
.theme-toggle svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun, :root[data-theme-now="dark"] .theme-toggle .moon { display: none; }
:root[data-theme-now="dark"] .theme-toggle .sun { display: block; }

.account { position: absolute; top: 1.1rem; right: var(--gutter); z-index: 5; text-align: right; }
.account-link { font-size: .85rem; color: #c9cfdb; padding: .35rem 0; border-bottom: 1px solid transparent; }
.account-link:hover { color: #fff; border-bottom-color: currentColor; }
.account-link img { width: 22px; height: 22px; border-radius: 50%; display: inline-block; vertical-align: -6px; margin-right: .45rem; }
.account-menu { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 230px; background: var(--card); color: var(--ink); border-radius: 10px; padding: .9rem 1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); text-align: left; font-size: .9rem; display: grid; gap: .6rem; }
.account-menu p { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.account-menu .text-button { justify-self: start; }

/* ---------- sections ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(3.5rem, 9vw, 7rem) var(--gutter) 0; }
.section-head { display: grid; gap: .35rem; margin-bottom: clamp(1.6rem, 4vw, 2.6rem); }
.eyebrow { font: italic 400 1.05rem/1 var(--serif); color: var(--rust); }
h2 { font: 400 clamp(2.1rem, 5.2vw, 3.6rem)/1.02 var(--serif); font-variation-settings: "opsz" 120; letter-spacing: -.02em; }
.section-note { color: var(--muted); max-width: 52ch; }

.tabs { display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; margin-top: .9rem; }
.tabs button { padding: .2rem 0; color: var(--muted); border-bottom: 1.5px solid transparent; font-size: .95rem; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button small { font-size: .78em; color: var(--muted); margin-left: .2rem; font-variant-numeric: tabular-nums; }

.text-button { color: var(--green); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-button:hover { color: var(--ink); }
.empty { color: var(--muted); font-style: italic; font-family: var(--serif); }

/* ---------- basics (ledger) ---------- */
.ledger { list-style: none; border-top: 1px solid var(--ink); }
.ledger-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 1.1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--rule); position: relative; }
.ledger-photo { width: 76px; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--paper-2); }
.ledger-photo img { width: 100%; height: 100%; object-fit: cover; }
.ledger-name { font: 500 1.35rem/1.2 var(--serif); }
.ledger-note { color: var(--ink-2); font-size: .95rem; }
.ledger-price { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-price .pp { font: 500 1.25rem/1.2 var(--serif); }
.ledger-price .grp { display: block; color: var(--muted); font-size: .82rem; }

/* ---------- activities ---------- */
.activities { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(1.4rem, 3vw, 2.4rem) clamp(1rem, 2.4vw, 2rem); }
.activity { grid-column: span 4; display: flex; flex-direction: column; position: relative; }
.activity:nth-child(7n + 1) { grid-column: span 8; }
.activity:nth-child(7n + 1) .photo { aspect-ratio: 16 / 9; }
.activity:nth-child(7n + 1) .activity-name { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.activity[hidden] { display: none; }
.photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 3px; background: var(--paper-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .8s ease, transform 1.6s cubic-bezier(.2, .7, .2, 1); }
.photo img.is-loaded { opacity: 1; transform: scale(1); }
.activity:hover .photo img.is-loaded { transform: scale(1.025); }
.photo-credit { position: absolute; right: .5rem; bottom: .4rem; font-size: .68rem; color: #fff; opacity: .75; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); text-decoration: none; }
.photo-credit:hover { opacity: 1; text-decoration: underline; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; font: italic 300 4.5rem/1 var(--serif); color: var(--placeholder); }
.activity-body { padding-top: .8rem; display: grid; gap: .25rem; }
.activity-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.activity-name { font: 500 1.4rem/1.15 var(--serif); letter-spacing: -.01em; }
.price { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .95rem; color: var(--ink-2); }
.price.free { color: var(--green); font-style: italic; font-family: var(--serif); }
.activity-note { color: var(--ink-2); font-size: .95rem; }
.activity-link { font-size: .88rem; color: var(--green); justify-self: start; }

/* ---------- food places ---------- */
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 1.2rem; }
.place { background: var(--card); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; position: relative;
  box-shadow: 0 1px 0 var(--tint), 0 8px 24px -14px var(--shadow); }
.place[hidden] { display: none; }
.place .photo { aspect-ratio: 16 / 10; border-radius: 0; }
.place-body { padding: .9rem 1rem 1rem; display: grid; gap: .3rem; flex: 1; align-content: start; }
.place-name { font: 600 1.08rem/1.25 var(--sans); }
.rating { display: flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--ink-2); }
.rating b { font-weight: 500; }
.stars { position: relative; display: inline-block; font-size: .9rem; letter-spacing: 1px; color: var(--stars-empty); line-height: 1; }
.stars::before { content: "★★★★★"; }
.stars span { position: absolute; inset: 0; overflow: hidden; color: var(--star); white-space: nowrap; }
.stars span::before { content: "★★★★★"; }
.place-meta { font-size: .88rem; color: var(--muted); }
.place-meta .dollars b { color: var(--ink-2); font-weight: 500; }
.place-address, .place-hours { font-size: .86rem; color: var(--ink-2); }
.place-hours .open { color: var(--green); }
.place-blurb { font-size: .9rem; color: var(--ink-2); margin-top: .2rem; }
.badge { position: absolute; top: .7rem; left: .7rem; z-index: 1; background: var(--badge-bg); color: var(--green); font-size: .74rem; font-weight: 600; padding: .25rem .55rem; border-radius: 4px; }
.place-actions { display: flex; gap: .5rem; padding: 0 1rem 1rem; }
.place-actions a, .place-actions button { font-size: .82rem; font-weight: 500; color: var(--green); border: 1px solid var(--pill-border); border-radius: 999px; padding: .38rem .8rem; text-decoration: none; }
.place-actions a:hover, .place-actions button:hover { background: var(--pill-hover); }
.place-actions .menu-button { background: var(--green); border-color: var(--green); color: var(--card); }
.place-actions .menu-button:hover { background: var(--green); filter: brightness(1.1); }

/* ---------- budget ---------- */
.budget-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4.5rem); align-items: start; }
.calc-title { font: 500 1.15rem/1.2 var(--serif); margin: 1.8rem 0 .4rem; display: flex; justify-content: space-between; align-items: baseline; }
.calc-title span { font: 400 .8rem var(--sans); color: var(--muted); }
.calc-list { list-style: none; border-top: 1px solid var(--ink); }
.calc-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); }
.calc-row label { flex: 1; cursor: pointer; }
.calc-row.is-off label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); }
.calc-row input[type="checkbox"] { accent-color: var(--green); width: 1rem; height: 1rem; margin-right: .6rem; vertical-align: -2px; }
.calc-people { border-bottom: 1px solid var(--rule); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: .45rem; top: 50%; translate: 0 -50%; color: var(--muted); font-size: .9rem; pointer-events: none; }
.num { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; background: transparent; border: 0; border-bottom: 1px dashed var(--num-rule); padding: .25rem .2rem .2rem 1.2rem; -moz-appearance: textfield; }
.num::-webkit-inner-spin-button, .num::-webkit-outer-spin-button { -webkit-appearance: none; }
.num:hover { border-bottom-color: var(--ink-2); }
.num:focus { outline: none; border-bottom: 1.5px solid var(--green); background: var(--num-focus); }
#calc-people, #calc-days { width: 4rem; padding-left: .2rem; }
.num.is-changed { color: var(--rust); }
#calc-reset { margin-top: 1rem; }

.budget-totals { position: sticky; top: 1.5rem; background: var(--panel); box-shadow: inset 0 0 0 1px var(--rule); color: #f1ebdf; border-radius: 10px; padding: clamp(1.4rem, 3vw, 2rem); }
.total-big { display: grid; gap: .2rem; padding-bottom: 1rem; border-bottom: 1px solid #ffffff22; }
.total-label { font: italic 400 1rem var(--serif); color: #b9c4d8; }
.total-value { font: 300 clamp(2.8rem, 6vw, 4rem)/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.total-rows { display: grid; gap: .55rem; padding: 1rem 0; }
.total-rows div { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; }
.total-rows dt { color: #b9c4d8; }
.total-rows dd { font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #ffffff18; margin-top: .4rem; }
.split-bar span { height: 100%; transition: width .5s ease; }
.split-legend { list-style: none; display: grid; gap: .3rem; margin-top: .9rem; font-size: .85rem; color: #cfd3dc; }
.split-legend li { display: flex; justify-content: space-between; gap: 1rem; }
.split-legend i { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .5rem; }

/* ---------- menu popup ---------- */
body.has-dialog { overflow: hidden; }
.menu-dialog { margin: auto; width: min(960px, calc(100vw - 2rem)); height: min(88vh, 1100px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 12px;
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); display: none; flex-direction: column; overflow: hidden; }
.menu-dialog[open] { display: flex; animation: menu-in .25s cubic-bezier(.2, .7, .2, 1); }
.menu-dialog::backdrop { background: rgba(5, 7, 15, .62); backdrop-filter: blur(3px); }
@keyframes menu-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.menu-head { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem .9rem 1.4rem; border-bottom: 1px solid var(--rule); }
.menu-head > div { flex: 1; min-width: 0; }
.menu-head .eyebrow { font-size: .9rem; }
.menu-head h3 { font: 500 1.45rem/1.15 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-out { font-size: .85rem; color: var(--green); white-space: nowrap; }
.menu-close { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.menu-close:hover { background: var(--paper-2); color: var(--ink); }
.menu-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.menu-body { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; }
.menu-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.menu-status { margin: auto; color: var(--muted); font: italic 400 1.1rem var(--serif); }
.menu-note { padding: .6rem 1.4rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--rule); }
.menu-note a { color: var(--green); }
.menu-fallback { margin: auto; max-width: 30rem; padding: 2rem 1.5rem; display: grid; gap: 1rem; justify-items: center; text-align: center; }
.menu-fallback p { color: var(--ink-2); font: 400 1.15rem/1.45 var(--serif); }
.menu-cta { background: var(--green); color: var(--card); text-decoration: none; padding: .7rem 1.4rem; border-radius: 999px; font-weight: 600; }
.menu-cta:hover { filter: brightness(1.1); }
.menu-hint { font: .82rem var(--sans) !important; color: var(--muted) !important; }
@media (max-width: 600px) {
  .menu-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .menu-out { display: none; }
}

/* ---------- footer, toast ---------- */
.footer { max-width: var(--max); margin: clamp(4rem, 10vw, 7rem) auto 0; padding: 1.5rem var(--gutter) 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 1.4rem; translate: -50% 0; z-index: 50; background: var(--ink); color: var(--paper); border-radius: 8px; padding: .65rem 1rem;
  font-size: .9rem; display: flex; gap: 1rem; align-items: center; box-shadow: 0 10px 30px var(--shadow); }
.toast button { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- editing (only when signed in) ---------- */
[data-field] { border-radius: 2px; transition: background-color .15s; }
body.is-editing [data-field] { cursor: text; }
body.is-editing [data-field]:hover { background: var(--tint); }
body.is-editing [data-field]:focus { outline: none; background: var(--tint-strong); box-shadow: 0 1px 0 var(--green); }
body.is-editing [data-field]:empty::before { content: attr(data-placeholder); color: var(--muted); font-style: italic; }
.hero [data-field]:hover, .hero [data-field]:focus { background: #ffffff14 !important; }

.edit-tools { display: none; position: absolute; top: .5rem; right: .5rem; z-index: 3; gap: 2px; background: var(--card); border-radius: 6px; padding: 2px;
  box-shadow: 0 2px 10px var(--shadow); }
.ledger-row .edit-tools { top: .3rem; right: auto; left: -2.6rem; flex-direction: column; background: none; box-shadow: none; }
body.is-editing .edit-tools { display: flex; opacity: 0; transition: opacity .15s; }
body.is-editing .sortable > *:hover .edit-tools, body.is-editing .edit-tools:focus-within { opacity: 1; }
.edit-tools button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; color: var(--ink-2); }
.edit-tools button:hover { background: var(--paper-2); color: var(--ink); }
.edit-tools .handle { cursor: grab; touch-action: none; }
.edit-tools svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.is-dragging { opacity: .55; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }

.add-new { display: none; }
body.is-editing .add-new { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 64px; border: 1px dashed var(--dash); border-radius: 6px; color: var(--muted); font-size: .92rem; }
body.is-editing .add-new:hover { color: var(--green); border-color: var(--green); background: var(--tint); }
.activities .add-new { grid-column: span 4; min-height: 160px; }
.ledger .add-new { margin-top: .8rem; }
.places .add-new { min-height: 200px; }
.show-more { grid-column: 1 / -1; justify-self: center; margin-top: .6rem; font-size: .95rem; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .activity, .activity:nth-child(7n + 1), .activities .add-new { grid-column: span 6; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-totals { position: static; }
}
@media (max-width: 600px) {
  .activity, .activity:nth-child(7n + 1), .activities .add-new { grid-column: span 12; }
  .ledger-row { grid-template-columns: 56px 1fr; }
  .ledger-photo { width: 56px; }
  .ledger-price { grid-column: 2; text-align: left; }
  .ledger-row .edit-tools { left: auto; right: 0; flex-direction: row; }
  body.is-editing .edit-tools { opacity: 1; }
  .num { width: 5.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .photo img { transition: opacity .3s; transform: none !important; }
}
