/* Warm up top for the two of you, cool below for the markets. */
/* Warm up top for the two of you, cool below for the markets. */
:root {
  color-scheme: dark;
  --ink: #0b1020;
  --panel: #111a2e;
  --panel-2: #172340;
  --line: #1f2c47;
  --border-strong: #2a3a5f;
  --text: #e9edf5;
  --text-2: #c3cbdc;
  --text-3: #aab4c9;
  --muted: #8a96ae;
  --hover: rgba(255, 255, 255, .08);
  --cool: #8fb8ff;
  --warm: #f2b988;
  --warm-text: #f2b988;
  --warm-soft: rgba(242, 185, 136, 0.08);
  --warm-line: rgba(242, 185, 136, 0.22);
  --link-text: #f3d9bf;
  --glow: rgba(242, 185, 136, 0.13);
  --glow-cool: rgba(96, 140, 255, 0.14);
  --glow-mid: rgba(150, 110, 255, 0.06);
  --dot: rgba(255, 255, 255, 0.07);
  --shadow-1: 0 16px 30px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .3);
  --animal: #c9d2e4;
  --mood: #cdbf93;

  --bear: #e8837c;
  --bull: #6fcf9f;
  --s0: #e8837c; --s1: #e9a98a; --s2: #cdbf93; --s3: #9fcf9a; --s4: #6fcf9f;

  --display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Script", "Bradley Hand", "Comic Sans MS", cursive;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #f5efe6;
  --panel: #fffdf9;
  --panel-2: #f1e8db;
  --line: #e6dccd;
  --border-strong: #d3c5b2;
  --text: #1d2334;
  --text-2: #3d4659;
  --text-3: #566077;
  --muted: #6b7388;
  --hover: rgba(40, 30, 20, .07);
  --cool: #2c5cc0;
  --warm: #e08a33;
  --warm-text: #a35a12;
  --warm-soft: rgba(224, 138, 51, 0.10);
  --warm-line: rgba(224, 138, 51, 0.32);
  --link-text: #8a4c0f;
  --glow: rgba(240, 178, 124, 0.45);
  --glow-cool: rgba(150, 175, 235, 0.35);
  --glow-mid: rgba(235, 190, 200, 0.22);
  --dot: rgba(90, 60, 30, 0.10);
  --shadow-1: 0 14px 26px rgba(70, 45, 20, .22), 0 2px 4px rgba(70, 45, 20, .14);
  --animal: #3a4560;
  --mood: #b39a3e;

  --bear: #c0392f;
  --bull: #1c8a5c;
  --s0: #c9453d; --s1: #d9783c; --s2: #9a8330; --s3: #3f9a52; --s4: #1c8a5c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: var(--ink); }
/* Backdrop: soft warm and cool glows plus a faint dot grid that fades towards the bottom. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 8% -8%, var(--glow), transparent 70%),
    radial-gradient(900px 560px at 100% 105%, var(--glow-cool), transparent 70%),
    radial-gradient(500px 360px at 55% 38%, var(--glow-mid), transparent 70%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
body {
  color: var(--text);
  font: 400 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cool); outline-offset: 3px; border-radius: 6px; }
h1, h2, p, ul, blockquote { margin: 0; }
ul { padding: 0; list-style: none; }

/* ---------- Frame ---------- */
.app {
  height: 100dvh;
  padding: 14px 26px 20px;
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr);
  gap: 10px;
}
.tape { overflow: hidden; border-radius: 12px; min-height: 0; }
.tape .tradingview-widget-container { height: 42px; }

/* ---------- Top: the two of you ---------- */
.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 30px;
  position: relative;
  z-index: 2;
  padding: 6px 4px 0;
}

