/* Anyone can read this file. The look is specified in docs/design/DESIGN.md. */

/* Warm's headings. Other letters, such as Chinese ones, use the next font.
   The name holds the version, because CSS can't add ?v=hash: rename the file
   if it changes. Its licence is beside it. */
@font-face {
  font-family: 'Noto Serif Display'; font-weight: 100 900; font-display: swap;
  src: url(noto-serif-display-5.3.0.woff2) format('woff2');
}

/* ---- Tokens: from docs/design/tokens.css ---- */
:root {
  color-scheme: light;
  --canvas:#f8f3ea; --paper:#fffdf8; --ink:#171b17; --muted:#575d55;
  --forest:#174a38; --forest-dark:#10382a; --lantern:#a83e30;
  --gold:#d8b477; --line:#ded8cd; --soft:#eee8dd; --white:#fff;
  --font-display:'Noto Serif Display',ui-serif,Georgia,serif;
  --font-body:Inter,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px;
  --space-6:24px; --space-8:32px; --space-10:40px; --space-12:48px;
  --radius-sm:12px; --radius-md:16px; --radius-lg:22px; --radius-full:999px;
  --shadow-raised:0 8px 24px rgb(23 27 23 / .12);
  --gutter:20px; --nav-height:64px; --touch:44px; --app-width:520px;
  --ease:cubic-bezier(.2,.8,.2,1); --fast:120ms; --normal:200ms; --swipe:300ms;
}
@media(max-width:360px){:root{--gutter:16px}}
@media(prefers-reduced-motion:reduce){:root{--fast:0ms;--normal:0ms;--swipe:0ms}}
/* Edges of inputs and choices: --line is too faint to mark a control. */
:root { --edge: #85806f; --zh: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", sans-serif; --tabbar: calc(var(--nav-height) + env(safe-area-inset-bottom)); }

/* ---- Calm ----
   The second look: lighter, with the system's own letters. Everything not
   named here or in a [data-look=calm] rule below is shared with Warm. */
:root { --radius-button: var(--radius-sm); --heading: 600; --heading-space: -.02em; --card-edge: var(--paper); }
[data-look=calm] {
  --canvas:#f8f7f3; --paper:#fff; --ink:#1d1d1f; --muted:#606267;
  --forest:#1e5b46; --forest-dark:#174a38; --lantern:#b94334;
  --gold:#d9bd8b; --line:#e2dfd6; --soft:#efede6;
  --font-display:var(--font-body); --radius-button:var(--radius-full);
  --heading-space:-.035em; --shadow-raised:0 10px 30px rgb(29 29 31 / .14);
}
[data-look=warm] .only-calm, [data-look=calm] .only-warm { display: none; }

/* ---- Base ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding: var(--space-5) 0 calc(var(--tabbar) + var(--space-5)); }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 1rem/1.5 var(--font-body); overflow-wrap: break-word; }
main { max-width: var(--app-width); margin: auto; padding: calc(var(--space-5) + env(safe-area-inset-top)) var(--gutter) calc(var(--tabbar) + var(--space-8)); }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
p { margin-bottom: var(--space-3); }
h1, h2 { font-family: var(--font-display); font-weight: var(--heading); letter-spacing: var(--heading-space); text-wrap: balance; }
/* vw caps keep long words and tab labels whole when text is enlarged. */
h1 { font-size: min(2rem, 10vw); line-height: 1.12; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: var(--space-8) 0 var(--space-3); }
h3 { font-size: .9375rem; line-height: 1.4; }
a { color: var(--forest); }
svg { flex: none; display: block; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
.meta, .note, small { font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.zh { font: 400 .875rem/1.4 var(--zh); color: var(--muted); }
.lede { color: var(--muted); }
.error { color: var(--lantern); margin: var(--space-2) 0; }
.error:empty, .offline-bar:empty { display: none; }
.tip { background: var(--soft); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: .9375rem; }
.offline-bar { position: sticky; top: 0; z-index: 4; margin: 0; padding: calc(var(--space-2) + env(safe-area-inset-top)) var(--gutter) var(--space-2); background: var(--ink); color: var(--white); font-size: .8125rem; text-align: center; }

/* ---- Navigation ---- */
.tabbar { position: fixed; inset: auto 0 0; z-index: 3; height: var(--tabbar); padding: 0 max(0px, (100vw - var(--app-width)) / 2) env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(3, 1fr); background: var(--canvas); border-top: 1px solid var(--line); }
.tabbar a { display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; color: var(--muted); font-size: min(.6875rem, 3.6vw); line-height: 1.3; text-decoration: none; }
.tabbar a:focus-visible { outline-offset: -3px; }
.tabbar [aria-current] { color: var(--forest); font-weight: 700; }
.tabbar [aria-current] svg { fill: currentColor; }
.tabbar [aria-current] .cut { fill: none; stroke: var(--canvas); }
.page-head { display: flex; align-items: center; gap: var(--space-2); min-height: var(--touch); margin-bottom: var(--space-3); }
.page-head h1 { flex: 1; min-width: 0; }
.icon-button { display: grid; place-items: center; flex: none; width: var(--touch); height: var(--touch); border-radius: var(--radius-full); color: var(--ink); }
.page-head .icon-button:first-child { margin-left: -10px; }
.page-head .icon-button:last-child { margin-right: -10px; }
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line); margin-bottom: var(--space-4); }
.tabs a { display: flex; align-items: center; min-height: var(--touch); color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs [aria-current] { color: var(--ink); font-weight: 600; border-color: var(--forest); }

/* ---- Buttons ---- */
.button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: var(--space-2) var(--space-4); border: 0; border-radius: var(--radius-button); background: var(--forest); color: var(--white); font: 600 1rem/1.25 var(--font-body); text-align: center; text-decoration: none; cursor: pointer; transition: background var(--fast), transform var(--fast); }
.button-quiet { background: var(--soft); color: var(--ink); }
.button-light { background: var(--paper); color: var(--forest); }
.button:active, .votes button:active { transform: scale(.97); }
@media (hover: hover) { .button:not(.button-quiet, .button-light):hover { background: var(--forest-dark); } }
button:disabled { opacity: .55; cursor: default; }
.actions, .filters { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.action, .filters button { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 var(--space-4); border: 1px solid var(--edge); border-radius: var(--radius-button); background: none; color: var(--ink); font: 500 .9375rem var(--font-body); text-decoration: none; cursor: pointer; }
.filters { margin: var(--space-3) 0; }
[aria-pressed=true], .filters [aria-pressed=true] { background: var(--forest); border-color: var(--forest); color: var(--white); }

/* ---- Pictures with text on them ----
   The shade under the text keeps white readable on any picture. */
.photo-card, .banner, .hero { position: relative; display: grid; overflow: hidden; background: var(--forest); color: var(--white); isolation: isolate; }
.photo-card > img, .banner > img, .hero > img { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; }
.photo-text, .hero-text { align-self: end; --fade: var(--space-12); padding: var(--fade) var(--space-5) var(--space-5); background: linear-gradient(transparent, rgb(10 20 15 / .3) calc(var(--fade) / 2), rgb(10 20 15 / .72) var(--fade)); }
.photo-text > :last-child, .hero-text > :last-child { margin-bottom: 0; }
.photo-text h2 { font-size: min(1.75rem, 10vw); line-height: 1.1; margin: 0 0 var(--space-1); }
.photo-text .zh { color: inherit; }
.photo-card { border-radius: var(--radius-lg); }
.photo-card :focus-visible, .hero :focus-visible { outline-color: var(--white); }

/* ---- Today and login ---- */
.hero { min-height: clamp(380px, 58svh, 520px); margin: calc(-1 * (var(--space-5) + env(safe-area-inset-top))) calc(-1 * var(--gutter)) 0; }
.hero > img { object-position: 70% 20%; }
.wordmark { position: absolute; top: calc(var(--space-5) + env(safe-area-inset-top)); left: var(--gutter); margin: 0; color: var(--ink); font: 600 min(1.5rem, 8vw)/1 var(--font-display); letter-spacing: -.03em; }
.hero-action { position: absolute; top: calc(var(--space-4) + env(safe-area-inset-top)); right: var(--gutter); background: var(--paper); }
.hero-look { right: calc(var(--gutter) + var(--touch) + var(--space-2)); padding: 0; border: 0; cursor: pointer; }
/* The margin keeps the shade off the wordmark, however tall the text gets. */
.hero-text { --fade: 120px; margin-top: calc(84px + env(safe-area-inset-top)); padding: var(--fade) var(--gutter) var(--space-10); }
.hero-text h1 { font-size: min(2.75rem, 12vw); line-height: 1.05; margin-bottom: var(--space-2); }
.hero-text p { max-width: 22rem; }
.hero-text .dateline { font-size: .8125rem; margin-bottom: var(--space-2); }
/* Calm's cover is the other way round: ink on the page, then the city below
   it, whose sky fades in behind the last line. Two rows, so larger text
   pushes the photo down instead of running over it. */
[data-look=calm] .hero { --overlap: 56px; grid-template-rows: auto minmax(250px, 1fr); min-height: clamp(500px, 66svh, 580px); background: var(--canvas); color: var(--ink); }
[data-look=calm] .hero > img { grid-row: 2; position: relative; inset: auto; height: 0; min-height: calc(100% + var(--overlap)); margin-top: calc(-1 * var(--overlap)); object-position: 70% 30%; -webkit-mask-image: linear-gradient(transparent, #000 50%); mask-image: linear-gradient(transparent, #000 50%); }
[data-look=calm] .hero-text { grid-row: 1; align-self: start; margin-top: 0; padding-top: calc(120px + env(safe-area-inset-top)); padding-bottom: 0; background: none; }
[data-look=calm] .hero-text h1 { max-width: 16rem; font-size: min(2.5rem, 11vw); }
[data-look=calm] .hero :focus-visible { outline-color: var(--forest); }
.blossom { position: absolute; z-index: -1; top: calc(68px + env(safe-area-inset-top)); right: 0; width: min(136px, 34vw); }
/* em, so this is about large text: there the branch would touch the date. */
@media (max-width: 16em) { .blossom { display: none; } }
.seal { position: absolute; left: calc(100% + var(--space-2)); top: 4px; padding: 4px 3px; border-radius: 5px; background: var(--lantern); color: var(--white); font: 600 min(.8125rem, 4.2vw)/1.15 "Songti TC", "Noto Serif TC", "Noto Serif CJK TC", serif; letter-spacing: 0; writing-mode: vertical-rl; }
[data-look=calm] .sheet { border-radius: 0; }
[data-look=calm] .strip { margin-top: -44px; background: var(--paper); box-shadow: var(--shadow-raised); }
.sheet { position: relative; margin: calc(-1 * var(--space-5)) calc(-1 * var(--gutter)) 0; padding: var(--space-5) var(--gutter) 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--canvas); }
.strip { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--soft); color: var(--ink); text-decoration: none; }
.strip span { flex: 1; min-width: 0; }
.strip strong, .strip small { display: block; font-size: .875rem; }
.strip small { font-size: .8125rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.tile { display: grid; justify-items: center; align-content: center; gap: var(--space-1); padding: var(--space-4) var(--space-3); border-radius: var(--radius-md); background: var(--forest); color: var(--white); text-align: center; text-decoration: none; }
.tile { align-content: start; }
.tile strong { line-height: 1.25; }
.tile small { color: inherit; }
.tile-red { background: var(--lantern); }
.tile-soft { background: var(--soft); color: var(--ink); }
[data-look=calm] .tile { background: var(--soft); color: var(--ink); }
[data-look=calm] .tile:first-child { background: #e3eae0; color: var(--forest); }
[data-look=calm] .tile-red svg { color: var(--lantern); }
[data-look=calm] .tile small { display: none; }
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: var(--space-6) 0 var(--space-4); padding: 3px; border-radius: var(--radius-button); background: var(--soft); }
.looks button { min-height: var(--touch); border: 0; border-radius: var(--radius-button); background: none; color: var(--ink); font: 500 .9375rem var(--font-body); cursor: pointer; }
.login main { display: grid; align-content: center; min-height: 100svh; padding-block: calc(var(--space-5) + env(safe-area-inset-top)) calc(var(--space-5) + env(safe-area-inset-bottom)); }
.login form { display: grid; gap: var(--space-4); }
.field { font-size: .9375rem; }
.field input { display: block; width: 100%; min-height: 48px; border: 1px solid var(--edge); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: 1rem var(--font-body); }
.field input { margin-top: var(--space-2); padding: 0 var(--space-4); }

/* ---- Rows ---- */
.rows > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; color: var(--ink); text-decoration: none; }
.row > svg { color: var(--muted); }
.row-text { flex: 1; min-width: 0; }
.row-text > * { display: block; }
.row-text strong { font-weight: 600; line-height: 1.35; }
.thumb { display: grid; place-items: center; flex: none; overflow: hidden; width: 60px; height: 60px; border-radius: var(--radius-sm); background: var(--soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.list > * { border-bottom: 1px solid var(--line); padding: var(--space-3) 0; }
.list p, .list dd { margin: 0; color: var(--muted); }
.list dt { font-weight: 600; }
.links > li { padding: 0; }
.links a { display: flex; align-items: center; min-height: var(--touch); }

/* ---- Discover ----
   The card is 3:4, but never so tall that the buttons need scrolling to.
   min-height, not height: large text makes it grow instead of clipping. */
.progress { margin: calc(-1 * var(--space-3)) 0 var(--space-3); color: var(--muted); font-size: .9375rem; }
.stack { display: grid; overflow-x: clip; margin: 0 calc(-1 * var(--gutter)); padding: var(--space-2) calc(var(--gutter) + 4px) var(--space-5); }
.swipe h2 { font-size: min(2.125rem, 10vw); }
.swipe { grid-area: 1 / 1; z-index: 1; min-width: 0; min-height: max(300px, min(133vw - 54px, 640px, 100svh - var(--tabbar) - 236px)); border: 3px solid var(--card-edge); transform: rotate(1.5deg); box-shadow: var(--shadow-raised); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform var(--swipe) var(--ease), opacity var(--swipe) var(--ease); }
.swipe[inert] { z-index: 0; transform: translateX(-5px) rotate(-3deg) scale(.985); }
.swipe.is-dragging { transition: none; cursor: grabbing; }
.swipe::after { position: absolute; top: var(--space-5); right: var(--space-5); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--paper); color: var(--forest); font-weight: 700; }
.swipe[data-lean=love]::after { content: "Love it"; }
.swipe[data-lean=pass]::after { content: "Pass"; color: var(--lantern); }
.swipe.gone-love { transform: translateX(120%) rotate(10deg); opacity: 0; }
.swipe.gone-pass { transform: translateX(-120%) rotate(-10deg); opacity: 0; }
.swipe.gone-maybe { transform: translateY(-30%); opacity: 0; }
.place, .facts li { display: flex; align-items: center; gap: var(--space-1); font-size: .875rem; }
.place { margin-bottom: var(--space-1); }
.place svg, .facts svg { width: 18px; height: 18px; }
.photo-text > p { margin: var(--space-2) 0; }
.photo-text > .place { margin-top: 0; }
.facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); margin-top: var(--space-3); }
.votes { display: flex; justify-content: center; gap: var(--space-6); margin: var(--space-1) 0 var(--space-3); }
.votes button { display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); box-shadow: 0 4px 14px rgb(23 27 23 / .1); border-radius: var(--radius-full); background: var(--paper); color: var(--ink); cursor: pointer; transition: transform var(--fast); }
.votes [value=pass] { color: var(--lantern); }
.votes [value=love] { border-color: var(--forest); background: var(--forest); color: var(--white); }
.hint { text-align: center; }
.match { min-height: min(133vw - 54px, 560px); }
.match h2 { outline: 0; }
.match .button { margin-top: var(--space-4); }
.my-votes, details { border-top: 1px solid var(--line); margin-top: var(--space-4); }
details + details { margin-top: 0; }
summary { min-height: 48px; padding: var(--space-3) 0; font-weight: 600; cursor: pointer; }
.my-votes { margin-top: var(--space-8); }
.my-votes form { border-top: 1px solid var(--line); padding: var(--space-3) 0; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: var(--space-2); }
.choices button { min-height: var(--touch); border: 1px solid var(--edge); border-radius: var(--radius-sm); background: none; color: var(--ink); font: 500 .875rem var(--font-body); cursor: pointer; }
.choices [aria-pressed=true] { background: var(--forest); border-color: var(--forest); color: var(--white); }
.empty { padding: var(--space-6) 0; }
.empty h2 { font-size: min(1.75rem, 10vw); margin: 0 0 var(--space-2); }

/* ---- Plan ---- */
.dates { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-1); margin-bottom: var(--space-4); }
.dates a { display: grid; place-items: center; align-content: center; min-height: 56px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.dates small { color: var(--muted); font-weight: 400; }
.dates [aria-current] { background: var(--forest); color: var(--white); }
.dates [aria-current] small { color: inherit; }
/* Links to a day stop above the date strip, not below it. */
.plan-day { margin-bottom: var(--space-8); scroll-margin-top: 10rem; }
.banner { min-height: 210px; margin: 0 calc(-1 * var(--gutter)) var(--space-4); }
.banner > img { object-position: 50% 32%; }
.banner > .focus-low { object-position: 50% 66%; }
.banner .photo-text { padding-inline: var(--gutter); }
.banner .photo-text p { margin: 0; }
.timeline { margin: var(--space-4) 0 var(--space-4) 5px; border-left: 2px solid var(--line); }
.timeline > li { position: relative; padding: 0 0 var(--space-5) var(--space-5); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline .rows { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.timeline .rows > li { border: 0; }
.timeline .row { padding: 6px var(--space-2) 6px 6px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--soft) 55%, var(--canvas)); }
.timeline .thumb { width: 64px; height: 64px; }
[data-look=calm] .banner { margin-inline: 0; border-radius: var(--radius-md); }
[data-look=calm] .timeline .row { padding-left: 0; background: none; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--edge); }
.timeline > .at-fixed::before { background: var(--forest); }
.timeline > li > p { margin: 0; color: var(--muted); font-size: .9375rem; }
.timeline time { font-variant-numeric: tabular-nums; }
.fixed { margin-top: var(--space-1); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--soft); }
.fixed strong, .status { display: block; }
.fixed p { margin: var(--space-1) 0 0; font-size: .9375rem; }
.status { color: var(--muted); font-size: .8125rem; }
.status b { color: var(--lantern); }

.added { outline: 0; }
.added form, .add-day { display: flex; gap: var(--space-2); padding: 0 0 var(--space-3) calc(60px + var(--space-3)); }
.add-day select { flex: 1; min-width: 0; min-height: var(--touch); padding: 0 var(--space-3); border: 1px solid var(--edge); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: 1rem var(--font-body); }
#match-list .note { margin: 0; padding: 0 0 var(--space-3) calc(60px + var(--space-3)); }

/* ---- Guide and Essentials ---- */
.entry { display: flex; gap: var(--space-4); padding: var(--space-5) 0; border-bottom: 1px solid var(--line); }
.entry > div { flex: 1; min-width: 0; }
.entry h2, .area h2 { margin: 0; }
.entry p, .area p { margin: var(--space-1) 0; }
.entry .actions { margin-top: var(--space-3); }
.entry:target { border-radius: var(--radius-sm); box-shadow: 0 0 0 var(--space-2) var(--canvas), 0 0 0 10px var(--gold); }
.area { padding: var(--space-5) 0; border-bottom: 1px solid var(--line); }
.panel { padding: var(--space-5); border-radius: var(--radius-md); background: var(--soft); }
.panel h2 { margin: 0 0 var(--space-2); }
.address-zh { font: 600 1.5rem/1.4 var(--zh); }
.group { margin-top: var(--space-4); }

@media (max-width: 340px) { .entry .thumb { display: none; } .photo-text { padding-inline: var(--space-4); } }
