/* Rooftop Solar Workshop. Golden Hour, as a sunrise, built around Lumen.
   Colours, type and depth come only from tokens.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--sky-night);
  color: var(--on-sky);
  font: var(--text-md)/1.55 var(--font-body);
}

a { color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The sky. The sun's glow sits behind the ridge and climbs as the sessions go by. */
.sky {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 70% 45% at 50% calc(104% - var(--sunrise) * 38%), var(--sky-gold), transparent 70%),
    linear-gradient(180deg, var(--sky-night) 0%, var(--sky-indigo) 26%, var(--sky-violet) 50%, var(--sky-rose) 72%, var(--sky-peach) 88%, var(--sky-gold) 100%);
}
.ridges { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 20vh; z-index: -1; }
.ridge-far { fill: var(--ridge-far); opacity: 0.75; }
.ridge-near { fill: var(--ridge-near); }

/* Top bar: the same on every page. Brand, where you are, the proposal, the team, Ask Lumen. */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4);
  height: var(--bar-h); padding: 0 max(var(--space-4), calc((100vw - var(--page-max)) / 2));
  background: var(--glass-dark); border-bottom: 1px solid var(--glass-line); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--on-sky); font: 600 var(--text-md)/1.1 var(--font-display); font-variation-settings: var(--display-soft); white-space: nowrap; }
.brand .lumen { width: 52px; height: 52px; margin: -10px calc(-1 * var(--space-2)) -10px -14px; filter: drop-shadow(0 0 8px var(--lumen-glow)); }
.topbar-where { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-sm); color: var(--on-sky-muted); }
.topbar-where a { color: var(--on-sky); text-decoration: none; font-weight: 700; white-space: nowrap; }
.topbar-where a:hover { text-decoration: underline; }
.topbar-where [aria-current] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-proposal { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); background: var(--veil); color: var(--on-sky); text-decoration: none; font-size: var(--text-sm); font-weight: 800; white-space: nowrap; }
.topbar-proposal span { font-weight: 600; color: var(--on-sky-muted); }
.brand + .topbar-proposal, .topbar > .team-chip:last-child { margin-left: auto; }
.team-chip { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: var(--text-sm); color: var(--on-sky-muted); white-space: nowrap; }
.team-chip .code { color: var(--on-sky); }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.08em; font-weight: 700; }
.ask-lumen { display: flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-4) 0 var(--space-1); height: 44px; font-size: var(--text-sm); background: var(--glass); color: var(--ink); white-space: nowrap; }
.ask-lumen .lumen { width: 44px; height: 44px; margin: 0 -4px 0 -2px; }
.ask-lumen[aria-expanded="true"] { background: var(--accent); box-shadow: var(--shadow-button); }

.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--space-4) 24vh; }
.site-footer { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--space-4) var(--space-5); color: var(--on-sky-muted); font-size: var(--text-sm); }

/* Type on the sky */
.eyebrow { margin: 0 0 6px; color: var(--sky-gold); font-weight: 800; font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; }
h1, h2 { font-family: var(--font-display); font-variation-settings: var(--display-soft); font-weight: 600; }
h1 { font-size: var(--text-display); line-height: 1.1; margin: 0 0 12px; }
h2 { font-size: var(--text-xl); line-height: 1.2; margin: 0 0 8px; }
.lede { font-size: var(--text-lg); color: var(--on-sky-muted); margin: 0; }

/* Lumen speaking: the core pattern of the app. */
.say { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; }
.say > .lumen { flex: none; width: var(--lumen-chat); height: var(--lumen-chat); margin: -8px -10px 0 -12px; filter: drop-shadow(0 0 10px var(--lumen-glow)); }
.bubble { background: var(--glass); color: var(--ink); padding: 16px 18px; border-radius: var(--radius-tail) var(--radius-lg) var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow-card); backdrop-filter: blur(6px); max-width: 640px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2 { color: var(--ink); }

/* Welcome: Lumen large, like the sun about to rise. */
.welcome { display: grid; justify-items: center; text-align: center; gap: 0; padding-top: 0; }
.welcome > .lumen { margin: -24px 0 -30px; }
.welcome > .lumen { width: var(--lumen-hero); height: var(--lumen-hero); filter: drop-shadow(0 0 28px var(--lumen-glow)); }
.welcome .bubble { border-radius: var(--radius-lg); text-align: left; }
.welcome .bubble h1 { font-size: var(--text-hero); margin-bottom: 8px; }
.replies { display: grid; gap: 12px; width: 100%; max-width: 640px; margin-top: 10px; }
.replies form { margin: 0; }
.reply-code { background: var(--glass-dark); border: 1px solid var(--glass-line); border-radius: var(--radius-md); padding: 12px 14px; text-align: left; backdrop-filter: blur(8px); }
.reply-code summary { cursor: pointer; font-weight: 700; color: var(--on-sky); }
.reply-code form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.reply-code label { flex-basis: 100%; font-size: var(--text-sm); color: var(--on-sky-muted); }

/* Controls */
button, .button {
  font: inherit; font-weight: 800; padding: 12px 20px; border-radius: var(--radius-pill); border: 0;
  background: var(--glass); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block;
  transition: transform var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-button); width: 100%; font-size: var(--text-lg); padding: 14px 22px; }
button:hover { transform: translateY(-1px); }
button.link { background: none; box-shadow: none; padding: 0; font-weight: 600; color: var(--on-sky); text-decoration: underline; text-underline-offset: 3px; }
input {
  font: 700 var(--text-lg) ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.14em; text-transform: uppercase;
  flex: 1; min-width: 0; padding: 11px 16px; border-radius: var(--radius-pill); border: 0; background: var(--glass); color: var(--ink);
}
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.error { color: var(--sky-gold); font-weight: 700; margin: 8px 0 0; }

/* Code banner: Lumen hands the team its code. */
.big-code { font: 800 var(--text-code)/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.2em; color: var(--ink); margin: 6px 0 !important; }

/* The journey: six sessions from first light to full morning. */
.journey { list-style: none; display: grid; gap: 10px; padding: 0; margin: 20px 0 0; max-width: 720px; }
.journey a, .journey .later {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--glass); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card);
}
.journey .later { background: var(--glass-dark); color: var(--on-sky-muted); box-shadow: none; border: 1px solid var(--glass-line); }
.journey a:hover { box-shadow: var(--shadow-glow); }
.num { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: var(--shadow-button); }
.later .num { background: var(--veil); color: var(--on-sky-muted); box-shadow: none; }
.text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.text strong { font-family: var(--font-display); font-variation-settings: var(--display-soft); font-weight: 600; font-size: var(--text-lg); }
.text span { color: var(--ink-muted); font-size: var(--text-sm); }
.later .text span { color: var(--on-sky-muted); }
.minutes { color: var(--ink-muted); font-size: var(--text-sm); white-space: nowrap; }

/* Reading: the lesson on a lit page. */
.prose h2 { margin-top: 30px; color: var(--ink); }
.prose h2:first-child { margin-top: 0; }
.prose a { color: var(--warn); }
.prose strong { color: var(--ink); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); display: block; overflow-x: auto; margin: 12px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--lit-edge); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { color: var(--ink-muted); font-weight: 800; }
.prose blockquote { margin: 16px 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--lit-warm); box-shadow: inset 4px 0 0 var(--accent); }
.prose blockquote p { margin: 4px 0; }

/* Lumen design study */
.study { display: grid; justify-items: center; gap: 16px; margin: 24px 0 8px; padding: 28px 16px; border-radius: var(--radius-lg); background: var(--glass-dark); border: 1px solid var(--glass-line); backdrop-filter: blur(8px); }
.study-stage { display: grid; place-items: center; min-height: 260px; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.controls button { padding: 8px 14px; font-size: var(--text-sm); background: var(--veil); color: var(--on-sky); }
.controls button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-button); }
.mood-note { margin: 0; color: var(--on-sky-muted); text-align: center; min-height: 3em; }
.toggle { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.study-h2 { margin-top: 36px; }
.chat-mock { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius-lg); background: var(--glass-dark); border: 1px solid var(--glass-line); }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 90%; }
.msg p { margin: 0; padding: 11px 15px; border-radius: var(--radius-md); font-size: var(--text-md); }
.msg--lumen p { background: var(--glass); color: var(--ink); border-top-left-radius: var(--radius-tail); }
.msg--team { margin-left: auto; }
.msg--team p { background: var(--team); color: var(--team-ink); border-top-right-radius: var(--radius-tail); }
.msg .lumen { flex: none; width: var(--lumen-chat); height: var(--lumen-chat); margin: -10px -10px -10px -12px; }
.msg--typing p { display: flex; gap: 5px; padding: 15px; }
.msg--typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lumen-amber); opacity: 0.4; }
@media (prefers-reduced-motion: no-preference) {
  .msg--typing span { animation: dot 1.2s infinite; }
  .msg--typing span:nth-child(2) { animation-delay: 0.15s; }
  .msg--typing span:nth-child(3) { animation-delay: 0.3s; }
}
@keyframes dot { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.sizes { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }

/* Design direction index */
.principles { padding-left: 20px; display: grid; gap: 10px; max-width: 720px; color: var(--on-sky-muted); }
.principles strong { color: var(--on-sky); }
.direction-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 720px; }
.direction-list a { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--glass); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card); }
.direction-list a:hover { box-shadow: var(--shadow-glow); }

/* Lumen's chat: on request from the top bar. A side drawer, a bottom sheet on a phone, and inside
   Lumen's column on a wide lesson page. */
.chat {
  display: none; flex-direction: column; background: var(--sky-night); border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card);
  position: fixed; z-index: 30; right: var(--space-3); top: calc(var(--bar-h) + var(--space-3)); bottom: var(--space-3);
  width: min(400px, calc(100vw - 2 * var(--space-3)));
}
.chat-open .chat { display: flex; }
.chat-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--glass-line); }
.chat-head .lumen { flex: none; width: 76px; height: 76px; margin: -14px -8px -14px -12px; filter: drop-shadow(0 0 12px var(--lumen-glow)); }
.chat-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-title strong { font: 600 var(--text-lg)/1.1 var(--font-display); font-variation-settings: var(--display-soft); }
.chat-title span { font-size: var(--text-sm); color: var(--on-sky-muted); }
.chat-close { background: var(--veil); color: var(--on-sky); padding: var(--space-2) var(--space-3); }
.chat-log { list-style: none; margin: 0; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.chat-msg { max-width: 88%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-md); line-height: 1.5; }
.chat-msg p { margin: 0 0 var(--space-2); }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg--lumen { align-self: flex-start; background: var(--glass); color: var(--ink); border-top-left-radius: var(--radius-tail); box-shadow: var(--shadow-card); }
.chat-msg--team { align-self: flex-end; background: var(--team); color: var(--team-ink); border-top-right-radius: var(--radius-tail); }
.typing { display: flex; gap: 5px; padding: var(--space-1) 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lumen-amber); opacity: 0.4; }
@media (prefers-reduced-motion: no-preference) {
  .typing span { animation: dot 1.2s infinite; }
  .typing span:nth-child(2) { animation-delay: 0.15s; }
  .typing span:nth-child(3) { animation-delay: 0.3s; }
}
.chat-form { display: flex; gap: var(--space-2); align-items: flex-end; padding: var(--space-3); border-top: 1px solid var(--glass-line); }
.chat-form textarea {
  flex: 1; min-width: 0; resize: none; font: var(--text-md)/1.4 var(--font-body); padding: var(--space-3) var(--space-4); border: 0;
  border-radius: var(--radius-md); background: var(--glass); color: var(--ink); max-height: 140px;
}
.chat-form textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-send { flex: none; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-button); padding: var(--space-3) var(--space-4); }
.chat-send:disabled { opacity: 0.5; cursor: wait; }
.chat-open { overflow-x: hidden; }

@media (max-width: 767px) {
  .chat { left: var(--space-2); right: var(--space-2); top: auto; bottom: var(--space-2); width: auto; height: 72vh; }
  .chat-open { overflow: hidden; }
}
