/* Trana Learn: one idea per screen. Dark by default, light by choice. Same file in the Tauri window and the browser. */
:root, [data-theme="dark"] {
  --bg: #0d0d10;
  --card: #141418;
  --ink: #f3f1ec;
  --ink-2: #b9b6ae;
  --ink-3: #7f7c76;
  --line: rgba(255, 255, 255, .09);
  --chip: rgba(255, 255, 255, .07);
  --rail: rgba(255, 255, 255, .08);
  --rail-on: rgba(255, 255, 255, .16);
  --glow-a: .20;
  --shade: rgba(13, 13, 16, .92);
  --l: .80; --cc: .12;           /* accent lightness and chroma, per theme */
  --heart: #ff4d6d;
  --ok: #5fd39b;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f1ea;
  --card: #fbfaf6;
  --ink: #17161a;
  --ink-2: #4b4842;
  --ink-3: #85817a;
  --line: rgba(0, 0, 0, .08);
  --chip: rgba(0, 0, 0, .05);
  --rail: rgba(0, 0, 0, .05);
  --rail-on: rgba(0, 0, 0, .10);
  --glow-a: .26;
  --shade: rgba(244, 241, 234, .94);
  --l: .55; --cc: .14;
  --heart: #e2264d;
  --ok: #1f9d63;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  --h: 40;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid oklch(var(--l) .15 var(--h)); outline-offset: 2px; border-radius: 10px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* the subject's colour behind the column on wide screens */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.backdrop i {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: oklch(var(--l) .13 var(--h)); opacity: .22; filter: blur(110px);
  transition: background-color .7s ease;
}
.backdrop i:first-child { left: calc(50% - 62vmax); top: -10vmax; }
.backdrop i:last-child { left: calc(50% - 8vmax); bottom: -30vmax; background: oklch(var(--l) .10 calc(var(--h) + 50)); opacity: .16; }

.shell { position: fixed; inset: 0; margin: 0 auto; width: 100%; max-width: 480px; }
@media (min-width: 560px) {
  .shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); box-shadow: 0 0 80px rgba(0, 0, 0, .35); }
}

/* top bar over the feed */
.top {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 0 18px;
  background: linear-gradient(var(--bg) 0, var(--bg) 55%, transparent);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.bar { display: flex; align-items: center; gap: 6px; padding: 0 14px 0 18px; height: 40px; }
.brand { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 20px; letter-spacing: -.01em; }
.brand b { font-weight: 600; color: oklch(var(--l) .13 75); }
.spacer { flex: 1; }
.streak { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 0 8px; height: 32px; border-radius: 16px; color: var(--ink-2); }
.streak svg { width: 18px; height: 18px; stroke: none; fill: var(--ink-3); transition: fill .3s; }
.streak.on { color: var(--ink); }
.streak.on svg { fill: #ff8a3d; }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); }
.iconbtn:hover { background: var(--chip); color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; }

.chips { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); display: flex; gap: 6px; overflow-x: auto; padding: 6px 18px 2px; scrollbar-width: none; scroll-padding: 0 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid transparent;
  background: var(--chip); color: var(--ink-2); font-size: 13.5px; font-weight: 550; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: oklch(var(--l) .14 var(--h)); }
.chip.all::before { display: none; }
.chips .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* the feed: one card per screen */
.feed {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; outline: none;
}
.feed::-webkit-scrollbar { display: none; }
.card {
  position: relative; height: 100vh; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: var(--card); outline: none; contain: layout paint;
}
.card + .card { border-top: 1px solid var(--line); }
.glow {
  position: absolute; inset: -20% -30% auto -30%; height: 75%;
  background: radial-gradient(closest-side, oklch(var(--l) .14 var(--h) / var(--glow-a)), transparent 72%);
  pointer-events: none;
}
.body {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 112px) 82px calc(env(safe-area-inset-bottom) + 40px) 24px;
  overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain;
}
.body::-webkit-scrollbar { display: none; }
.body > * { flex-shrink: 0; }
.card.open .body { justify-content: flex-start; }
.meta { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.meta .chip { color: oklch(var(--l) .13 var(--h)); background: oklch(var(--l) .14 var(--h) / .13); }
.kind { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; }
.title {
  margin: 0 0 16px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600; font-size: clamp(27px, 7.6vw, 36px); line-height: 1.12; letter-spacing: -.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance;
}
.idea { margin: 0; font-size: clamp(18px, 5.5vw, 22px); line-height: 1.48; color: var(--ink); text-wrap: pretty; max-width: 34ch; }
.more { margin-top: 18px; font-size: 16.5px; line-height: 1.6; color: var(--ink-2); max-width: 36ch; }
.more p, .more ol, .more ul { margin: 0 0 12px; }
.more ol, .more ul { padding-left: 1.2em; }
.more li { margin: 0 0 6px; }
.more code { font: 14px ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
.more strong { color: var(--ink); }
.more-btn {
  align-self: flex-start; margin-top: 18px; border: 0; background: none; padding: 6px 0; font-weight: 650; font-size: 15px;
  color: oklch(var(--l) .13 var(--h)); display: inline-flex; gap: 6px; align-items: center;
}
.more-btn::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .25s; }
.more-btn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.more-btn:empty, .more-btn[hidden] { display: none; }
.foot { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--ink-3); }
.level { display: inline-flex; gap: 4px; }
.level i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); box-shadow: inset 0 0 0 1px var(--ink-3); opacity: .7; }
.level i.on { background: oklch(var(--l) .14 var(--h)); box-shadow: none; opacity: 1; }
.why:empty, .by:empty { display: none; }
.why { color: var(--ink-2); }