.polaroid {
  display: block; width: 156px; padding: 8px 8px 8px; margin: 0 0 -26px;
  background: #f5eee4; border: 0; border-radius: 5px;
  transform: rotate(-3.2deg);
  box-shadow: var(--shadow-1);
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
  position: relative; z-index: 3;
}
.polaroid:hover { transform: rotate(-1deg) scale(1.04); }
.polaroid img { width: 140px; height: 140px; object-fit: cover; display: block; border-radius: 2px; background: #d9cdbd; }
.polaroid .cap {
  display: block; font: 600 20px/1 var(--hand); color: #4a3320; text-align: center;
  padding: 8px 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

h1 { font: 650 clamp(30px, 3.1vw, 48px)/1.02 var(--display); letter-spacing: -0.03em; }
.hello p { color: var(--muted); margin-top: 8px; font-size: 15px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links a {
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 5px 13px; border-radius: 999px; border: 1px solid var(--warm-line); color: var(--link-text);
  transition: background .2s, border-color .2s;
}
.links a:hover { background: var(--warm-soft); border-color: var(--warm); }
.links button.theme {
  width: 32px; height: 28px; display: grid; place-items: center; padding: 0;
  border-radius: 999px; border: 1px solid var(--warm-line); background: transparent; color: var(--link-text);
  transition: background .2s, border-color .2s;
}
.links button.theme:hover { background: var(--warm-soft); border-color: var(--warm); }
.links button.theme svg { width: 16px; height: 16px; }
.links .sun { display: none; }
:root[data-theme="light"] .links .sun { display: block; }
:root[data-theme="light"] .links .moon { display: none; }

.sticky {
  width: 262px; padding: 20px 20px 14px;
  background: linear-gradient(158deg, #f8d3a6, #efb27c);
  color: #3a2412; border-radius: 3px 3px 14px 3px;
  transform: rotate(1.8deg);
  box-shadow: var(--shadow-1);
  margin: 6px 0 -22px; position: relative; z-index: 3;
}
.sticky::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 80px; height: 22px;
  transform: translateX(-50%) rotate(-3deg); background: rgba(255, 255, 255, .26); border-radius: 2px;
}
.sticky blockquote {
  font: 600 24px/1.1 var(--hand);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.sticky .from { font: 600 20px/1 var(--hand); margin-top: 8px; text-align: right; opacity: .75; }

.cal {
  width: 424px; padding: 12px 18px 12px 14px;
  background: var(--warm-soft); border: 1px solid var(--warm-line); border-radius: 28px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start;
}
.month-head { display: flex; align-items: center; gap: 2px; margin-bottom: 2px; }
.month-head .month { font: 600 15px/1 var(--display); min-width: 7.4em; background: none; border: 0; padding: 4px 0; text-align: left; }
.month-head button.nav { width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; font-size: 16px; line-height: 1; }
.month-head button.nav:hover { background: var(--hover); color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(7, 24px); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.grid .dow { color: var(--muted); text-align: center; height: 16px; }
.grid .d { height: 19px; width: 19px; margin: 0 auto; display: grid; place-items: center; position: relative; border-radius: 50%; color: var(--text-2); }
.grid .d.today { background: var(--warm); color: #2a1a0b; font-weight: 600; }
.grid .d.event::after { content: ""; position: absolute; bottom: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--warm); }
.grid .d.today.event::after { background: #2a1a0b; bottom: 1px; }
.coming { display: grid; gap: 7px; align-content: start; padding-top: 4px; }
.coming li { display: flex; flex-direction: column; font-size: 14px; line-height: 1.25; }
.coming .when { color: var(--warm-text); font-size: 12.5px; }
.coming .none { color: var(--muted); }
.since { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Main: the markets ---------- */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(400px, 1fr);
  gap: 26px;
  min-height: 0;
  padding-top: 4px;
}
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 28px; min-height: 0; overflow: hidden;
}
.chart { display: flex; flex-direction: column; padding-top: 16px; }

.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; padding: 8px 16px 8px 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tabs button {
  display: flex; align-items: baseline; gap: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background .2s, color .2s, border-color .2s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); }
.tabs .px { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.tabs .chg { font-size: 13px; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.stats b { font-weight: 600; margin-left: 4px; }
.up { color: var(--bull); }
.down { color: var(--bear); }
.flat { color: var(--muted); }
.tv { flex: 1; min-height: 0; }
.tv .tradingview-widget-container,
.tv .tradingview-widget-container__widget { height: 100%; width: 100%; }

/* ---------- Ben's take: no box, the mood tints the whole area ---------- */
.take {
  display: flex; flex-direction: column; min-height: 0; border-radius: 34px;
  background: radial-gradient(ellipse 50% 40% at 50% 26%, color-mix(in srgb, var(--mood) 18%, transparent), transparent);
  transition: background .6s;
}
.digest-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px 8px 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.empty { color: var(--muted); padding: 24px 4px; }

.d-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.d-title { font: 600 16px/1.3 var(--body); }
.d-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.d-right { display: flex; align-items: center; gap: 14px; flex: none; }
.history { display: flex; gap: 7px; align-items: center; }
.history button { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 0; background: var(--muted); opacity: .55; transition: opacity .2s, transform .2s; }
.history button:hover { opacity: 1; transform: scale(1.25); }
.history button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--text); }
.watch {
  flex: none; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color .2s, background .2s;
}
.watch:hover { border-color: var(--cool); background: var(--panel-2); }

.mood { display: grid; justify-items: center; text-align: center; margin-top: 2px; }
.gauge { width: min(212px, 100%); height: auto; display: block; overflow: visible; color: var(--animal); }
.gauge .fp { fill: var(--panel); }
.gauge .nl { stroke: var(--text); }
.gauge .hub { fill: var(--panel); stroke: var(--text); stroke-width: 2.5; }
.lean { font: 650 30px/1.05 var(--display); letter-spacing: -0.025em; margin-top: 2px; }
.reason { color: var(--text-3); font-size: 14px; margin-top: 8px; max-width: 42ch; }

.bullets { margin-top: 12px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.bullets li { position: relative; padding-left: 18px; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--mood); }

details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--cool); font-weight: 500; width: fit-content; }
details.more[open] summary { margin-bottom: 8px; }
details.more h3 { font: 600 14px/1.35 var(--body); margin: 12px 0 2px; }
details.more p { color: var(--text-2); }
.take .disclaimer { color: var(--muted); font-size: 12.5px; padding: 6px 20px 0 8px; }

/* gauge motion: one sweep on load, then a small pop for the active animal */
.needle { transform-origin: 120px 118px; transform: rotate(var(--to)); animation: sweep 1.3s cubic-bezier(.22, 1.3, .36, 1) .1s both; }
@keyframes sweep { from { transform: rotate(-90deg); } }
.animal { transition: opacity .3s; }
.animal.dim { opacity: .5; }
.animal.alive { transform-box: fill-box; transform-origin: 50% 60%; animation: pop .5s ease 1.05s both; }
@keyframes pop { 50% { transform: scale(1.14) rotate(-4deg); } }

/* lightbox */
dialog#lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 900px); max-height: 92vh; color: var(--text); }
dialog#lightbox::backdrop { background: rgba(5, 8, 16, .82); }
#lightboxImg { display: block; max-width: 100%; max-height: 82vh; border-radius: 20px; margin: 0 auto; }
#lightboxCaption { text-align: center; margin-top: 12px; color: #c3cbdc; }

/* ---------- Smaller screens: let the page scroll ---------- */
/* wide but short screens: keep the two-column look, let the page scroll */
@media (min-width: 1181px) and (max-height: 780px) {
  .app { height: auto; min-height: 100dvh; grid-template-rows: none; grid-auto-rows: auto; gap: 14px; }
  .chart { height: 540px; }
  .take { min-height: 540px; }
  .digest-body { overflow: visible; }
}
@media (max-width: 1180px) {
  .app { height: auto; min-height: 100dvh; grid-template-rows: none; grid-auto-rows: auto; gap: 14px; }
  .top { grid-template-columns: auto minmax(0, 1fr); gap: 22px 26px; }
  .sticky, .cal { grid-column: 1 / -1; width: auto; max-width: 440px; margin-bottom: 8px; }
  .sticky { justify-self: start; width: 280px; }
  .main { grid-template-columns: 1fr; gap: 22px; }
  .chart { height: 460px; }
  .digest-body { overflow: visible; }
}
@media (max-width: 640px) {
  .app { padding: 12px 16px 24px; }
  .polaroid { width: 124px; margin-bottom: 0; }
  .polaroid img { width: 108px; height: 108px; }
  .cal { grid-template-columns: 1fr; justify-items: start; }
  .chart { height: 400px; }
  .stats { gap: 12px; }
  .d-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .needle, .animal.alive { animation: none; }
  .polaroid, .watch, .links a, .history button, .take { transition: none; }
  .polaroid:hover { transform: rotate(-3.2deg); }
}
