/* The signed-in app: sidebar, top bar and pages.
   Brand: Char ground, Stage cards, Linen text, Ember accents, one Amber light per screen. */
@font-face { font-family: "Urbanist"; font-weight: 400; font-display: swap; src: url("../assets/fonts/Urbanist-Regular.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 600; font-display: swap; src: url("../assets/fonts/Urbanist-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 700; font-display: swap; src: url("../assets/fonts/Urbanist-Bold.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 800; font-display: swap; src: url("../assets/fonts/Urbanist-ExtraBold.woff2") format("woff2"); }

:root {
  --char: #120A07; --stage: #1E100A; --raise: #2A170F; --linen: #FFF6EE;
  --ember: #FF6B4A; --amber: #FFB547;
  --muted: rgba(255,246,238,.64); --faint: rgba(255,246,238,.42);
  --line: rgba(255,246,238,.12); --line-2: rgba(255,246,238,.2);
  --side: 264px; --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--char); color: var(--linen); font: 400 16px/1.55 "Urbanist", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }
.boot.is-error { color: var(--ember); }

/* ---------- layout */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px 16px; background: var(--char); border-right: 1px solid var(--line); overflow-y: auto; }
.main { min-width: 0; display: flex; flex-direction: column; background: radial-gradient(1100px 520px at 70% -12%, rgba(255,181,71,.07), transparent 60%); }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; text-decoration: none; font-weight: 700; font-size: 21px; letter-spacing: -.04em; }
.brand svg { width: 28px; height: 28px; }

.label { margin: 0 0 8px; padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }

/* ---------- workspace switcher */
.ws { position: relative; }
.ws-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; font: inherit; color: var(--linen); text-align: left; background: var(--stage); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.ws-btn:hover { border-color: var(--line-2); }
.ws-chip { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(255,107,74,.16); color: var(--ember); font-weight: 800; font-size: 14px; flex: none; }
.ws-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-chev { color: var(--muted); transition: transform .15s; }
.ws-btn[aria-expanded="true"] .ws-chev { transform: rotate(180deg); }
.ws-menu { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); padding: 6px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.ws-menu ul { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.ws-menu li button, .ws-add { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; font: inherit; font-size: 15px; color: var(--linen); text-align: left; background: none; border: 0; border-radius: 10px; cursor: pointer; }
.ws-menu li button:hover, .ws-add:hover { background: rgba(255,246,238,.06); }
.ws-menu li button[aria-current="true"] { font-weight: 700; }
.ws-menu li button[aria-current="true"]::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); }
.ws-menu .ws-chip { width: 24px; height: 24px; font-size: 12px; border-radius: 7px; }
.ws-add { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }
.ws-add svg { width: 18px; height: 18px; margin: 0 3px; }

