/* Breath of Praise 息颂
   Palette taken from the logo: flame orange, coral, dove tan and wordmark gold,
   with a warm espresso dark (the logo's black-background version) and warm paper.
   Edit the tokens below to restyle the whole site. */
:root {
  /* Logo colours */
  --flame: #ff8200;         /* flame orange */
  --coral: #f95c32;         /* inner flame */
  --tan: #e0b785;           /* dove */
  --gold: #c1812d;          /* wordmark */

  /* Working colours derived from the logo */
  --accent: #b4441d;        /* ember: buttons, links (coral deepened so white text stays readable) */
  --accent-dark: #8f3313;
  --accent-tint: #fbe7d9;
  --deep: #24140c;          /* espresso: hero and footer */
  --deep-2: #3a2216;
  --heading: #4a2412;       /* warm brown for headings */

  --paper: #fdf9f4;
  --paper-2: #f8ece0;
  --ink: #2b1a10;
  --ink-soft: #5c4535;
  --muted: #7d6655;
  --line: #ecdccb;
  --field-line: #d9c3ad;
  --ok: #2f6b4f;
  --danger: #a3231f;

  --serif: "Literata", "Noto Serif SC", "Songti SC", serif;
  --serif-zh: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: "Public Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  --wrap: 1120px;
  --radius-sm: 4px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
}
.lang-zh body, body.lang-zh { line-height: 1.8; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
.lang-zh h1, .lang-zh h2, .lang-zh h3 { font-family: var(--serif-zh); font-weight: 700; letter-spacing: .02em; }
p { margin: 0 0 1em; max-width: 68ch; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 50; }
.skip:focus { left: 16px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.text-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-link:hover { text-decoration-thickness: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .6em 1.15em; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 600 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-lg { padding: .8em 1.5em; font-size: 1rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-quiet { background: var(--paper-2); color: var(--ink); }
.btn-quiet:hover { background: var(--line); }
.btn-dark { background: var(--deep); color: #fff; }
.btn-dark:hover { background: var(--deep-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* ---------- Masthead ---------- */
.masthead { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.masthead-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand-mark { width: 40px; height: 43px; flex: none; }
/* Matches the logo wordmark: lowercase, widely spaced, gold */
.brand-text { display: flex; align-items: baseline; gap: 10px; }
.brand-en { font: 400 1.05rem/1 var(--serif); letter-spacing: .2em; color: #a3681f; }
.brand-zh { font: 700 1.05rem/1 var(--serif-zh); color: var(--accent); }
@media (max-width: 420px) { .brand-en { letter-spacing: .12em; font-size: .95rem; } }

.nav { display: flex; align-items: center; gap: 24px; flex: 1; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 8px 12px; text-decoration: none; color: var(--ink-soft); font-weight: 500; border-radius: var(--radius-sm); }
.nav-links a:hover { color: var(--ink); background: var(--paper-2); }
.nav-links a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.lang-switch { font-weight: 500; color: var(--heading); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; }
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }
.nav-login { text-decoration: none; font-weight: 500; color: var(--ink-soft); }
.nav-login:hover { color: var(--ink); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; color: var(--ink); cursor: pointer; }
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper);
         border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px 20px; }
  .nav.is-open { display: flex; }
  .nav-links { flex-direction: column; }
  .nav-links a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .nav-actions { margin-left: 0; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
}

/* ---------- Flash & notices ---------- */
.flash { margin: 20px 0 0; padding: 12px 16px; background: #e8f1ec; color: var(--ok); border-left: 3px solid var(--ok); max-width: none; }
.notice { padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-width: 560px; }
.empty { padding: 32px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- Hero: the one bold moment ---------- */
.hero { background: var(--deep); color: #fff3e6; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 80px; }
.hero-title { font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 600; color: #fff; margin-bottom: .45em; max-width: 16ch; }
.lang-zh .hero-title { max-width: 12em; line-height: 1.3; }
.lede { font-size: 1.15rem; color: var(--ink-soft); }
.hero .lede { color: #e6cbb2; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .btn-ghost { border-color: #e6cbb2; color: #fff; }
.hero .btn-ghost:hover { background: #fff3e6; color: var(--deep); border-color: #fff3e6; }

.scroll { position: relative; margin: 0; min-height: 440px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.staff { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--tan); opacity: .35; }
.scroll-verse {
  position: relative; margin: 0; align-self: center;
  display: flex; flex-direction: row-reverse; align-items: flex-start; gap: .55em;
  font: 700 clamp(2.4rem, 4.2vw, 3.4rem)/1.18 var(--serif-zh); color: #ff9d42;
}
.scroll-verse p { margin: 0; max-width: none; display: flex; flex-direction: column; }
.scroll-verse p + p { padding-top: 1.4em; color: var(--tan); }
.scroll-cite { position: relative; font-size: .85rem; color: #c9a98c; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.scroll-cite span:first-child { font-family: var(--serif); font-style: italic; }

@media (prefers-reduced-motion: no-preference) {
  .scroll-verse p { opacity: 0; animation: ink-in 1.4s ease-out forwards; }
  .scroll-verse p + p { animation-delay: .7s; }
  @keyframes ink-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; padding-top: 48px; padding-bottom: 56px; gap: 40px; }
  .scroll { min-height: 340px; }
  .scroll-verse { font-size: 2.3rem; }
}

/* ---------- Sections ---------- */
.band { padding: 72px 0; }
.band + .band { border-top: 1px solid var(--line); }
.band-soft { background: var(--paper-2); }
.section-title { font-size: clamp(1.6rem, 2.6vw, 2.1rem); color: var(--heading); }
.page-head { padding: 56px 0 8px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); color: var(--heading); }
.page-head .lede { max-width: 60ch; }
.page-head + .band { border-top: 0; padding-top: 32px; }

/* Learn → Play → Serve is a real sequence, so it's numbered */
.path { list-style: none; counter-reset: step; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.path li { counter-increment: step; position: relative; padding: 56px 28px 0 0; }
.path li::before {
  content: counter(step); position: absolute; top: 0; left: 0;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font: 600 1rem/1 var(--serif); background: var(--paper); border: 1.5px solid var(--accent); color: var(--accent); z-index: 1;
}
.path li::after { content: ""; position: absolute; top: 18px; left: 36px; right: 0; height: 1.5px; background: var(--line); }
.path li:last-child::after { display: none; }
.path h3 { font-size: 1.3rem; }
.path p { color: var(--ink-soft); }
@media (max-width: 760px) {
  .path { grid-template-columns: 1fr; gap: 28px; }
  .path li { padding: 0 0 0 56px; }
  .path li::after { top: 36px; bottom: -28px; left: 17px; right: auto; width: 1.5px; height: auto; }
}

.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 56px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 24px; } }

.course-index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.course-index a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.course-index a:hover .ci-name { color: var(--accent); }
.ci-name { font: 600 1.2rem/1.3 var(--serif); }
.lang-zh .ci-name { font-family: var(--serif-zh); }
.ci-alt { color: var(--muted); font-size: .95rem; text-align: right; }

.band-invite { background: var(--flame); color: var(--ink); border-top: 0 !important; }
.invite > * { max-width: 640px; }
.invite .section-title { color: var(--deep); }
.invite p { color: #3b2112; font-size: 1.1rem; }

/* ---------- Courses page ---------- */
.course-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
.course { padding: 28px 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.course:target { background: linear-gradient(90deg, var(--accent-tint), transparent 80%); padding-left: 16px; margin-left: -16px; }
.course-name { font-size: 1.5rem; color: var(--heading); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.course-alt { font-family: var(--sans); font-weight: 400; font-size: 1rem; color: var(--muted); }
.course-serve { font-size: .95rem; }
@media (max-width: 760px) { .course-list { grid-template-columns: 1fr; } }

.levels { margin-top: 56px; padding: 36px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.level-list { padding-left: 1.3em; margin: 0 0 1.4em; }
.level-list li { margin-bottom: .6em; }

/* ---------- About ---------- */
.prose h2 { font-size: 1.5rem; color: var(--heading); margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.teachers { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.teacher { display: grid; grid-template-columns: 72px 1fr; gap: 18px; align-items: start; }
.teacher-photo { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 1.6rem/1 var(--serif-zh); }
.teacher h3 { font-size: 1.15rem; margin-bottom: 0; }
.teacher .muted { margin-bottom: .4em; }

/* ---------- Forms ---------- */
.form-layout > * { max-width: 760px; }
.form-layout.narrow > * { max-width: 440px; }
.form { display: flex; flex-direction: column; gap: 20px; }
.form + .form { margin-top: 48px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 16px; }
legend { font: 600 1.25rem/1.3 var(--serif); color: var(--heading); margin-bottom: 12px; padding: 0; }
.lang-zh legend { font-family: var(--serif-zh); }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 16px; }
@media (max-width: 600px) { .field-row { flex-direction: column; } }
label, .field-label { font-weight: 500; font-size: .95rem; margin: 0; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1px solid var(--field-line); border-radius: var(--radius-sm); padding: .62em .75em; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.input-validation-error, textarea.input-validation-error { border-color: var(--danger); }
textarea { resize: vertical; }
.hint { font-size: .875rem; color: var(--muted); }
.field-error, .field-validation-error { color: var(--danger); font-size: .9rem; }
.form-errors { color: var(--danger); }
.form-errors ul, ul.form-errors { margin: 0; padding: 12px 16px 12px 32px; background: #fbeceb; border-radius: var(--radius-sm); }
.validation-summary-valid { display: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.checks .check { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; align-items: center; }
.checks .check:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 3px 0 0; flex: none; }
.checks .check input { margin: 0; }
.form .btn { align-self: flex-start; }
.hp { position: absolute; left: -9999px; }
.danger-zone { padding-top: 32px; border-top: 1px solid var(--line); }
.danger-zone legend { color: var(--danger); }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 32px; flex-wrap: wrap; }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--ink-soft); font-weight: 500; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.subnav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Admin ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 24px; }
.filters .field { flex: 1 1 220px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-weight: 600; padding: 12px 14px; background: var(--paper-2); color: var(--ink-soft); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.table details { margin-top: 4px; font-size: .9rem; color: var(--ink-soft); }
.table summary { cursor: pointer; color: var(--accent); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-dark); margin-left: 6px; }
.messages { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.message { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 18px 20px; }
.message.is-handled { border-left-color: var(--line); opacity: .7; }
.message-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 8px; }
.message-head .tag { margin-left: 0; }
.message-body { white-space: pre-line; margin-bottom: 10px; }

/* ---------- Footer ---------- */
.footer { background: var(--deep); color: #d9c2ad; padding: 48px 0 32px; margin-top: 0; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 24px 48px; }
.footer-logo { width: 220px; height: auto; margin-bottom: 14px; }
.footer-zh { font: 700 1.1rem/1 var(--serif-zh); color: var(--tan); letter-spacing: .3em; margin: 0 0 .6em; }
.footer-verse { font-size: .95rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: #f3e3d3; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-copy { grid-column: 1 / -1; font-size: .85rem; color: #a88e78; margin: 16px 0 0; padding-top: 20px; border-top: 1px solid var(--deep-2); max-width: none; }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }
