/* Ugly Duckling Workshops app. The brand of uglyducklingworkshops.com: paper and ink, Courier Prime
   for labels, Libre Caslon for reading, the duck seal. Light paper by default, ink in dark mode. */
@font-face { font-family: "Courier Prime"; font-weight: 400; font-display: swap; src: url(../fonts/courier-prime-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Courier Prime"; font-weight: 700; font-display: swap; src: url(../fonts/courier-prime-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-display: swap; src: url(../fonts/libre-caslon-text-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/libre-caslon-text-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-weight: 700; font-display: swap; src: url(../fonts/libre-caslon-text-latin-700-normal.woff2) format("woff2"); }

:root {
  --paper: #fbfbf8; --wash: #f1f1ec; --card: #ffffff; --ink: #161616; --soft: #3f3f3f; --dim: #676767; --line: #d9d9d3; --line-2: #bdbdb5;
  --help: #9a2a1d; --help-ink: #ffffff; --good: #2f6b3f; --go: #2f6b3f;
  --type: "Courier Prime", "Courier New", Courier, monospace; --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar: 64px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #161616; --wash: #202020; --card: #1d1d1d; --ink: #f1f1ec; --soft: #cfcfc8; --dim: #a3a39b; --line: #343432; --line-2: #4a4a46;
    --help: #f0937f; --help-ink: #161616; --good: #8fc79b; --go: #3f8a52; color-scheme: dark; }
  :root:not([data-theme="light"]) .seal, :root:not([data-theme="light"]) .certseal { filter: invert(1); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 1rem; line-height: 1.55; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* frame */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top) + 6px) 10px 6px; display: flex; align-items: center; gap: 8px; min-height: 52px; }
.topbar h1 { font-family: var(--type); font-weight: 700; font-size: .95rem; letter-spacing: .16em; text-transform: uppercase; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink); }
.iconbtn svg { width: 24px; height: 24px; }
.quickexit, .helpnow { font-family: var(--type); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-radius: 4px; padding: 0 10px; min-height: 44px; cursor: pointer; }
.quickexit { border: 1px solid var(--ink); background: var(--paper); }
.helpnow { border: 1px solid var(--help); background: var(--help); color: var(--help-ink); }
main { flex: 1; padding: 16px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px); max-width: 760px; width: 100%; margin: 0 auto; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { border: 0; background: transparent; min-height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-family: var(--type); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); cursor: pointer; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 700; }

/* type */
h2 { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; line-height: 1.25; margin: 6px 0 8px; text-wrap: balance; }
h2.group { font-family: var(--type); font-size: .82rem; letter-spacing: .22em; text-transform: uppercase; text-align: center; margin: 28px 0 4px; padding-top: 14px; border-top: 1px solid var(--ink); }
h3 { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.3; margin: 20px 0 6px; }
h4 { font-family: var(--type); font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 20px 0 8px; font-weight: 700; }
p { margin: 0 0 10px; max-width: 68ch; }
.lede { color: var(--soft); font-size: 1.04rem; }
.muted { color: var(--dim); } .small { font-size: .88rem; } .tiny { font-size: .74rem; } .serif { font-family: var(--serif); }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.eyebrow, .kind { font-family: var(--type); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 700; }

/* brand header */
.brand { text-align: center; padding: 6px 0 10px; }
.brand .seal { width: 190px; max-width: 54vw; height: auto; display: block; margin: 0 auto 10px; }
.brand .sub { font-family: var(--type); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--soft); margin: 0 auto 2px; }
.brand .by { color: var(--soft); margin: 0 auto; }
.brand.small { padding-top: 12px; }

/* controls */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin: 0 0 12px; }
.card.tight { padding: 10px 14px; } .card.alert { border-color: var(--help); }
.row { display: flex; gap: 10px; align-items: center; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.btn { min-height: 48px; padding: 0 16px; border-radius: 4px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-family: var(--type); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .86rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.btn.accent { background: var(--ink); color: var(--paper); }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.help { background: var(--help); border-color: var(--help); color: var(--help-ink); }
.btn.ghost, .btn.quiet { background: transparent; color: var(--ink); }
.btn.quiet { border-color: var(--line-2); }
.btn.block { width: 100%; } .btn.sm { min-height: 44px; font-size: .78rem; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.linkbtn { border: 0; background: transparent; color: var(--ink); font-weight: 600; cursor: pointer; padding: 10px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.linkbtn.inline { padding: 0; min-height: 0; display: inline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; justify-content: center; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-family: var(--type); font-size: .78rem; letter-spacing: .04em; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search { width: 100%; min-height: 48px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--card); padding: 0 14px; margin-top: 6px; }
.pill { display: inline-block; font-family: var(--type); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--wash); color: var(--soft); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { color: var(--good); border-color: var(--good); }
.lock { width: 16px; height: 16px; color: var(--dim); flex: none; }
.field { margin: 14px 0; } .field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .hint { font-style: italic; color: var(--dim); font-size: .9rem; margin: 4px 0 0; }
input[type="text"], input[type="password"], input[type="search"], textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 4px; background: var(--card); padding: 10px 12px; min-height: 48px; }
.erow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 0 0 8px; cursor: pointer; }
.erow .t { font-weight: 700; } .erow .s { font-size: .86rem; color: var(--dim); }
.track { height: 8px; background: var(--wash); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.track .fill { height: 100%; background: var(--ink); }

/* catalog */
.ccard { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin: 10px 0; cursor: pointer; }
.ccard.flat { border: 0; padding: 0; margin: 0; background: transparent; }
.cov { flex: 0 0 74px; width: 74px; } .cov img { width: 100%; height: auto; display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.cov.big { flex-basis: 96px; width: 96px; }
.cbody { flex: 1; min-width: 0; }
.ctitle { font-weight: 700; font-size: 1.04rem; line-height: 1.3; margin: 2px 0 4px; }
.cmeta { font-size: .86rem; color: var(--dim); }
.cprice { margin-top: 6px; font-family: var(--type); font-weight: 700; }
.chead { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.card.buy { text-align: center; }
.card.buy .btn { margin: 4px 0; }
.lrow { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 2px; min-height: 52px; cursor: pointer; }
.lrow .lmark { width: 22px; flex: none; text-align: center; font-family: var(--type); color: var(--soft); }
.lrow .ltitle { flex: 1; min-width: 0; line-height: 1.3; }
.lrow.locked .ltitle { color: var(--dim); }

/* lesson */
.lesson-video { width: 100%; border-radius: 6px; background: #000; margin: 6px 0 14px; aspect-ratio: 16 / 9; }
.lesson-body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.lesson-body textarea { -webkit-user-select: text; user-select: text; }
.lesson-body p, .lesson-body li { font-size: 1.04rem; line-height: 1.65; }
.lesson-body h2 { font-size: 1.25rem; margin-top: 22px; }
.lesson-body h3.workhead, .lesson-body h2.workhead { font-family: var(--type); font-size: .86rem; letter-spacing: .14em; text-transform: uppercase; border-top: 1px solid var(--ink); padding-top: 12px; }
.lesson-body blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--ink); background: var(--wash); }
.lesson-body .lesson-img { width: 100%; height: auto; border-radius: 4px; margin: 6px 0 12px; pointer-events: none; }
.lesson-body hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.answer { display: block; margin: 6px 0 14px; font-family: var(--serif); font-size: 1rem; line-height: 1.5; resize: vertical; background: var(--card); }
.answerkey { border: 1px dashed var(--line-2); border-radius: 6px; padding: 4px 14px 10px; margin-top: 10px; }
.revealkey { margin: 10px 0; }
.lessonnav { display: grid; gap: 8px; margin: 22px 0 10px; }
.ipnote { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 18px; }

/* certificate */
.cert { border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -8px; border-radius: 4px; padding: 26px 18px; text-align: center; background: var(--card); margin: 12px 0; }
.cert .certseal { width: 120px; height: auto; margin: 0 auto 6px; display: block; }
.cert .certh { font-family: var(--type); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 14px; }
.cert .certname { font-size: 1.6rem; font-weight: 700; margin: 4px 0 10px; }
.cert .certcourse { font-size: 1.1rem; font-weight: 700; margin: 4px 0 12px; }
.cert p { margin: 4px auto; }

/* academy plans */
.planpick { display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; }
.plan.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 2px solid var(--line-2); border-radius: 6px; background: var(--card); text-align: left; cursor: pointer; }
.plan.opt[aria-checked="true"] { border-color: var(--go); }
.plan.opt .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); }
.plan.opt[aria-checked="true"] .dot { border-color: var(--go); background: radial-gradient(circle, var(--go) 0 42%, transparent 46%); }
.plan.opt .main { flex: 1; display: flex; flex-direction: column; }
.plan.opt .lbl { font-family: var(--type); font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.plan.opt .pr { font-weight: 700; font-size: 1.05rem; }
.bnf .bnfh { font-family: var(--type); font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.bnf ul { list-style: none; margin: 0 0 8px; padding: 0; }
.bnf li { position: relative; padding: 5px 0 5px 28px; }
.bnf li::before { content: "\2713"; position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--go); color: #fff; font-size: .8rem; font-weight: 700; text-align: center; line-height: 20px; font-family: var(--sans); }

/* sheets, toast, quick exit */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 12px 12px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 12px; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: -6px auto 12px; }
.crisis a.btn { width: 100%; margin: 6px 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); z-index: 70; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 6px; font-weight: 600; max-width: calc(100% - 32px); font-family: var(--sans); }
.blank { position: fixed; inset: 0; background: #fff; z-index: 100; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(24px); } } }
.lesson-audio { width: 100%; margin: 6px 0 14px; }
.workbook { margin-top: 18px; }
.wbcard { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 10px 0; }
.wbcard.tactic { border-left: 3px solid var(--ink); }
.wbcard h3 { margin-top: 2px; }
.chips.left { justify-content: flex-start; margin: 6px 0 10px; }
.scalerow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.scalerow .chips { margin: 0; }
.checkline { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; min-height: 44px; }
.checkline input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.carry { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 10px 0; margin: 16px 0; text-align: center; }
.carry p { margin: 4px auto 0; font-style: italic; }
.pmap .pphase { margin: 10px 0; }
.pmap .pbar { height: 6px; background: var(--wash); border-radius: 999px; overflow: hidden; margin: 4px 0; }
.pmap .pbar span { display: block; height: 100%; background: var(--ink); }
.pmap ul { margin: 4px 0; padding-left: 1.1em; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; margin: 4px -16px 0; padding: 0 16px 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
.flabel { font-family: var(--type); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-top: 10px; }

/* 11/12/26: lessons are not printable; the learner's own work is exported from My work */
@media print { body * { display: none !important; } body::before { content: 'Ugly Duckling Workshops lessons are read in the classroom and are not printable.'; display: block; padding: 40px; font-family: serif; } }