/* ---------- nav */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--linen); background: rgba(255,246,238,.04); }
.nav a[aria-current="page"] { color: var(--linen); background: var(--stage); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ember); }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-decoration: none; }
.me:hover, .me[aria-current="page"] { background: var(--stage); }
.me-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-mail { font-size: 13px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none; background: var(--linen); color: var(--char); font-weight: 800; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.signout { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: none; color: var(--faint); cursor: pointer; }
.signout:hover { color: var(--linen); background: var(--stage); }

/* ---------- top bar */
.top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; height: 68px; padding: 0 clamp(20px, 4vw, 48px); background: rgba(18,10,7,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.crumb { margin: 0; font-size: 15px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { margin: 0 8px; }
#crumb-page { color: var(--linen); font-weight: 600; }
.spacer { flex: 1; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--stage); color: var(--linen); cursor: pointer; }
.menu-btn { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 0; border-radius: 999px; font: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn svg { width: 18px; height: 18px; }
.btn-amber { background: var(--amber); color: var(--char); }
.btn-amber:hover { filter: brightness(1.06); }
.btn-amber[disabled] { opacity: .6; cursor: wait; }
.btn-ghost { background: var(--stage); color: var(--linen); border: 1px solid var(--line-2); }
.btn-wide { width: 100%; padding: 15px 20px; font-size: 17px; margin-top: 8px; }

/* ---------- pages */
.page { width: 100%; max-width: 1040px; padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 48px) 80px; outline: none; }
.eyebrow { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ember); }
h1 { margin: 0 0 10px; font-size: clamp(34px, 4.4vw, 52px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.lead { margin: 0 0 34px; max-width: 620px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.muted { color: var(--muted); }
.text-link { display: inline-block; padding: 0; background: none; border: 0; font: inherit; font-weight: 600; color: var(--ember); text-decoration: none; cursor: pointer; }
.text-link:hover { text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.card { padding: 24px; background: var(--stage); border: 1px solid var(--line); border-radius: var(--r); }
.card-title { display: block; margin: 0 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.card-link { text-decoration: none; transition: border-color .15s, transform .15s; }
.card-link:hover { border-color: var(--line-2); transform: translateY(-2px); }

.start { display: flex; align-items: center; gap: 20px; min-height: 180px; background: linear-gradient(135deg, rgba(255,107,74,.14), rgba(255,107,74,0) 60%), var(--stage); }
.start-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; flex: none; background: var(--ember); color: var(--char); }
.start-icon svg { width: 30px; height: 30px; }
.start .muted { display: block; font-size: 16px; }

.steps { list-style: none; margin: 14px 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); color: transparent; }
.tick svg { width: 14px; height: 14px; }
.steps li.is-done { color: var(--linen); }
.steps li.is-done .tick { background: var(--ember); border-color: var(--ember); color: var(--char); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 44px 0 16px; }

/* ---------- deck cards */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.deck { display: flex; flex-direction: column; background: var(--stage); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; transition: border-color .15s, transform .15s; }
.deck:hover { border-color: var(--line-2); transform: translateY(-2px); }
.deck-thumb { position: relative; aspect-ratio: 16 / 9; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 18px; background: radial-gradient(70% 90% at 12% 0%, rgba(255,181,71,.22), transparent 62%), #160C08; border-bottom: 1px solid var(--line); }
.deck-thumb .t-eyebrow { font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ember); margin-bottom: 6px; }
.deck-thumb .t-title { font-size: 19px; font-weight: 700; line-height: 1.12; letter-spacing: -.02em; max-width: 90%; }
.deck-thumb .t-play { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,246,238,.1); color: var(--linen); opacity: 0; transition: opacity .15s; }
.deck:hover .t-play { opacity: 1; }
.deck-open { display: block; text-decoration: none; color: inherit; }
.deck-acts { display: flex; align-items: center; gap: 10px; flex: none; }
.deck-acts a { font-size: 14px; font-weight: 700; color: var(--linen); text-decoration: none; }
.deck-acts a:hover { color: var(--ember); }
.tag--changed { color: var(--ember); border-color: rgba(255,107,74,.45); }
.deck-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; }
.deck-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-sub { font-size: 14px; color: var(--faint); }
.tag { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line-2); }
.empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); background: var(--stage); border: 1px dashed var(--line-2); border-radius: var(--r); }

/* ---------- forms */
.form { max-width: 640px; }
.form-h { margin: 34px 0 14px; padding-top: 26px; border-top: 1px solid var(--line); }
label, legend { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
input, textarea, select { width: 100%; margin: 0 0 20px; padding: 13px 15px; font: inherit; font-size: 17px; color: var(--linen); background: var(--stage); border: 1px solid var(--line-2); border-radius: 12px; }
input::placeholder, textarea::placeholder { color: rgba(255,246,238,.32); }
input[readonly] { color: var(--muted); background: transparent; }
textarea { resize: vertical; line-height: 1.55; min-height: 180px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
select option { background: var(--stage); }
input:focus, textarea:focus, select:focus { border-color: rgba(255,246,238,.45); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { margin: 4px 0 10px; padding: 0; border: 0; }
.approaches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.approach { position: relative; display: block; margin: 0; padding: 14px 16px; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 400; color: var(--muted); background: var(--stage); border: 1px solid var(--line-2); border-radius: 14px; cursor: pointer; }
.approach input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.approach strong { display: block; margin-bottom: 3px; color: var(--linen); font-size: 16px; }
.approach:has(input:checked) { border-color: var(--ember); box-shadow: inset 0 0 0 1px var(--ember); }
.approach:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }
.approach:first-child { grid-column: 1 / -1; }
.writing-for { margin: 0 0 22px; padding: 12px 16px; color: var(--muted); background: rgba(255,107,74,.08); border-radius: 12px; }
.writing-for strong { color: var(--linen); }
.form-msg { min-height: 1.5em; margin: 14px 0 0; color: var(--muted); }
.form-msg.is-error { color: var(--ember); }
.note { margin: 4px 0 0; font-size: 14px; color: var(--faint); }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.profile-head p { margin: 0; }
.signout-link { display: block; margin: 26px 0 0; color: var(--muted); font-weight: 400; text-decoration: underline; }

/* ---------- small screens: the sidebar slides in */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 10; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  .shell.nav-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 9; background: rgba(0,0,0,.5); }
  .menu-btn { display: grid; }
  .nav a[aria-current="page"]::before { display: none; }
  .grid-2, .row-2, .approaches { grid-template-columns: 1fr; }
  .top { padding: 0 16px; }
  .top .btn { padding: 10px 14px; }
}
@media (max-width: 420px) { .crumb #crumb-ws, .crumb-sep { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
