/* moodshape site, in the app's own look (apps/mobile/src/theme.ts).
   Two quiet colours (Soft Sand, Midnight Navy) and one loud (Coral, only for the one thing to tap).
   Emphasis is coloured text, never a highlighted background. A feeling's page takes that feeling's own palette
   (feelingTone): soft background and deep text in light mode, swapped in dark mode, its loud colour for the shape. */

:root {
  --bg: #F5EFE6; --card: #FFFBF5; --text: #14233A; --muted: #55606F; --line: #E3D9CB;
  --accent: #FF6F61; --on-accent: #14233A; --help: #B3261E; --heading: #A8352A; --ink: #A8352A;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0E1726; --card: #172338; --text: #F5EFE6; --muted: #AEB7C5; --line: #2B3A52; --accent: #FF7A6B; --heading: #FF9A8E; --ink: #FF9A8E; }
}
body.toned { --bg: var(--l-bg); --card: var(--l-card); --text: var(--l-fg); --muted: var(--l-muted); --line: var(--l-line); --accent: var(--l-loud); --on-accent: var(--l-on-loud); --heading: var(--l-ink); --ink: var(--l-ink); }
@media (prefers-color-scheme: dark) {
  body.toned { --bg: var(--d-bg); --card: var(--d-card); --text: var(--d-fg); --muted: var(--d-muted); --line: var(--d-line); --accent: var(--d-loud); --on-accent: var(--d-on-loud); --heading: var(--d-ink); --ink: var(--d-ink); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/26px system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; position: relative; min-height: 100vh; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 8px; z-index: 9; }

.top, main, .foot { max-width: 640px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); position: relative; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.top nav { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 600; }
.top nav a { text-decoration: none; }
.top nav a:hover { text-decoration: underline; }
.help-btn { background: var(--help); color: #fff !important; border-radius: 999px; padding: 6px 14px; min-height: 36px; display: inline-flex; align-items: center; }
main { padding-top: 20px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 460px) { .top nav { gap: 12px; } .top nav .wide { display: none; } }

/* type (theme.ts make()) */
h1 { font-size: 26px; line-height: 32px; font-weight: 700; margin: 0; }
h1.hero, .hero { font-size: 28px; line-height: 34px; font-weight: 700; }
h2 { font-size: 19px; line-height: 26px; font-weight: 600; margin: 0; }
p { margin: 0; }
.lead { font-size: 18px; line-height: 28px; }
.muted { color: var(--muted); font-size: 14px; line-height: 22px; }
.small { font-size: 13px; line-height: 20px; }
.subhead { font-size: 17px; line-height: 24px; font-weight: 700; color: var(--heading); margin-top: 12px; }
.eyebrow { font-size: 14px; color: var(--heading); letter-spacing: 1px; text-transform: uppercase; font-weight: 700; }
.meta { font-size: 12px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.loud { color: var(--ink); }
.link { font-weight: 600; text-decoration: underline; }
.draft { border-left: 4px solid var(--help); padding-left: 12px; color: var(--help); font-weight: 700; }
ol, ul { margin: 0; padding-left: 22px; } li { margin: 4px 0; }
.plain { padding-left: 18px; }

.section { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line); }
.section .subhead { margin-top: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }

/* buttons: primary coral, secondary navy outline (coral on sand fails as text) */
.btn { display: flex; justify-content: center; align-items: center; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 14px; padding: 18px 16px; font: inherit; font-size: 18px; font-weight: 600; text-decoration: none; cursor: pointer; width: 100%; }
.btn:hover { filter: brightness(1.04); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-size: 15px; }
.chip:hover { border-color: var(--text); }
.chip-out { border-radius: 999px; padding: 6px 12px; border: 1px solid var(--accent); color: var(--ink); }

/* shapes */
.es-shape { display: block; overflow: visible; }
.shapes-row { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }

/* tiles (Explore) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; text-decoration: none; font-size: 15px; text-align: center; }
.tile:hover { border-color: var(--text); }

/* rows (You folders / route lists) */
.rows { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rows li { margin: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); text-decoration: none; min-height: 56px; }
.row:hover { border-color: var(--text); }
.row-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row-text strong { font-size: 17px; }
.mini { display: flex; gap: 0; flex-shrink: 0; }
.chev { font-size: 26px; line-height: 28px; font-weight: 600; color: var(--muted); }

/* the opening (Intro.tsx) */
.intro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.intro-stage { width: min(var(--stage), calc(100vw - 40px)); aspect-ratio: 1; position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.intro-piece { position: absolute; opacity: 0; transform: translate(0, 0) scale(.6); }
.intro-average { position: absolute; }
.intro-average svg { width: 62%; height: auto; }
.intro-average { inset: 0; display: flex; align-items: center; justify-content: center; }
.still .intro-piece { display: none; }
.intro .lead { max-width: 30em; margin-top: 6px; }
.cta-top { display: flex; flex-direction: column; gap: 8px; text-align: center; }

/* a feeling's page (Explore ConceptDetail) */
.backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
body.toned main { isolation: isolate; }
.backdrop .art { position: absolute; inset: 0; background: var(--bg-l) top center / cover no-repeat; }
.backdrop .plate { position: absolute; inset: 0; background: var(--plate-l); opacity: var(--plate-ol); -webkit-mask: var(--plate) center / cover no-repeat; mask: var(--plate) center / cover no-repeat; }
.backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 0, transparent 300px, var(--bg) 520px); }
@media (prefers-color-scheme: dark) {
  .backdrop .art { background-image: var(--bg-d); }
  .backdrop .plate { background: var(--plate-d); opacity: var(--plate-od); }
}
.feel-head, .word-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; text-align: center; }
.entry-title { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dots { display: flex; gap: 6px; margin-top: 2px; }
.dots span { width: 22px; height: 22px; border-radius: 11px; border: 1px solid var(--line); }
.entry-rest { display: flex; flex-direction: column; gap: 18px; }

/* entry: the shape appears big and low, rises into place, then the title and the rest fade up (useEntry) */
@keyframes appear { from { opacity: 0; transform: translateY(150px) scale(.7); } to { opacity: 1; transform: translateY(150px) scale(1.3); } }
@keyframes move { from { transform: translateY(150px) scale(1.3); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.entry-shape { animation: appear 420ms cubic-bezier(.33, 1, .68, 1) both, move 560ms cubic-bezier(.65, 0, .35, 1) 680ms both; }
.entry-title { animation: fade-up 260ms cubic-bezier(.5, 1, .89, 1) 1240ms both; }
.entry-rest { animation: fade-up 380ms cubic-bezier(.5, 1, .89, 1) 1500ms both; }

/* screen transition (motion.tsx ScreenTransition): fades in and glides the last few points into place */
@keyframes screen-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes screen-side { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
main.screen { animation: screen-up 260ms cubic-bezier(.33, 1, .68, 1) both; }
main.screen.side { animation-name: screen-side; }

/* Rhythm (RhythmWave.tsx) */
.rhythm { height: 64px; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); }
.rhythm svg { display: block; height: 64px; animation: slide var(--dur) linear infinite; }
.rhythm .mid { stroke: var(--line); stroke-width: 1; }
.rhythm .wave { stroke: var(--accent); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
@keyframes slide { to { transform: translateX(calc(-1 * var(--wl))); } }

/* folds (Collapsible + Chevron) */
details.fold summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; min-height: 36px; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::before { content: '›'; font-size: 22px; display: inline-block; width: 14px; transition: transform 300ms cubic-bezier(.33, 1, .68, 1); }
details.fold[open] summary::before { transform: rotate(90deg); }
.fold-body { overflow: hidden; padding-top: 6px; }
details.small-fold summary { font-size: 14px; color: var(--muted); font-weight: 400; text-decoration: underline; }
details.small-fold summary::before { content: none; }

/* routes */
.route-hero { display: flex; align-items: center; justify-content: center; gap: 12px; }
.arrow { width: 44px; height: 2px; background: currentColor; position: relative; opacity: .6; }
.arrow::after { content: ''; position: absolute; right: -2px; top: -5px; border: 6px solid transparent; border-left-color: currentColor; }
.stones { list-style: none; padding: 0; }
.stone { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 0 0 18px; margin: 0; position: relative; }
.stone:not(:last-child)::before { content: ''; position: absolute; left: 31px; top: 66px; bottom: 4px; width: 2px; background: var(--line); }
.stone h2 a { text-decoration: none; } .stone h2 a:hover { text-decoration: underline; }
.stone p { margin-bottom: 4px; }

/* words (WordPicture: a tinted mask; 85% in light, the opposite mask at 50% in dark) */
.pic { display: block; aspect-ratio: 720 / 760; width: 100%; background: var(--accent); -webkit-mask: var(--pic) center / cover no-repeat; mask: var(--pic) center / cover no-repeat; opacity: .85; }
@media (prefers-color-scheme: dark) { .pic { -webkit-mask-image: var(--pic-dark); mask-image: var(--pic-dark); opacity: .5; } }
.wordgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.wordtile { --accent: var(--l-loud, #FF6F61); display: flex; flex-direction: column; gap: 2px; text-decoration: none; padding: 10px; border-radius: 18px; background: var(--l-bg, var(--card)); color: var(--l-fg, var(--text)); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .wordtile { --accent: var(--d-loud, #FF7A6B); background: var(--d-bg, var(--card)); color: var(--d-fg, var(--text)); } }
.wordtile .pic { border-radius: 12px; margin-bottom: 6px; }
.wordtile strong { font-size: 18px; }
.wordtile .muted { color: inherit; opacity: .75; }
.word-head .pic.big { max-width: 300px; border-radius: 20px; }

/* the ask */
.cta { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; text-align: center; padding: 22px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.cta-line { font-size: 19px; line-height: 27px; font-weight: 600; }

/* help: red only ever means help */
.help { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); font-size: 15px; line-height: 23px; display: flex; flex-direction: column; gap: 4px; }
.help-strong { border: 2px solid var(--help); background: var(--card); }
.help-strong .subhead { color: var(--text); margin: 0; }

.join { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.form { width: 100%; max-width: 440px; margin-top: 10px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.form label { font-weight: 600; }
.form input[type=email] { font: inherit; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-height: 52px; }
.form .check { font-weight: 400; font-size: 15px; line-height: 22px; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.form .check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); }

.foot { border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: max(32px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.foot .links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .intro-piece { display: none; }
}
