/* PF Concepts brand colors (from the official logo, see brand/brand-colors.md) */
:root {
  --green: #00843D;        /* PANTONE 7725 C */
  --green-dark: #006B31;
  --green-tint: #E6F3EC;
  --orange: #F68D2E;       /* PANTONE 715 C */
  --orange-tint: #FEF1E4;
  --gray: #97999B;         /* PANTONE Cool Gray 7 C */
  --gray-light: #C7C9C7;   /* PANTONE 420 C */
  --ink: #2B2D2F;
  --ink-soft: #5C5F62;
  --line: #E3E4E3;
  --bg: #F6F7F6;
  --card: #FFFFFF;
  --red: #C0392B;
  --red-tint: #FBEAE8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-family: "Century Gothic", "Futura", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
ul, ol { margin: 0 0 .8rem; padding-left: 1.3rem; }
li { margin-bottom: .25rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.5rem; background: var(--card); border-bottom: 4px solid var(--green); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--ink); }
.brand-logo { height: 40px; width: auto; }
.brand-divider { width: 1px; height: 28px; background: var(--gray-light); }
.brand-title { font-weight: 700; color: var(--ink-soft); letter-spacing: .02em; }
.topnav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.topnav a { padding: .4rem .75rem; border-radius: 6px; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .95rem; }
.topnav a.active, .topnav a:hover { background: var(--green-tint); color: var(--green-dark); }
.topnav .who { color: var(--ink-soft); font-size: .875rem; padding-left: .5rem; }
.topnav a.signout { border: 1px solid var(--line); margin-left: .25rem; font-size: .875rem; }
.topnav a.signout:hover { border-color: var(--green); }

.container { max-width: 1040px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; min-height: 70vh; }
.footer { text-align: center; color: var(--ink-soft); font-size: .8rem; padding: 1rem; border-top: 1px solid var(--line); }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid transparent; border-radius: 6px; padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--green); color: #fff; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { background: var(--gray-light); color: #fff; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--green-dark); border-color: var(--green); }
.btn.secondary:hover { background: var(--green-tint); }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }

/* Chips and progress */
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.chip.passed { background: var(--green-tint); color: var(--green-dark); }
.chip.in_progress { background: var(--orange-tint); color: #9A4F0B; }
.chip.failed_attempt { background: var(--red-tint); color: var(--red); }
.chip.not_started { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }
.chip.cleared { background: var(--green); color: #fff; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); }

/* Hero / Rob */
.hero { display: flex; gap: 1.25rem; align-items: center; background: linear-gradient(120deg, var(--green-tint), #fff 70%); border-left: 6px solid var(--orange); }
.coach-avatar { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 800; font-size: 1.25rem; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--orange); }
.coach-avatar.small { width: 34px; height: 34px; font-size: .85rem; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--orange); }
.hero-body { flex: 1; min-width: 0; }
.narration { width: 100%; max-width: 460px; height: 40px; }
.notice { background: var(--orange-tint); border: 1px solid #F8C89A; border-radius: var(--radius); padding: .8rem 1rem; }
.notice.danger { background: var(--red-tint); border-color: #EBB3AC; }

/* Track page */
.module-list { list-style: none; padding: 0; margin: 0; }
.module-list li { display: flex; align-items: center; gap: .9rem; padding: .85rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.module-list li:last-child { border-bottom: 0; }
.step-dot { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--gray-light); color: var(--ink-soft); }
.step-dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.module-list .title { flex: 1; }

/* Lesson page */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.lesson-section h3 { color: var(--green-dark); }
.lesson-section + .lesson-section { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.video-wrap { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 1rem; }
.video-wrap iframe, .video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.check { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.option { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; margin-bottom: .45rem; font: inherit; cursor: pointer; color: var(--ink); }
.option:hover { border-color: var(--green); }
.option.selected { border-color: var(--green); background: var(--green-tint); }
.option.right { border-color: var(--green); background: var(--green-tint); }
.option.wrong { border-color: var(--red); background: var(--red-tint); }
.feedback { font-size: .925rem; margin-top: .3rem; }
.feedback.ok { color: var(--green-dark); }
.feedback.bad { color: var(--red); }

/* Rob chat */
.chat { position: sticky; top: 1rem; display: flex; flex-direction: column; max-height: calc(100vh - 2rem); padding: 0; overflow: hidden; }
.chat-head { padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: var(--green-tint); }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; min-height: 260px; }
.msg { margin-bottom: .8rem; display: flex; gap: .5rem; align-items: flex-start; }
.msg .bubble { padding: .6rem .8rem; border-radius: 10px; max-width: 100%; font-size: .95rem; }
.msg.assistant .bubble { background: var(--bg); border: 1px solid var(--line); }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--green); color: #fff; }
.msg .bubble p:last-child, .msg .bubble ul:last-child { margin-bottom: 0; }
.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; min-height: 44px; }
.chat-form textarea:focus, input:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
.typing { color: var(--ink-soft); font-style: italic; font-size: .9rem; }

/* Forms and tables */
label { font-weight: 600; font-size: .9rem; }
input[type=text], input[type=email] { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.check-label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; margin-right: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); border-bottom: 2px solid var(--line); padding: .5rem; }
td { border-bottom: 1px solid var(--line); padding: .6rem .5rem; vertical-align: top; }
.table-wrap { overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; border-top: 4px solid var(--green); }
.stat.orange { border-top-color: var(--orange); }
.stat.gray { border-top-color: var(--gray); }
.stat b { display: block; font-size: 1.8rem; }

/* Certificate */
.certificate { background: #fff; max-width: 900px; margin: 0 auto; aspect-ratio: 11 / 8.5; padding: 3.2rem 3.5rem; border: 10px solid var(--green); outline: 3px solid var(--orange); outline-offset: -22px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; }
.certificate img { height: 70px; margin: 0 auto; }
.certificate .kicker { letter-spacing: .25em; text-transform: uppercase; color: var(--gray); font-weight: 700; font-size: .9rem; }
.certificate .who { font-size: 2.4rem; color: var(--green-dark); font-weight: 700; border-bottom: 2px solid var(--gray-light); display: inline-block; padding: 0 2rem .3rem; }
.certificate .course { font-size: 1.35rem; font-weight: 700; }
.certificate .meta { display: flex; justify-content: space-around; color: var(--ink-soft); font-size: .9rem; }
.certificate .meta b { display: block; color: var(--ink); font-size: 1rem; }

@media (max-width: 860px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .chat { position: static; max-height: none; }
  .certificate { aspect-ratio: auto; padding: 2rem 1.25rem; }
  .certificate .who { font-size: 1.7rem; }
}
@media (max-width: 520px) {
  .topbar { padding: .6rem 1rem; }
  .brand-logo { height: 32px; }
  .container { padding: 1.25rem 1rem 2.5rem; }
  .hero { flex-direction: column; align-items: flex-start; }
}
@media print {
  @page { size: letter landscape; margin: 0.4in; }
  body { background: #fff; }
  .no-print, .topbar, .footer { display: none !important; }
  .container { padding: 0; max-width: none; }
  .certificate { border-width: 8px; box-shadow: none; max-width: none; height: 7.6in; aspect-ratio: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Animated demonstrations */
.demo-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; background: #EEF0EF; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; min-height: 380px; }
.demo-window { background: #fff; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; height: 340px; overflow: hidden; box-shadow: var(--shadow); }
.demo-stage.has-sheet .demo-window { height: 300px; }
.demo-titlebar { display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; border-bottom: 1px solid var(--line); font-size: .8rem; color: var(--ink-soft); font-weight: 600; background: #FAFAFA; }
.demo-dots { display: inline-flex; gap: 4px; }
.demo-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-light); display: block; }
.demo-chat { flex: 1; overflow-y: auto; padding: .9rem; font-size: .9rem; scroll-behavior: smooth; }
.demo-msg { display: flex; gap: .5rem; margin-bottom: .7rem; align-items: flex-start; }
.demo-msg.user { justify-content: flex-end; }
.demo-msg.user .demo-bubble { background: #EDEFEE; border-radius: 14px; padding: .55rem .8rem; max-width: 88%; }
.demo-msg.ai .demo-bubble { padding: .1rem 0; max-width: 92%; }
.demo-msg.ai .demo-bubble p:last-child, .demo-msg.ai .demo-bubble ul:last-child { margin-bottom: 0; }
.demo-ai-icon { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: .8rem; }
.demo-typing { color: var(--gray); letter-spacing: 2px; animation: demo-blink 1s infinite; }
@keyframes demo-blink { 50% { opacity: .3; } }
.demo-inputbar { display: flex; align-items: center; gap: .5rem; margin: .6rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 18px; font-size: .9rem; min-height: 42px; }
.demo-input { flex: 1; }
.demo-input.placeholder { color: var(--gray); }
.demo-send { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: .8rem; flex: 0 0 auto; }

/* Highlights appear when a "flag" step reveals them */
.hl { border-radius: 3px; transition: background .4s, box-shadow .4s; }
.hl.revealed { padding: 0 2px; }
.hl-bad.revealed { background: #FBD5D0; box-shadow: inset 0 -2px 0 var(--red); }
.hl-ok.revealed { background: #CDEBD9; box-shadow: inset 0 -2px 0 var(--green); }
.hl-role.revealed { background: #FDE2C8; box-shadow: inset 0 -2px 0 var(--orange); }
.hl-context.revealed { background: #D9E8F7; box-shadow: inset 0 -2px 0 #3B7DC4; }
.hl-task.revealed { background: #CDEBD9; box-shadow: inset 0 -2px 0 var(--green); }
.hl-format.revealed { background: #E5E0F3; box-shadow: inset 0 -2px 0 #7357B5; }

.demo-callout { padding: .7rem .9rem; border-radius: 8px; font-weight: 600; font-size: .925rem; box-shadow: 0 2px 10px rgba(0,0,0,.08); animation: demo-pop .3s ease-out; }
.demo-callout.warn { background: var(--red-tint); border: 1px solid #EBB3AC; color: #8E2A1F; }
.demo-callout.ok { background: var(--green-tint); border: 1px solid #A9D5BC; color: var(--green-dark); }
.demo-callout.info { background: var(--orange-tint); border: 1px solid #F8C89A; color: #8A4A0C; }
@keyframes demo-pop { from { transform: translateY(8px); opacity: 0; } }

.demo-cover { position: absolute; inset: 0; border: 0; border-radius: var(--radius); background: rgba(0, 107, 49, .82); color: #fff; font: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; cursor: pointer; z-index: 3; }
.demo-cover:hover { background: rgba(0, 107, 49, .9); }
.demo-play-icon { width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-size: 1.6rem; padding-left: 5px; box-shadow: 0 0 0 5px var(--orange); }
.demo-controls { margin-top: .75rem; }
.demo-progress { flex: 1; min-width: 120px; }
.demo-caption { margin: .6rem 0 0; min-height: 1.5em; color: var(--ink-soft); font-style: italic; }

.demo-sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .6rem; box-shadow: var(--shadow); align-self: start; overflow-x: auto; }
.demo-sheet table { font-size: .82rem; border-collapse: collapse; width: 100%; }
.demo-sheet th { background: #F1F2F1; color: var(--ink-soft); font-weight: 600; text-align: center; border: 1px solid var(--line); padding: .25rem .4rem; text-transform: none; letter-spacing: 0; font-size: .75rem; }
.demo-sheet td { border: 1px solid var(--line); padding: .25rem .45rem; white-space: nowrap; transition: background .4s; }
.demo-sheet td.hdr { font-weight: 700; background: #FAFAFA; }
.demo-sheet td.filled { background: var(--green-tint); font-weight: 700; color: var(--green-dark); }
.demo-formula { display: flex; gap: .5rem; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: .3rem .5rem; margin-bottom: .5rem; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; min-height: 30px; }
.demo-formula b { color: var(--gray); font-style: italic; }

@media (max-width: 520px) {
  .demo-window, .demo-stage.has-sheet .demo-window { height: 320px; }
  .demo-sheet table { font-size: .72rem; }
}

/* Quiz screen protection */
body.quiz-protected #app { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.quiz-protected #app .check { transition: filter .15s; }
body.quiz-veiled #app .check { filter: blur(9px); }
body.quiz-veiled #app::before { content: "Questions are hidden while this window isn't active. Click here to continue."; display: block; position: sticky; top: 1rem; z-index: 5; background: #2B2D2F; color: #fff; padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
#quiz-watermark { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; display: flex; flex-wrap: wrap; gap: 3rem 4rem; padding: 2rem; transform: rotate(-20deg) scale(1.4); opacity: .07; font-size: .85rem; color: var(--ink); }
.guard-notice { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #2B2D2F; color: #fff; padding: .6rem 1rem; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
.guard-notice.show { opacity: 1; }
.flag-warn { color: var(--red); }
@media print { body.quiz-protected * { visibility: hidden !important; } }

/* Required practice panel */
.chat.required { border: 2px solid var(--orange); }
.ok-text { color: var(--green-dark); }

/* Welcome (signed-out) page */
.welcome { display: flex; justify-content: center; padding-top: 1.5rem; }
.welcome-card { max-width: 560px; text-align: center; padding: 2.25rem 2rem; border-top: 6px solid var(--orange); }
.welcome-logo { height: 56px; margin-bottom: 1rem; }
.welcome-card .lead { font-size: 1.1rem; color: var(--ink-soft); }
.welcome-list { text-align: left; margin: 1.25rem auto 1.5rem; max-width: 440px; padding-left: 1.2rem; }
.welcome-list li { margin-bottom: .45rem; }
.signin-btn { font-size: 1.02rem; padding: .75rem 1.25rem; margin-bottom: .75rem; justify-content: center; gap: .6rem; }
.signin-btn svg { flex-shrink: 0; }
