/* Calendar (Wardro Views/Calendar): the month list, the day "+" chooser,
   a day's page, Log / Plan. Values from CalendarView.swift, DayAddChooser.swift,
   CalendarDayView.swift, OutfitPicker.swift and SPEC.md 2.7. */
.app {
  --cal-line: rgba(255, 255, 255, 0.12);           /* a day's hairline: primary @ 12% */
  /* today's column: accent @ 10% (line 25%); planned: dashed accent @ 65%. From --acc, so the accent picker reaches them. */
  --cal-today: color-mix(in srgb, var(--acc) 10%, transparent);
  --cal-today-line: color-mix(in srgb, var(--acc) 25%, transparent);
  --cal-plan-line: color-mix(in srgb, var(--acc) 65%, transparent);
  --cal-plus: rgba(118, 118, 128, 0.18);           /* quaternarySystemFill */
  --cal-orange: #ff9f0a;                           /* system orange: trips */
  --dc-sheet: #1c1c1e; --dc-card: #2c2c2e; --dc-stage: #3a3a3c; --dc-edge: rgba(255, 255, 255, 0.08);
  --dc-ink: #211f24;                               /* the calendar page's paper is off-white in both looks */
}
@media (prefers-color-scheme: light) {
  .app {
    --cal-line: rgba(0, 0, 0, 0.12);
    --cal-plus: rgba(116, 116, 128, 0.08);
    --cal-orange: #ff9500;
    --dc-sheet: #f2f2f7; --dc-card: #fff; --dc-stage: #f2f2f7; --dc-edge: rgba(0, 0, 0, 0.08);
  }
}

/* ---------- The bar: avatar · Trips | Calendar | + Log ---------- */
[data-screen="calendar"] .page-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
[data-screen="calendar"] .bar-title { text-align: left; }

/* ---------- The month list: fixed weekday row, one scrolling column of months, the legend band, the access card ---------- */
[data-screen="calendar"] .page-scroll { overflow: hidden; }
[data-screen="calendar"] .page-body { height: 100%; min-height: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 2px); }
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s-m); }
.cal-wd { flex: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s-xs); margin-bottom: -6px; color: var(--sub); font: 600 var(--t-cap2)/13px var(--text); text-align: center; letter-spacing: 0; }
.clist { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.clist::-webkit-scrollbar { display: none; }
/* Every month is as tall as six weeks (CalendarMonthLayout): 44 title + rows; 16 between months. */
.cmonth { height: 910px; margin-bottom: var(--s-l); }
.cmonth:last-child { margin-bottom: 0; }
.cmonth-title { color: var(--ink); height: 44px; display: flex; align-items: center; justify-content: center; gap: 0.25em; font: 600 var(--t-title)/1 var(--serif); letter-spacing: 0; white-space: nowrap; }
.cmonth-title span { color: var(--sub); }
.cweeks { display: flex; flex-direction: column; gap: var(--s-xs); }
.cweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s-xs); height: 170px; }
.cweeks.is-six .cweek { height: 141px; }

