/* LEA — mindbreak brand (tokens from mindbreak-tokens.json, night theme).
   One small flame in the dark: earth black, pearl, and a single touch of gold per screen. */

@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/static/fonts/instrument-serif-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/instrument-serif-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/static/fonts/instrument-serif-latin-ext-400-italic.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/hanken-grotesk-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/hanken-grotesk-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* colour — night */
  --ground: #15110E;
  --surface: #1A140F;
  --hairline: #332A22;
  --ink: #F1E8DA;
  --text: #B8AFA6;
  --text-muted: #A39584;
  --gold: #EBB54E;
  --button: #F1E8DA;
  --on-button: #15110E;
  --button-hover: #E6DCCB;
  /* type */
  --display: "Instrument Serif", "DM Serif Display", Georgia, serif;
  --sans: "Hanken Grotesk", Inter, "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--text); font: 400 17px/28px var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--gold); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--hairline); color: var(--ink); }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- Brand pieces ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font: 400 26px/1 var(--display); letter-spacing: .01em; }
.wordmark img { height: 30px; width: auto; display: block; }
.side .wordmark img { height: 26px; }
.legal .wordmark img { height: 30px; }
.label { font: 500 12px/16px var(--sans); letter-spacing: .28em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }
.split { font: 400 44px/48px var(--display); letter-spacing: -.01em; color: var(--ink); margin: 0 0 16px; }
.split em { font-style: italic; color: var(--gold); }
.lead { font: 300 19px/30px var(--sans); color: var(--text); margin: 0 0 32px; }
.small, .note { font-size: 14px; line-height: 22px; color: var(--text-muted); }

/* Buttons: pearl pills, never gold */
.btn { appearance: none; border: 1px solid var(--button); border-radius: var(--radius-pill); padding: 13px 26px;
  background: var(--button); color: var(--on-button); font: 500 16px/20px var(--sans); cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--button-hover); border-color: var(--button-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.outline { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn.outline:hover { border-color: var(--text-muted); background: transparent; }
.btn.small { padding: 9px 16px; font-size: 15px; }
.btn.full { width: 100%; }
.link-btn { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 2px 0; text-decoration: underline;
  text-underline-offset: 3px; font-size: 14px; }
.link-btn:hover { color: var(--ink); }
.error:empty { display: none; }
.error { color: #E8A08F; font-size: 14px; line-height: 22px; min-height: 1px; margin: 10px 0 0; }
.demo-tag { display: inline-block; border: 1px solid var(--hairline); color: var(--text-muted); border-radius: var(--radius-pill);
  font: 500 11px/16px var(--sans); letter-spacing: .2em; text-transform: uppercase; padding: 3px 10px; }

/* ---------- Single-column screens ---------- */
.screen { min-height: 100%; display: flex; flex-direction: column; padding: 32px 16px 48px; }
.screen-top { width: 100%; max-width: 1080px; margin: 0 auto 48px; }
.screen-body { width: 100%; max-width: 520px; margin: auto; }
.screen-body.wide { max-width: 600px; }
.form-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 32px; }
label { display: block; font-size: 15px; font-weight: 500; color: var(--ink); margin: 20px 0 8px; }
label:first-child { margin-top: 0; }
label .opt { color: var(--text-muted); font-weight: 400; }
input[type=text], input[type=email], input[type=date], input[type=time], select {
  width: 100%; border: 1px solid var(--hairline); background: var(--ground); color: var(--ink);
  border-radius: var(--radius-sm); padding: 12px 14px; outline: none; font-size: 16px; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .8; }
input:focus, select:focus { border-color: var(--text-muted); }
input:disabled, select:disabled { opacity: .45; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.row > div { min-width: 0; }
input[type=date], input[type=time] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 50px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 24px; font-weight: 400; color: var(--text); margin-top: 18px; }
.check input { margin-top: 5px; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }
.code-input { font: 400 32px/1 var(--display) !important; letter-spacing: .45em; text-align: center; padding: 16px !important; }
.place-row { display: flex; gap: 8px; }
.place-row input { flex: 1; }
.place-found { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--hairline); font-size: 15px; line-height: 24px; color: var(--ink); }
.place-found .note { display: block; margin-top: 2px; }
.actions { margin-top: 28px; }
.foot { text-align: center; margin: 16px 0 0; }

/* ---------- Profile and settings ---------- */
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#view-settings .split { margin-bottom: 32px; }
.settings-card { margin-bottom: 16px; }
.settings-card p { margin: 0 0 18px; }
.card-title { font: 400 28px/34px var(--display); color: var(--ink); margin: 0 0 16px; }
.facts { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 0 0 20px; font-size: 15px; line-height: 24px; }
.facts dt, .facts dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--hairline); }
.facts dt { color: var(--text-muted); }
.facts dd { color: var(--ink); }
.facts dt:nth-last-of-type(1), .facts dd:last-of-type { border-bottom: 1px solid var(--hairline); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr; } .facts dd { border-top: 0; padding-top: 0; } .facts dt { padding-bottom: 2px; } }

