/* Feel Good: the daytime side of CrumbJar. Procrastinate is the night desk; Feel Good is the same room in the morning,
   with a wooden cabinet of small things on the wall. Original design, 4 Oct 2026.
   Tokens are set on body.fg so the night hub's tokens (brand.css) are untouched. */

body.fg {
  --bg: #d9ebf0; --surface: #fffdf7; --surface-2: #f4efe2; --ink: #2a2140; --muted: #5b5470; --line: #d6cdb8;
  --accent: #23695b; --accent-ink: #ffffff; --accent-soft: #d8ece5; --focus: #1a5fd0;
  --fg-paper: #fffdf7; --fg-wood: #d9a96f; --fg-wood-light: #ecc995; --fg-wood-dark: #9c6436; --fg-wood-deep: #6b4124;
  --fg-joy: #f2994a; --fg-calm: #5d9fc1; --fg-wonder: #8a78d6; --fg-connection: #df7385; --fg-small-wins: #5fae66;
  --note-ink: #2a2140;
  color-scheme: light;
  background: linear-gradient(180deg, #cfe5ee 0, #e4eee6 420px, #f2ead6 900px) no-repeat, #f2ead6;
  color: var(--ink);
}
body.fg a { color: var(--accent); }
/* The hidden attribute always wins: .fg-bar, .btn and friends set display, which would otherwise show hidden things. */
body.fg [hidden] { display: none !important; }
body.fg :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Header and footer in daylight. */
body.fg .site-header { background: color-mix(in srgb, #fffdf7 88%, transparent); border-bottom: 1px solid rgba(42, 33, 64, .1); }
body.fg .site-nav a { color: var(--ink); }
body.fg .site-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
body.fg .site-nav a:hover { border-bottom-color: rgba(35, 105, 91, .45); }
body.fg .hub-tagline, body.fg .header-note { color: var(--ink); }
body.fg .site-footer { background: #efe5cf; border-top: 1px solid rgba(42, 33, 64, .08); }
body.fg .footer-nav a, body.fg .footer-small { color: var(--muted); }
body.fg .btn { --b: var(--fg-paper); border-color: rgba(42, 33, 64, .22); }
body.fg .btn-primary, body.fg .fg-btn-primary { --b: var(--accent); --i: #fff; border-color: var(--accent); }

/* ---------- The two sides switch (also on the night front page) ---------- */
.mode-switch { display: inline-flex; gap: .35rem; padding: .3rem; border-radius: 14px; background: rgba(255, 255, 255, .1); margin: 0 auto 1.5rem; }
/* min-height: a 44 x 44 px tap target at every width, including phones where the note is hidden (re-audit 5 Oct 2026). */
.mode-switch-item { display: grid; gap: .05rem; align-content: center; text-align: left; padding: .5rem 1rem .55rem; border-radius: 10px; text-decoration: none; color: inherit; min-width: 9.5rem; min-height: 44px; box-sizing: border-box; }
.mode-switch-label { font: 700 1.2rem/1.1 var(--font-display); }
.mode-switch-note { font-size: .78rem; line-height: 1.25; opacity: .8; }
.hub .mode-switch .mode-switch-item { color: var(--ink); }
.hub .mode-switch .is-on { background: #ffd84d; color: #1d1a22; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.hub .mode-switch .mode-switch-item:not(.is-on):hover { background: rgba(255, 255, 255, .08); }
body.fg .mode-switch { background: rgba(42, 33, 64, .07); }
body.fg .mode-switch .mode-switch-item { color: var(--ink); }
body.fg .mode-switch .is-on { background: var(--fg-paper); color: var(--ink); box-shadow: 0 3px 10px rgba(42, 33, 64, .14); }
body.fg .mode-switch .mode-switch-item:not(.is-on):hover { background: rgba(255, 255, 255, .55); }
@media (max-width: 520px) { .mode-switch-item { min-width: 44px; flex: 1; padding: .45rem .7rem; } .mode-switch-note { display: none; } .mode-switch { display: flex; } }

/* ---------- Collection page ---------- */
.fg-main { flex: 1; }
.fg-hero { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem 2rem; padding-top: clamp(1.25rem, 3vw, 2.25rem); padding-bottom: 1.25rem; }
.fg-hero .mode-switch { grid-column: 1 / -1; justify-self: start; margin-bottom: .25rem; }
.fg-hero h1 { font: 700 clamp(2.8rem, 9vw, 5.4rem)/.95 var(--font-display); margin: 0; letter-spacing: -.02em; color: var(--ink); }
.fg-hero-sub { font: 400 clamp(1.15rem, 2.6vw, 1.45rem)/1.3 var(--font-display); margin: .6rem 0 0; max-width: 34ch; color: var(--ink); }
/* A small window with morning sun; drawn in CSS. */
.fg-window { position: relative; width: clamp(120px, 18vw, 190px); aspect-ratio: 4 / 5; border: 9px solid var(--fg-paper); border-radius: 90px 90px 6px 6px; background: linear-gradient(180deg, #9fd0e8, #e8f2e2 75%, #f7e3b8); box-shadow: 0 10px 24px rgba(42, 33, 64, .14), inset 0 0 0 2px rgba(42, 33, 64, .06); overflow: hidden; }
.fg-window::before, .fg-window::after { content: ''; position: absolute; background: var(--fg-paper); }
.fg-window::before { left: calc(50% - 3px); top: 0; bottom: 0; width: 6px; }
.fg-window::after { left: 0; right: 0; top: 55%; height: 6px; }
.fg-sun { position: absolute; width: 38%; aspect-ratio: 1; border-radius: 50%; right: 14%; top: 22%; background: radial-gradient(circle, #fff3c0 0 45%, #ffd36b 46% 70%, rgba(255, 211, 107, 0) 71%); }
.fg-sill { position: absolute; left: -10px; right: -10px; bottom: 0; height: 12%; background: linear-gradient(#7cbf7a, #5c9c62); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
@media (max-width: 600px) { .fg-window { display: none; } .fg-hero { grid-template-columns: 1fr; } }

.fg-shelf { padding-bottom: 3rem; }
.fg-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: .5rem 0 .75rem; }
.fg-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.fg-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: .45rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink); background: rgba(255, 253, 247, .7); border: 1.5px solid rgba(42, 33, 64, .14); font-weight: 650; }
.fg-tabs a:hover { background: var(--fg-paper); border-color: rgba(42, 33, 64, .35); }
.fg-tabs a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.fg-surprise { display: inline-flex; align-items: center; gap: .5rem; min-height: 48px; padding: .55rem 1.3rem; border-radius: 12px; background: var(--fg-wood-deep); color: #fff7e8 !important; text-decoration: none; font: 700 1.15rem/1 var(--font-display); box-shadow: 0 4px 0 #4a2c17; transform: rotate(-1deg); }
.fg-surprise:hover { transform: rotate(0) translateY(-1px); }
.fg-surprise:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a2c17; }
.fg-count { margin: 0 0 .9rem; color: var(--muted); font-size: .95rem; }

/* The cabinet: the wood shows through the gaps between cubbies. */
.cabinet { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); gap: 14px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .04) 0 2px, transparent 2px 100%) 0 0 / 46px 100%, var(--fg-wood);
  border-radius: 14px; border: 6px solid var(--fg-wood-dark); box-shadow: 0 16px 34px rgba(74, 44, 23, .22), inset 0 0 0 2px rgba(255, 255, 255, .18); }
.cubby { --cat: var(--fg-joy); min-width: 0; }
.cubby-calm { --cat: var(--fg-calm); } .cubby-wonder { --cat: var(--fg-wonder); } .cubby-connection { --cat: var(--fg-connection); } .cubby-small-wins { --cat: var(--fg-small-wins); }
.cubby-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink) !important; background: #f6e7cb; border-radius: 6px; overflow: hidden;
  box-shadow: inset 0 10px 16px -10px rgba(74, 44, 23, .45), inset 0 0 0 1px rgba(74, 44, 23, .12); }
.cubby-art { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 10px 10px 0; }
.cubby-art img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.cubby-initial { font: 700 4rem/1 var(--font-display); color: var(--cat); }
.cubby-tag { position: relative; display: grid; gap: .3rem; margin: 0 10px 10px; padding: .75rem .85rem .8rem; background: var(--fg-paper); border-radius: 4px; box-shadow: 0 2px 4px rgba(42, 33, 64, .12); border-top: 5px solid var(--cat); flex: 1; align-content: start; }
.cubby-name { font: 700 1.3rem/1.1 var(--font-display); }
.cubby-invite { font-size: .98rem; line-height: 1.35; }
.cubby-meta { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.cubby-cats { font-weight: 650; color: var(--ink); }
.cubby-flags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.cubby-flag { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.cubby-flag svg { width: 14px; height: 14px; }
.cubby-link:hover .cubby-art img, .cubby-link:focus-visible .cubby-art img { transform: scale(1.04) rotate(-1deg); }
.cubby-link:hover .cubby-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .15em; }
.cubby-link:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.fg-small-print { margin-top: 1.25rem; color: var(--muted); font-size: .92rem; max-width: 70ch; }

/* ---------- One experience ---------- */
.fg-frame { padding-bottom: 2rem; }
.fg-frame-top { padding-top: 1rem; }
.fg-back { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-weight: 650; text-decoration: none; }
.fg-back::before { content: ''; width: .55em; height: .55em; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); margin-right: .15em; }
.fg-back:hover { text-decoration: underline; }
.fg-frame-head { margin: .25rem 0 1rem; }
.fg-frame-head h1 { font: 700 clamp(2rem, 5.5vw, 3.2rem)/1 var(--font-display); margin: 0; }
.fg-invite { font: 400 clamp(1.1rem, 2.4vw, 1.35rem)/1.3 var(--font-display); margin: .35rem 0 0; color: var(--ink); }
.fg-stage { min-height: 320px; }
.fg-loading, .fg-noscript { padding: 2rem; text-align: center; background: var(--fg-paper); border-radius: 12px; color: var(--muted); }
/* Without JavaScript nothing is getting ready: only the noscript note shows (the kit adds .js to <html> when scripts run). */
html:not(.js) .fg-loading { display: none; }
.fg-after { margin-top: 1.5rem; font-size: .95rem; color: var(--muted); }
.fg-after p { margin: 0; }

/* Scene + controls. */
.fg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 1rem; align-items: start; }
.fg-layout-wide { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) { .fg-layout { grid-template-columns: minmax(0, 1fr); } }
.fg-scene-wrap { position: relative; min-width: 0; }
.fg-scene { display: block; width: 100%; height: auto; border-radius: 14px; background: var(--fg-paper); box-shadow: 0 10px 28px rgba(42, 33, 64, .14); user-select: none; -webkit-user-select: none; }
/* Scenes let the page scroll by default; a scene that takes drags turns that off on itself (drawGestures does). */
canvas.fg-scene, svg.fg-scene { touch-action: manipulation; }
.fg-scene-caption { margin: .5rem .25rem 0; font-size: .9rem; color: var(--muted); }
.fg-panel { display: grid; gap: .9rem; background: var(--fg-paper); border-radius: 14px; padding: 1rem; box-shadow: 0 6px 18px rgba(42, 33, 64, .1); min-width: 0; }
.fg-panel > * { margin: 0; }
.fg-panel h2, .fg-panel h3 { font-family: var(--font-display); }

.fg-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.fg-btn { min-height: 44px; padding: .5rem 1rem; gap: .4rem; }
.fg-btn.btn-small { min-height: 44px; padding: .35rem .85rem; }
.fg-btn-soft { --b: var(--surface-2); border-color: transparent; }
.fg-btn-soft:hover { border-color: rgba(42, 33, 64, .35); }
.fg-btn-ghost { --b: transparent; }
.fg-btn-big { min-height: 56px; font-size: 1.1rem; padding: .75rem 1.5rem; }
.fg-icon { display: inline-flex; }
.fg-icon svg { width: 20px; height: 20px; }
.fg-toggle[aria-pressed="true"] { --b: var(--accent-soft); border-color: var(--accent); }
.fg-sound[aria-pressed="true"] { --b: var(--accent-soft); }

.fg-choice { border: 0; padding: 0; margin: 0; min-width: 0; }
.fg-legend { font-weight: 700; font-size: .95rem; padding: 0; margin-bottom: .4rem; }
.fg-choice-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.fg-chip { position: relative; display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .85rem; border-radius: 999px; background: var(--surface-2); border: 2px solid transparent; cursor: pointer; font-weight: 600; font-size: .95rem; }
.fg-chip:hover { border-color: rgba(42, 33, 64, .3); }
.fg-choice-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fg-chip:has(.fg-choice-input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.fg-chip:has(.fg-choice-input:checked)::after { content: ''; width: .4em; height: .7em; border-right: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(45deg) translate(-1px, -2px); }
.fg-chip:has(.fg-choice-input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.fg-swatch { display: inline-flex; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.fg-swatch span { width: 11px; height: 22px; }

.fg-range { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; align-items: center; }
.fg-range-label { font-weight: 650; font-size: .95rem; }
.fg-range-value { font-size: .88rem; color: var(--muted); text-align: right; }
.fg-range-input { grid-column: 1 / -1; width: 100%; min-height: 44px; accent-color: var(--accent); }

.fg-field { display: grid; gap: .35rem; }
.fg-field-label { font-weight: 700; }
.fg-field textarea, .fg-field input[type="text"] { width: 100%; border-radius: 10px; border: 1.5px solid rgba(42, 33, 64, .25); background: #fff; padding: .65rem .8rem; font-size: 1.05rem; line-height: 1.4; }
.fg-field textarea { resize: vertical; min-height: 4.5rem; }
.fg-hint { margin: 0; font-size: .88rem; color: var(--muted); }
.fg-count-chars { font-size: .82rem; color: var(--muted); min-height: 1em; }

.fg-storage-note { display: flex; gap: .4rem; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.fg-storage-note .fg-icon svg { width: 16px; height: 16px; margin-top: .15em; }
.fg-notice { padding: .7rem .9rem; border-radius: 10px; background: #eef4f7; border-left: 4px solid var(--fg-calm); font-size: .95rem; }
.fg-notice-warn { background: #fff4e0; border-left-color: #c77a14; }

/* "Clear this?" dialogs (7 Oct 2026 audit): on the page, never the browser's own box. ui.js confirmDialog. The fallback
   class is for browsers without <dialog>.showModal(). The fade only runs where the device has not asked for less motion. */
.fg-dialog { width: min(28rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; box-sizing: border-box; padding: 1.25rem 1.35rem 1.1rem; border: 2px solid rgba(42, 33, 64, .18); border-radius: 14px; background: var(--fg-paper); color: var(--ink); box-shadow: 0 18px 44px rgba(42, 33, 64, .28); }
.fg-dialog::backdrop { background: rgba(42, 33, 64, .45); }
.fg-dialog-fallback { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 1000; }
.fg-dialog-title { font: 700 1.35rem/1.2 var(--font-display); margin: 0 0 .5rem; }
.fg-dialog-text { margin: 0 0 1rem; color: var(--muted); }
.fg-dialog-actions { justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin: 0; }
.fg-dialog-actions .fg-btn { min-height: 44px; min-width: 44px; }
@media (prefers-reduced-motion: no-preference) {
  .fg-dialog[open] { animation: fg-dialog-in .16s ease-out; }
  @keyframes fg-dialog-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

.fg-finish { margin-top: 1rem; padding: 1.1rem 1.25rem; border-radius: 14px; background: var(--fg-paper); border: 2px dashed rgba(42, 33, 64, .2); }
.fg-finish:focus { outline: none; }
.fg-finish:focus-visible { outline: 3px solid var(--focus); }
.fg-finish-title { font: 700 1.6rem/1.1 var(--font-display); margin: 0 0 .35rem; }
.fg-finish-text { margin: 0 0 .75rem; }
.fg-finish-more { margin: .75rem 0 0; font-size: .92rem; color: var(--muted); }
/* "Try another" and "back to Feel Good" are the way on from a finished page: full-size tap targets, not inline text. */
.fg-finish-more a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }

/* A readable card for user text (recall, postcards, tickets). */
.fg-card { background: #fff; border-radius: 12px; padding: 1.1rem 1.25rem; box-shadow: 0 6px 16px rgba(42, 33, 64, .12); overflow-wrap: anywhere; white-space: pre-wrap; }

/* Lists of saved things. */
.fg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.fg-list-item { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: start; padding: .7rem .8rem; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(42, 33, 64, .1); }
.fg-list-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.fg-list-meta { font-size: .82rem; color: var(--muted); }
.fg-list-actions { display: flex; gap: .3rem; grid-row: span 2; }

/* my-things and credits */
.fg-plainpage { padding-block: 1.5rem 3rem; }
.fg-plainpage h1 { font: 700 clamp(2rem, 5vw, 2.8rem)/1.05 var(--font-display); }
#fg-mythings { display: grid; gap: .9rem; }
#fg-mythings > * { margin: 0; }
.fg-saved-h { font: 700 1.3rem/1.2 var(--font-display); margin: .5rem 0 0; }
.fg-saved-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
/* One layout for every row: words on the left, buttons on the right; on a phone the buttons go underneath. */
.fg-saved-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; padding: .75rem .9rem; background: var(--fg-paper); border-radius: 10px; box-shadow: 0 1px 3px rgba(42, 33, 64, .1); }
.fg-saved-text { display: grid; gap: .15rem; min-width: 0; }
.fg-saved-text > * { margin: 0; }
.fg-saved-name { font-family: inherit; font-size: 1.05rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.fg-saved-name a, .fg-saved-pages a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.fg-saved-note { font-size: .92rem; color: var(--ink); overflow-wrap: anywhere; }
.fg-saved-meta { color: var(--muted); font-size: .9rem; }
.fg-saved-actions { justify-content: flex-end; }
.fg-saved-pages { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
@media (max-width: 560px) {
  .fg-saved-item { grid-template-columns: minmax(0, 1fr); }
  .fg-saved-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .cubby-art img, .fg-surprise { transition: none; }
  .cubby-link:hover .cubby-art img { transform: none; }
}