/* A day: numeral row 16, picture, "+" row 27, with 2 between (chrome 47) */
.cday { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 2px; border-radius: var(--r-badge); box-shadow: inset 0 0 0 0.5px var(--cal-line); }
.cday.is-today { background: var(--cal-today); box-shadow: inset 0 0 0 0.5px var(--cal-today-line); }
.app .cday-open { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.app .cday-open.is-pressed { opacity: 1; }
.cday-num { flex: none; height: 16px; display: flex; align-items: center; justify-content: center; }
.cday-num b { padding: 1px 4px; border-radius: 999px; color: var(--sub); font: 400 var(--t-cap2)/1 var(--text); letter-spacing: 0; transition: background var(--receipt), color var(--receipt); }
.cday.is-today .cday-num b { color: var(--acc-ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--acc); }
.cday.is-sel .cday-num b { background: var(--acc); color: var(--on-acc); font-weight: 700; box-shadow: none; }
.cday-pic { flex: 1; min-height: 0; display: flex; gap: 1px; overflow: hidden; border-radius: var(--r-badge); }
.cthumb { position: relative; flex: 1; min-width: 0; display: block; border-radius: var(--r-badge); }
.cthumb .lay img:is([data-halo], [data-halo-l]) { filter: drop-shadow(0 0 1.5px rgba(var(--halo-rgb), var(--halo))); }
.cthumb.is-planned .lay { opacity: 0.6; }
.cthumb.is-photo { overflow: hidden; background: var(--card); }
.cthumb.is-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.cthumb.is-photo.is-planned img { opacity: 0.6; }
.cthumb.is-planned::after { content: ""; position: absolute; inset: 0; border: 1px dashed var(--cal-plan-line); border-radius: var(--r-badge); pointer-events: none; }
.app .cday-add { position: relative; flex: none; height: 27px; display: block; padding: 0 3px 3px; }
.cday-add > span { display: grid; place-items: center; height: 24px; border-radius: 5px; background: var(--cal-plus); color: var(--acc-ink); }
.cday-add .i { width: 15px; height: 15px; stroke-width: 2.6; }
.cday-count { position: absolute; top: 2px; left: 5px; padding: 0 3px; border-radius: 999px; background: var(--acc); color: var(--on-acc); font: normal 700 8px/11px var(--text); }
.cday-blank { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .cthumb.arrive { animation: v4-arrive 0.2s cubic-bezier(0.2, 0.9, 0.3, 1) 0.18s both; }
}

/* The legend band and Today, then the calendar-access card */
.cal-band { flex: none; display: flex; align-items: center; gap: var(--s-s); height: 32px; }
.cal-legend { display: flex; align-items: center; gap: var(--s-m); min-width: 0; color: var(--sub); font-size: var(--t-cap2); letter-spacing: 0; white-space: nowrap; }
.cal-legend > span { display: inline-flex; align-items: center; gap: var(--s-xs); }
.leg-tile { position: relative; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; background: var(--bg); color: var(--acc); }
.leg-tile .i { width: 12px; height: 12px; }
.leg-tile.is-planned .i { opacity: 0.6; }
.leg-tile.is-planned::after { content: ""; position: absolute; inset: 0; border: 1px dashed var(--cal-plan-line); border-radius: 4px; }
.leg-trip { display: block; width: 10px; height: 3px; border-radius: 2px; background: var(--cal-orange); }
.app .cal-today { margin-left: auto; flex: none; height: 32px; padding: 0 var(--s-m); border-radius: 16px; background: var(--fill-strong); color: var(--ink); font: 600 var(--t-cap)/1 var(--text); letter-spacing: 0; transition: opacity var(--press); }
.app .cal-access { flex: none; display: flex; align-items: center; gap: var(--s-s); width: 100%; padding: var(--s-m); border-radius: var(--r-card); background: var(--fill); text-align: left; transition: opacity var(--press); }
.cal-access > .i:first-child { flex: none; width: 26px; height: 26px; }
.cal-access > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-access b { font-size: var(--t-sub); font-weight: 500; letter-spacing: -0.01em; }
.cal-access small { color: var(--sub); font-size: var(--t-cap); line-height: 1.3; letter-spacing: 0; }
.cal-access > .i:last-child { flex: none; width: 13px; height: 13px; color: var(--sub); }

/* ---------- The day "+" chooser (calendar-chooser.js) ---------- */
.sheet-wrap.dc-wrap .sheet { left: 9px; right: 9px; border-radius: 36px; background: var(--dc-sheet); }
.mini-sheet.dc-body { display: flex; flex-direction: column; gap: var(--s-l); padding: var(--s-xl) var(--s-l) 40px; }
.dc-head { display: flex; align-items: center; gap: var(--s-m); }
.dc-leafwrap { flex: none; display: block; width: 84px; height: 104px; }
.dc-leaf { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 0; }
.dc-leaf img { display: block; width: 100%; height: 100%; }
.dc-leaf b { position: absolute; display: flex; align-items: center; justify-content: center; font-family: ui-rounded, "SF Pro Rounded", var(--text); line-height: 1; letter-spacing: 0; white-space: nowrap; }
.dc-leaf-wd { left: 32.1%; top: 13.3%; width: 35.4%; height: 17.8%; color: #fff; font-size: 10.9px; font-weight: 800; }
.dc-leaf-day { left: 8.8%; top: 32.5%; width: 82.7%; height: 60.4%; color: var(--dc-ink); font-size: 39.5px; font-weight: 700; }
.dc-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s-xs); }
.dc-dist { color: var(--acc-ink); font-size: var(--t-sub); font-weight: 600; letter-spacing: -0.01em; }
.dc-date { font: 600 24px/1.2 var(--serif); letter-spacing: 0; text-wrap: balance; }
.dc-cards { display: flex; flex-direction: column; gap: var(--s-s); }
.dc-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-s); }
.app .dc-card {
  display: flex; flex-direction: column; gap: var(--s-s); min-width: 0; padding: var(--s-s) var(--s-s) var(--s-m);
  border-radius: var(--r-panel); background: var(--dc-card); box-shadow: inset 0 0 0 1px var(--dc-edge);
  text-align: center; transition: transform var(--press), opacity var(--press);
}
.app .dc-card.is-pressed { transform: scale(0.97); opacity: 0.85; }
.app .dc-card.is-wide { flex-direction: row; align-items: center; gap: var(--s-m); padding: var(--s-s) var(--s-l) var(--s-s) var(--s-s); text-align: left; }
.dc-name { font: 600 17px/1.2 var(--serif); letter-spacing: 0; color: var(--ink); }
.dc-stage { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-card); background: var(--dc-stage); overflow: hidden; container-type: size; }
.dc-card.is-wide .dc-stage { flex: none; width: 128px; height: 96px; }
.dc-p { position: absolute; left: var(--x); top: var(--y); height: var(--h); transform: translate(-50%, -50%); }
.dc-p img { display: block; height: 100%; width: auto; max-width: none; }
.dc-a { display: block; height: 100%; transition-property: transform, opacity; transition-delay: var(--d, 0s), var(--d, 0s); }
.dc-bub { aspect-ratio: 1; }
.dc-bubble { width: 100%; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 0.75px rgba(0, 0, 0, 0.18), 0 0 3px rgba(255, 255, 255, 0.7); }
.dc-square { position: relative; }
.dc-sq-n { position: absolute; left: 31.4%; top: 29.3%; height: 20%; display: flex; align-items: center; color: var(--dc-ink); font: 700 15.3cqh/1 ui-rounded, "SF Pro Rounded", var(--text); letter-spacing: 0; }
.dc-hover { display: block; height: 100%; }
/* Each picture's one move, released by .is-settled 120 ms after the sheet opens (springs as linear(), calendar-chooser.js). */
.dc-leaf { transform: perspective(260px) rotateX(-75deg); opacity: 0; transition-duration: var(--t-leaf), 0.3s; transition-timing-function: var(--e-leaf), ease-out; }
.dc-mann { transform: perspective(170px) translateY(25cqh) rotateY(55deg); opacity: 0; transition-duration: var(--t-mann), 0.3s; transition-timing-function: var(--e-mann), ease-out; }
.dc-tick { transform: scale(1.9); opacity: 0; transition-duration: var(--t-tick), 0.2s; transition-timing-function: var(--e-tick), ease-out; }
.dc-piece { transform: scale(0.4); opacity: 0; transition-duration: var(--t-piece), 0.2s; transition-timing-function: var(--e-piece), ease-out; }
.dc-closet { transform-origin: 50% 4%; transform: translateX(-30cqw) rotate(-9deg); opacity: 0; transition-duration: var(--t-closet), 0.35s; transition-timing-function: var(--e-closet), ease-out; }
.dc-thinker { transform: translateY(60cqh); opacity: 0; transition-duration: var(--t-thinker), 0.25s; transition-timing-function: var(--e-thinker), ease-out; }
.dc-bubble { transform: scale(0.1); opacity: 0; transition-duration: var(--t-bubble), 0.2s; transition-timing-function: var(--e-bubble), ease-out; }
.dc-square { transform: scale(0.7); opacity: 0; transition-duration: var(--t-square), 0.25s; transition-timing-function: var(--e-square), ease-out; }
.dc-pen { transform: translate(35cqw, -45cqh); opacity: 0; transition-duration: var(--t-pen), 0.3s; transition-timing-function: var(--e-pen), ease-out; }
.dc-wrap.is-settled .dc-a { transform: none; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes dc-hover { to { transform: translate(2.5cqw, -3.5cqh); } }
  .dc-wrap.is-settled .dc-hover { animation: dc-hover 1.8s ease-in-out 1.25s infinite alternate; }
}
@media (prefers-reduced-motion: reduce) { .dc-hover { animation: none !important; } }

/* ---------- A day's page ---------- */
.dentries { display: flex; flex-direction: column; gap: 40px; }
.dentry { display: flex; flex-direction: column; gap: var(--s-xl); transition: opacity 0.2s ease-out, transform 0.2s ease-out; }
.dentry.is-leaving { opacity: 0; transform: scale(0.97); }
.dhead { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.dhead-t { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; font: 600 var(--t-sub)/1.2 var(--text); letter-spacing: -0.01em; }
.dhead-t .i { width: 18px; height: 18px; }
.app .dremove { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-right: -12px; padding: 0 12px; color: var(--red); font-size: var(--t-sub); transition: opacity var(--press); }
.app .dremove.is-pressed { opacity: 0.5; }
.dremove .i { width: 19px; height: 19px; }
.app .dunplan { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--acc-ink); font-size: var(--t-cap); }
.dunplan .i { width: 15px; height: 15px; }
.dherog { display: flex; flex-direction: column; gap: var(--s-m); }
.dhero { position: relative; display: block; height: 460px; }
.dhero.is-photo { display: flex; justify-content: center; }
.dhero.is-photo img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: cover; border-radius: var(--r-hero); }
/* The try-on side and the Layout side share the hero's box (.xf in demo.v5.css crossfades them). */
.xf > .dside-try { display: flex; justify-content: center; }
.dtry-box { position: relative; display: block; height: 100%; max-width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--r-hero); background: var(--card); transition: transform var(--press); }
.dtry-box img { display: block; width: 100%; height: 100%; object-fit: cover; }
.app .dside-try.is-pressed { opacity: 1; }
.dside-try.is-pressed .dtry-box { transform: scale(0.985); }
.dside-try.is-waiting img { opacity: 0; }
.dside-try.is-ready img { opacity: 1; transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1); }
.dtry-box .ok-wait { border-radius: inherit; transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1); }
.dside-try.is-ready .ok-wait { opacity: 0; }
.dtoggle { align-self: flex-start; display: inline-flex; padding: 2px; border-radius: 999px; background: var(--fill-strong); }
.app .dtoggle button { padding: 6px var(--s-l); border-radius: 999px; font-size: var(--t-sub); transition: background var(--receipt), color var(--receipt); }
.app .dtoggle button.is-on { background: var(--acc); color: var(--on-acc); font-weight: 600; }
.dnotry { display: flex; align-items: center; gap: var(--s-m); }
.dnotry > .i { flex: none; width: 24px; height: 24px; color: var(--sub); }
.dnotry span { display: flex; flex-direction: column; gap: 1px; }
.dnotry b { font-size: var(--t-sub); font-weight: 600; letter-spacing: -0.01em; }
.dnotry small { color: var(--sub); font-size: var(--t-cap); letter-spacing: 0; }
.app .dtry { min-height: 44px; border-radius: var(--r-card); font-size: var(--t-sub); }
.dlinks { display: flex; flex-direction: column; align-items: flex-start; margin: -12px 0; }
.app .dlink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--acc-ink); font-size: var(--t-cap); letter-spacing: 0; transition: opacity var(--press); }
.dlink .i { width: 15px; height: 15px; }
.dlink .dlink-chev { width: 10px; height: 10px; color: var(--sub); margin-left: -2px; }
.dgar { margin-top: 0; }
[data-screen="day"] .strip.named > * { flex-basis: 96px; }
[data-screen="day"] .page-body { display: flex; flex-direction: column; }
.dempty { flex: 1; display: grid; place-items: center; min-height: 200px; color: var(--sub); font-size: var(--t-body); text-align: center; }
.dfoot { display: grid; gap: var(--s-s); }