/* ---------- Calculating ---------- */
.ripples { width: 132px; height: 132px; margin: 0 0 40px; position: relative; }
.ripples span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--hairline); animation: ripple 4s ease-out infinite; }
.ripples span:nth-child(2) { animation-delay: 1.33s; }
.ripples span:nth-child(3) { animation-delay: 2.66s; }
.ripples b { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--ink); }
@keyframes ripple { 0% { transform: scale(.08); opacity: 0; border-color: var(--text-muted) } 15% { opacity: 1 } 100% { transform: scale(1); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .ripples span { animation: none; opacity: .6 } .ripples span:nth-child(2) { inset: 22px } .ripples span:nth-child(3) { inset: 44px } }
.calc-steps { list-style: none; padding: 0; margin: 0; font-size: 15px; line-height: 24px; }
.calc-steps li { padding: 7px 0; border-top: 1px solid var(--hairline); color: var(--text-muted); transition: color .5s; display: flex; justify-content: space-between; gap: 12px; }
.calc-steps li:last-child { border-bottom: 1px solid var(--hairline); }
.calc-steps li::after { content: ""; }
.calc-steps li.on { color: var(--ink); }
.calc-steps li.on::after { content: "done"; color: var(--text-muted); font-size: 13px; }

/* ---------- Chat layout ---------- */
.chat-layout { display: grid; grid-template-columns: 288px 1fr; height: 100dvh; }
.side { background: var(--ground); border-right: 1px solid var(--hairline); display: flex; flex-direction: column; padding: 24px 20px; min-height: 0; }
.side .wordmark { margin: 4px 0 26px; }
.side .label { margin: 0 0 24px; }
.side .new { margin-bottom: 20px; }
.convs { flex: 1; overflow-y: auto; margin: 0 -10px; min-height: 0; }
.conv { display: flex; align-items: center; border-radius: var(--radius-sm); }
.conv button.open { flex: 1; text-align: left; background: none; border: 0; padding: 8px 10px; cursor: pointer;
  font-size: 15px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.conv:hover button.open { color: var(--ink); }
.conv.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.conv.active button.open { color: var(--ink); }
.conv .del { opacity: 0; background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px 10px; }
.conv:hover .del, .conv.active .del { opacity: 1; }
.side-foot { border-top: 1px solid var(--hairline); padding-top: 16px; font-size: 13px; line-height: 20px; color: var(--text-muted); }
.side-foot .who { font-size: 15px; font-weight: 500; color: var(--ink); }
.side-foot .menu { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 32px; border-bottom: 1px solid var(--hairline); min-height: 61px; }
.topbar .menu-toggle { display: none; }
.access { font-size: 14px; line-height: 20px; color: var(--text-muted); text-align: right; margin-left: auto; }
.access b { color: var(--ink); font-weight: 500; }
.thread { flex: 1; overflow-y: auto; padding: 40px 32px 16px; }
.thread-inner { max-width: 700px; margin: 0 auto; }
.msg { margin: 0 0 32px; display: flex; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--surface); border: 1px solid var(--hairline); color: var(--ink); border-radius: var(--radius-md);
  padding: 12px 18px; max-width: 80%; white-space: pre-wrap; }
.msg.assistant .bubble { max-width: 100%; color: var(--text); }
.msg.assistant .who { margin-bottom: 8px; }
.msg.assistant .body p { margin: 0 0 14px; }
.msg.assistant .body strong { color: var(--ink); font-weight: 500; }
.msg.assistant .body em { font-style: italic; }
.msg.assistant .body ul, .msg.assistant .body ol { margin: 0 0 14px; padding-left: 22px; }
.msg.assistant .body li { margin-bottom: 4px; }
.msg.assistant .body :last-child { margin-bottom: 0; }
.typing:empty::before { content: "LEA is reading your charts"; color: var(--text-muted); font-size: 15px; }
.typing::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--ink); animation: breathe 1.6s ease-in-out infinite; vertical-align: middle; }
@keyframes breathe { 50% { opacity: .2; transform: scale(.7) } }

.welcome { padding: 6vh 0 8px; }
.welcome .split { font-size: 40px; line-height: 44px; }
.welcome .lead { font-size: 18px; line-height: 28px; margin-bottom: 32px; max-width: 520px; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.starter { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 16px 18px; cursor: pointer;
  font-size: 15px; line-height: 23px; color: var(--text); text-align: left; transition: border-color .15s, color .15s; }
.starter:hover { border-color: var(--text-muted); color: var(--ink); }

.composer { padding: 12px 32px 20px; }
.composer form { max-width: 700px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 8px 8px 8px 18px; }
.composer form:focus-within { border-color: var(--text-muted); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: var(--ink); padding: 9px 0; max-height: 180px; line-height: 24px; font-size: 16px; }
.composer .send { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; flex: none; }
.composer .hint { max-width: 700px; margin: 10px auto 0; font-size: 13px; line-height: 18px; color: var(--text-muted); text-align: center; }

.paywall { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 32px; margin: 8px 0 32px; }
.paywall .split { font-size: 34px; line-height: 38px; margin-bottom: 12px; }
.paywall p { margin: 0 0 16px; }
.paywall ul { list-style: none; padding: 0; margin: 0 0 24px; font-size: 15px; line-height: 24px; }
.paywall li { padding: 8px 0; border-top: 1px solid var(--hairline); }
.paywall li:last-child { border-bottom: 1px solid var(--hairline); }
.banner { max-width: 700px; margin: 0 auto 24px; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--hairline); font-size: 15px; color: var(--ink); }

/* ---------- Legal page ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 32px 16px 96px; }
.legal .wordmark { margin-bottom: 64px; }
.legal h1 { font: 400 56px/58px var(--display); letter-spacing: -.01em; color: var(--ink); margin: 0 0 16px; }
.legal h2 { font: 400 32px/38px var(--display); color: var(--ink); margin: 56px 0 12px; }
.legal li { margin-bottom: 6px; }
.legal .todo { border: 1px dashed var(--text-muted); color: var(--ink); padding: 0 6px; border-radius: var(--radius-sm); }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .screen { padding: 20px 16px 40px; }
  .screen-top { margin-bottom: 40px; }
  .split { font-size: 36px; line-height: 40px; }
  .lead { font-size: 17px; line-height: 27px; margin-bottom: 28px; }
  .form-card { padding: 24px; }
  .chat-layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 86%; max-width: 320px; z-index: 20; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(21, 17, 14, .7); z-index: 10; }
  .topbar { padding: 10px 16px; min-height: 57px; }
  .topbar .menu-toggle { display: inline-block; }
  .thread { padding: 28px 16px 8px; }
  .composer { padding: 8px 12px 14px; }
  .starters { grid-template-columns: 1fr; }
  .welcome .split { font-size: 34px; line-height: 38px; }
  .paywall { padding: 24px; }
  .paywall .split { font-size: 30px; line-height: 34px; }
  .legal h1 { font-size: 40px; line-height: 44px; }
  .msg.user .bubble { max-width: 90%; }
}