/* right rail, TikTok style */
.rail {
  position: absolute; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 34px); z-index: 2;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.act { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; color: var(--ink); }
.act svg { box-sizing: content-box; width: 25px; height: 25px; padding: 12px; border-radius: 50%; background: var(--rail); transition: background-color .2s, color .2s, fill .2s; }
.act:hover svg { background: var(--rail-on); }
.act span { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.act.like[aria-pressed="true"] svg { color: var(--heart); fill: var(--heart); }
.act.save[aria-pressed="true"] svg { color: oklch(var(--l) .14 75); fill: oklch(var(--l) .14 75); }
.act.know[aria-pressed="true"] svg { color: var(--ok); }
.act:disabled { opacity: .3; cursor: default; }
.act.pop svg { animation: pop .38s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.32); } 100% { transform: scale(1); } }

/* the big heart on double tap */
.burst { position: absolute; left: 50%; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; color: var(--heart); fill: var(--heart); stroke: none; pointer-events: none; animation: burst .7s ease-out forwards; z-index: 3; }
@keyframes burst { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.1); opacity: .95; } 70% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.2) translateY(-30px); opacity: 0; } }

.end { display: grid; place-items: center; text-align: center; padding: 0 40px; color: var(--ink-2); }
.end h1 { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--ink); font-size: 28px; margin: 0 0 10px; }

/* toast */
.note {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px); z-index: 8;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s; overflow-wrap: anywhere;
}
.note.show { opacity: 1; transform: translate(-50%, 0); }

/* saved */
.saved { position: fixed; inset: 0; z-index: 10; background: var(--shade); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.saved-in { margin: 0 auto; max-width: 480px; height: 100%; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 10px) 16px 40px; }
.saved-top { display: flex; align-items: center; justify-content: space-between; padding: 0 0 12px 4px; }
.saved-top h2 { margin: 0; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 26px; font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: 14px 13px 14px; min-height: 150px;
  background: linear-gradient(160deg, oklch(var(--l) .14 var(--h) / .16), transparent 70%), var(--card);
  display: flex; flex-direction: column; gap: 8px;
}
.tile small { font-size: 11.5px; font-weight: 650; color: oklch(var(--l) .13 var(--h)); text-transform: uppercase; letter-spacing: .06em; }
.tile b { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 17px; line-height: 1.2; font-weight: 600; }
.tile span { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.grid .empty { grid-column: 1 / -1; color: var(--ink-2); padding: 40px 8px; text-align: center; }

@media (min-width: 560px) {
  .title { font-size: 36px; }
  .idea { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .feed { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