/* ---------- Log / Plan (OutfitPicker in a page sheet) ---------- */
[data-screen="log"] .page-body { display: flex; flex-direction: column; padding-bottom: calc(var(--safe-bottom) - 5px); }
.lg-title { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.lg-title small { color: var(--sub); font: 400 var(--t-cap)/1.2 var(--text); letter-spacing: 0; }
.app .lg-act { flex: none; min-height: 44px; margin-top: var(--s-s); border-radius: var(--r-card); font-size: var(--t-sub); }
.app .lg-act .i { width: 19px; height: 19px; }
.lg-grid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: var(--s-s); padding: var(--s-s) 0; }
.app .lg-tile { position: relative; display: block; height: var(--tile-h, 260px); min-width: 0; border-radius: var(--r-card); }
.app .lg-tile[hidden] { display: none; }
.app .lg-tile.is-pressed { opacity: 1; }
.lg-tile.is-pressed .lg-pic { transform: scale(0.96); }
.lg-pic { position: absolute; inset: 6px 4px 34px; display: block; transition: transform var(--press); }
.lg-pic.is-photo { inset: 0 0 34px; border-radius: var(--r-card); overflow: hidden; }
.lg-pic.is-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.lg-glyph { position: absolute; right: 2px; bottom: 4px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, 0.85); color: #fff; }
.lg-glyph .i { width: 14px; height: 14px; }
.lg-tile::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); opacity: 0; pointer-events: none; box-shadow: inset 0 0 0 1.5px var(--sheet-page), inset 0 0 0 4px var(--acc), inset 0 0 0 5.5px var(--sheet-page); transition: opacity var(--receipt); }
.lg-tile.is-on::after { opacity: 1; }
.lg-check { position: absolute; top: 7px; left: 7px; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sheet-page); color: var(--acc); opacity: 0; transform: scale(0.6); transition: opacity var(--receipt), transform var(--receipt); }
.lg-check .i { width: 24px; height: 24px; }
.lg-tile.is-on .lg-check { opacity: 1; transform: none; }
.lg-moves { position: absolute; left: 6px; bottom: 38px; display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.85); color: #fff; font-size: var(--t-cap2); font-weight: 600; }
.lg-moves .i { width: 11px; height: 11px; }
.lg-empty { padding: 2rem 0; color: var(--sub); text-align: center; }
.lg-empty[hidden] { display: none; }
.lg-none { display: grid; justify-items: center; gap: 8px; padding: 4rem 1rem; text-align: center; color: var(--sub); }
.lg-none .i { width: 40px; height: 40px; }
.lg-none b { color: var(--ink); font-size: 20px; }
.lg-foot { position: sticky; z-index: 3; bottom: calc(var(--safe-bottom) - 5px); display: flex; align-items: center; gap: 18px; margin: var(--s-s) 18px 0 12px; }
.lg-search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-s); height: 48px; padding: 0 var(--s-l); border-radius: 24px;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 0 0 0.5px var(--glass-rim), inset 0 1px 0 var(--glass-hi), var(--glass-shadow); color: var(--sub);
}
.lg-search .i { flex: none; width: 20px; height: 20px; }
.lg-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: 400 var(--t-body) var(--text); letter-spacing: -0.01em; -webkit-appearance: none; appearance: none; }
.lg-search input::placeholder { color: var(--sub); }
.lg-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.app .lg-commit {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-s); min-height: 50px; padding: 0 var(--s-l); border-radius: 25px;
  background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: var(--t-body);
  box-shadow: inset 0 0 0 0.5px rgba(127, 127, 127, 0.25), 0 3px 10px rgba(0, 0, 0, 0.22); transition: transform var(--press), opacity var(--press), background var(--receipt), color var(--receipt);
}
.app .lg-commit.is-pressed { opacity: 0.8; transform: scale(0.97); }
.app .lg-commit:disabled { background: var(--glass); color: var(--sub); box-shadow: inset 0 0 0 0.5px var(--glass-rim), var(--glass-shadow); cursor: default; }
.lg-commit .i { width: 20px; height: 20px; stroke-width: 2.6; }
.lg-verb { display: inline-grid; min-width: 3.3em; height: 1.3em; overflow: hidden; line-height: 1.3em; }
.lg-verb > span { grid-area: 1 / 1; text-align: center; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes lg-in-up { from { transform: translateY(70%); opacity: 0; } }
  @keyframes lg-in-down { from { transform: translateY(-70%); opacity: 0; } }
  @keyframes lg-out-up { to { transform: translateY(-70%); opacity: 0; } }
  @keyframes lg-out-down { to { transform: translateY(70%); opacity: 0; } }
  @keyframes lg-sent { 40% { transform: scale(1.25); } }
  .roll-in-up { animation: lg-in-up 0.2s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
  .roll-in-down { animation: lg-in-down 0.2s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
  .roll-out-up { animation: lg-out-up 0.2s ease-out both; }
  .roll-out-down { animation: lg-out-down 0.2s ease-out both; }
  .lg-commit.is-sent .i { animation: lg-sent 0.2s cubic-bezier(0.2, 0.9, 0.3, 1); }
}
@media (prefers-reduced-motion: reduce) { .dside-try img, .dtry-box .ok-wait { transition: none !important; } }
