/* OSMED Learn — styles shared with the OSMED Job Jar, derived from the OSMED Brand Guidelines. */

:root {
  /* Primary */
  --periwinkle: #6068B2;
  --basalt: #31261D;
  --tang: #F68D2E;
  /* Secondary */
  --glaucous: #6B7DB9;
  --sky: #BFE3ED;
  --jeju: #9A887B;
  --moss: #92ACA0;
  --pumpkin: #F99963;
  --aqua: #68CABA;
  /* Tertiary */
  --fog: #E9E8E0;
  --white: #FFFFFF;
  --black: #000000;

  --bg: var(--fog);
  --surface: var(--white);
  --text: var(--basalt);
  --text-muted: #5E5248;
  --border: #CFCDC2;
  --link: #4A529A;
  --focus: var(--tang);
  --danger: #B3261E;

  --font-head: "Barlow", "DIN Alternate", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Finlandica", "Helvetica Neue", Arial, sans-serif;

  --radius: 6px;
  --radius-sm: 4px;
  --gutter: 16px;
  --max: 1200px;
  --shadow: 0 1px 2px rgba(49, 38, 29, .06);
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1200px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; } /* tap feedback comes from :active styles */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
main:focus { outline: none; }
img { max-width: 100%; }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 500; line-height: 1.15; margin: 0 0 .5em; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--periwinkle); }
p { margin: 0 0 1em; }
code { font-size: .875em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--basalt); color: var(--white); padding: 8px 12px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--text-muted); }
.pre-line { white-space: pre-line; }
.req { color: var(--danger); }

/* --- Header ------------------------------------------------------------------- */
.env-banner { background: var(--tang); color: var(--basalt); text-align: center; font-family: var(--font-head); font-weight: 600; font-size: .875rem; padding: 4px var(--gutter); letter-spacing: .04em; text-transform: uppercase; }

.site-header { background: var(--fog); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header__inner { max-width: var(--max); margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--basalt); margin-right: auto; padding: 4px 0; }
.brand__logo { height: 20px; width: auto; display: block; }
.brand__name { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; letter-spacing: .06em; text-transform: uppercase; border-left: 1px solid var(--border); padding-left: 12px; }

.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border); background: var(--white); border-radius: var(--radius-sm); cursor: pointer; }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 18px; height: 2px; background: var(--basalt); position: relative; content: ""; }
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }

.site-nav { display: none; width: 100%; }
.site-nav.is-open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.site-nav a:not(.btn) { display: block; padding: 10px 8px; font-family: var(--font-head); font-weight: 500; text-decoration: none; color: var(--basalt); border-radius: var(--radius-sm); }
.site-nav a:not(.btn):hover { background: rgba(96, 104, 178, .08); }
.site-nav a[aria-current="page"] { color: var(--periwinkle); border-radius: 0; box-shadow: inset 3px 0 0 var(--periwinkle); }
.site-nav__cta { display: none; }
.user-menu { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--border); }
.user-menu__name { font-size: .875rem; }
.user-menu form { margin-left: auto; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex !important; width: auto; align-items: center; gap: 16px; }
  .site-nav ul { flex-direction: row; align-items: center; padding: 0; gap: 4px; }
  .site-nav a:not(.btn) { padding: 8px 10px; }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--periwinkle); border-radius: 0; }
  .site-nav__cta { display: block; margin-left: 8px; }
  .user-menu { border-top: 0; padding: 0; border-left: 1px solid var(--border); padding-left: 16px; }
  .user-menu__name { display: none; }
}
@media (min-width: 1200px) { .user-menu__name { display: inline; } }

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar--sm { width: 24px; height: 24px; }
.avatar--initial { display: inline-flex; align-items: center; justify-content: center; background: var(--periwinkle); color: var(--white); font-family: var(--font-head); font-weight: 600; font-size: .875rem; }

.fab {
  position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--tang); color: var(--basalt); text-decoration: none;
  box-shadow: 0 2px 8px rgba(49, 38, 29, .25); z-index: 30;
  -webkit-tap-highlight-color: transparent; /* no grey/blue square on tap; the pulse is the feedback */
}
.fab:hover { color: var(--basalt); }
.fab:focus { outline: none; }
.fab:focus-visible { outline: 3px solid var(--basalt); outline-offset: 3px; }
.fab__icon { display: block; }
.fab.is-pulsing { animation: fab-pulse 320ms ease-out; }
@keyframes fab-pulse {
  0% { transform: scale(1); box-shadow: 0 2px 8px rgba(49, 38, 29, .25), 0 0 0 0 rgba(246, 141, 46, .55); }
  35% { transform: scale(.9); }
  100% { transform: scale(1); box-shadow: 0 2px 8px rgba(49, 38, 29, .25), 0 0 0 14px rgba(246, 141, 46, 0); }
}
@media (min-width: 900px) { .fab { display: none; } }

/* --- Layout -------------------------------------------------------------------- */
.page { width: 100%; max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter) 64px; }
.page-title { font-size: 2.25rem; text-transform: uppercase; color: var(--periwinkle); letter-spacing: .01em; }
@media (min-width: 1200px) { .page-title { font-size: 2.75rem; } }
.lead { font-size: 1.125rem; color: var(--text-muted); max-width: 48rem; }
.breadcrumb { margin-bottom: 16px; font-size: .9375rem; }
.breadcrumb a { text-decoration: none; }

.page-head { position: relative; display: flex; gap: 24px; align-items: flex-end; margin-bottom: 24px; padding-bottom: 20px; overflow: hidden; }
.page-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--border); }
.page-head > div { position: relative; z-index: 1; }
.page-head__deco { position: absolute; right: -24px; top: -40px; height: 220px; width: auto; opacity: 1; pointer-events: none; display: none; }
@media (min-width: 900px) { .page-head__deco { display: block; } .page-head > div { max-width: 70%; } }
/* Decorative diagonal rule, desktop only: on narrow screens it would cut through the lead text. */
.page-head--board::before {
  content: none; position: absolute; right: 18%; top: -60%; width: 1px; height: 260%;
  background: var(--border); transform: rotate(40deg); transform-origin: top; pointer-events: none;
}
@media (min-width: 900px) { .page-head--board::before { content: ""; } }

.site-footer { border-top: 1px solid var(--border); padding: 20px var(--gutter) 88px; text-align: center; font-size: .875rem; color: var(--text-muted); }
.site-footer p { margin: 0 0 4px; }
@media (min-width: 900px) { .site-footer { padding-bottom: 24px; } }

/* --- Flash & toast -------------------------------------------------------------- */
.flash-region { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.flash-region:not(:empty) { padding-top: 16px; }
.flash { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius); color: var(--basalt); margin-bottom: 8px; }
.flash span { flex: 1; }
.flash--success { background: var(--moss); }
.flash--error { background: var(--pumpkin); }
.flash__close { border: 0; background: transparent; font-size: 1.25rem; line-height: 1; cursor: pointer; color: var(--basalt); padding: 0 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--basalt); color: var(--white); padding: 12px 18px; border-radius: var(--radius); z-index: 50; max-width: calc(100% - 32px); }

/* --- Buttons --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-head); font-weight: 500; font-size: .9375rem; letter-spacing: .04em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; line-height: 1.2; transition: background-color .15s, border-color .15s, transform .1s;
  --spin: var(--basalt);
}
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: .8125rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--periwinkle); color: var(--white); }
.btn--primary:hover { background: #4E569C; color: var(--white); }
.btn--accent { background: var(--tang); color: var(--basalt); }
.btn--accent:hover { background: #E57E22; color: var(--basalt); }
.btn--secondary { background: var(--white); color: var(--basalt); border-color: var(--basalt); }
.btn--secondary:hover { background: var(--fog); color: var(--basalt); }
.btn--danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: #FBEAEA; color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:not([disabled]):active { transform: scale(.97); }

/* Busy state: a spinner replaces the label while a request triggered by the button is in flight. */
.btn--primary { --spin: var(--white); }
.btn--danger { --spin: var(--danger); }
.is-busy { pointer-events: none; cursor: progress; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 1.1em; height: 1.1em; margin: -.55em 0 0 -.55em;
  border: 2px solid var(--spin); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
:not(.btn).is-busy { opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Thin progress bar along the top edge for page loads and background requests. */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .15s; }
.loading-bar.is-active { opacity: 1; transition-delay: .15s; }
.loading-bar::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--periwinkle); animation: loading-slide 1.1s ease-in-out infinite; }
@keyframes loading-slide { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::after { animation-duration: 2s; }
  .loading-bar::before { left: 0; width: 100%; animation: none; opacity: .6; }
}
.link-button { border: 0; background: none; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }
.link-button--danger { color: var(--danger); }
.link { font-family: var(--font-head); font-weight: 500; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Badges & chips ------------------------------------------------------------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.badge--recruiting { background: var(--tang); color: var(--basalt); }
.badge--active { background: var(--periwinkle); color: var(--white); }
.badge--expired { background: var(--jeju); color: var(--basalt); }
.badge--archived { background: var(--basalt); color: var(--fog); }
.badge--draft { background: var(--sky); color: var(--basalt); }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--fog); color: var(--basalt); font-size: .8125rem; border: 1px solid var(--border); text-decoration: none; }
a.chip:hover { border-color: var(--periwinkle); color: var(--basalt); }
.chip--more { background: transparent; }
.chip--removable { background: rgba(96, 104, 178, .12); border-color: transparent; padding-right: 4px; }
.chip__remove { border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 6px; color: var(--basalt); border-radius: 50%; }
.chip__remove:hover { background: rgba(49, 38, 29, .1); }

.count-badge { display: inline-block; background: var(--tang); color: var(--basalt); font-family: var(--font-head); font-weight: 600; font-size: .75rem; padding: 2px 8px; border-radius: 999px; text-decoration: none; }
.interested { font-family: var(--font-head); font-weight: 600; font-size: .8125rem; color: var(--link); }

.slots { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; }
.slots__dots { display: inline-flex; gap: 3px; }
.slots__dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--periwinkle); background: transparent; }
.slots__dot--filled { background: var(--periwinkle); }

/* --- Forms ----------------------------------------------------------------------- */
.field { margin-bottom: 20px; border: 0; padding: 0; min-width: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field__label { display: block; font-family: var(--font-head); font-weight: 500; font-size: 1rem; margin-bottom: 4px; padding: 0; }
.field__hint { font-size: .875rem; color: var(--text-muted); margin: 0 0 6px; }
.field__note { font-size: .875rem; margin: 0 0 6px; padding: 6px 10px; border-left: 3px solid var(--periwinkle); background: color-mix(in srgb, var(--sky) 45%, var(--surface)); border-radius: var(--radius-sm); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.field-error { color: var(--danger); font-size: .875rem; font-weight: 600; margin: 6px 0 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row .field { flex: 0 1 auto; }
.field--grow { flex: 1 1 240px !important; }
.field--inline { display: flex; gap: 16px; margin-top: -8px; }

.input, .select, .textarea {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #A39E92; border-radius: var(--radius-sm); background: var(--white);
  color: var(--text); font: inherit; font-size: 1rem;
}
.input--sm, .select--sm { min-height: 36px; padding: 6px 10px; font-size: .9375rem; width: auto; }
.input--num { width: 7rem; }
.input--date { width: 12rem; }
.textarea { resize: vertical; line-height: 1.5; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"], .is-invalid { border-color: var(--danger); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--periwinkle); }
.radio, .checkbox { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.radio input, .checkbox input { width: 18px; height: 18px; accent-color: var(--periwinkle); margin: 0; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 500; font-size: .875rem; }

/* Equal-width options on one row; on narrow screens a long label wraps inside its own cell. */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; border: 1px solid var(--basalt); border-radius: var(--radius-sm); overflow: hidden; }
@media (min-width: 640px) { .segmented { display: inline-grid; width: auto; } }
.segmented__opt { position: relative; display: flex; }
.segmented__opt input { position: absolute; opacity: 0; inset: 0; }
.segmented__opt span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 8px 10px; font-family: var(--font-head); font-weight: 500; line-height: 1.2; cursor: pointer; background: var(--white); border-right: 1px solid var(--basalt); }
@media (min-width: 640px) { .segmented__opt span { padding: 10px 16px; white-space: nowrap; } }
.segmented__opt:last-child span { border-right: 0; }
.segmented__opt input:checked + span { background: var(--periwinkle); color: var(--white); }
.segmented__opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.form-page { max-width: 760px; }
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
@media (min-width: 640px) { .form-section { padding: 24px 28px; } }
.form-section__title { font-size: 1.375rem; color: var(--basalt); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 16px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.error-summary { border: 2px solid var(--danger); background: var(--white); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.error-summary h2 { font-size: 1.125rem; color: var(--danger); }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--danger); font-weight: 600; }

.notice { background: var(--white); border-left: 4px solid var(--periwinkle); padding: 10px 14px; border-radius: var(--radius-sm); }
.notice--info { background: var(--sky); border-left-color: var(--periwinkle); }
.notice--error { border-left-color: var(--danger); }

/* Markdown editor */
.md-field__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.md-tabs { display: inline-flex; margin-bottom: 4px; }
.md-tab { border: 1px solid var(--border); background: var(--white); padding: 4px 10px; font-family: var(--font-head); font-size: .8125rem; cursor: pointer; color: var(--text-muted); }
.md-tab:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.md-tab:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.md-tab[aria-pressed="true"] { background: var(--basalt); color: var(--white); border-color: var(--basalt); }
.md-preview { min-height: 120px; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--white); }

/* Comboboxes (tags, people, postings) */
.tag-input, .person-input { position: relative; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; min-height: 44px; background: var(--white); border: 1px solid #A39E92; border-radius: var(--radius-sm); }
.tag-input:focus-within { border-color: var(--periwinkle); }
.tag-input__chips { display: contents; list-style: none; }
.tag-input__text { flex: 1 1 140px; min-width: 120px; border: 0; padding: 6px; font: inherit; background: transparent; outline: none; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; list-style: none; margin: 0; padding: 4px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(49, 38, 29, .15); max-height: 300px; overflow-y: auto; }
.combo-option { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.combo-option--person { justify-content: flex-start; }
.combo-option[aria-selected="true"], .combo-option:hover { background: rgba(96, 104, 178, .12); }
.combo-option--create { font-weight: 600; color: var(--link); }
.combo-option--similar { background: var(--sky); }
.combo-option__count { font-size: .75rem; color: var(--text-muted); background: var(--fog); border-radius: 999px; padding: 0 8px; }
.combo-empty { padding: 10px; color: var(--text-muted); font-size: .875rem; }

.related-editor { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.related-editor__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px; background: var(--fog); border-radius: var(--radius-sm); }
.related-editor__title { flex: 1; min-width: 160px; }

/* --- Board ----------------------------------------------------------------------- */
.board { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1200px) { .board { grid-template-columns: 280px 1fr; align-items: start; } }

.filters__toggle { width: 100%; }
.filters__panel { display: none; margin-top: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filters__panel.is-open { display: block; }
.filters__actions { display: flex; align-items: center; gap: 12px; }
@media (min-width: 640px) {
  .filters__panel.is-open { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
}
@media (min-width: 1200px) {
  .filters__toggle { display: none; }
  .filters__panel, .filters__panel.is-open { display: block; margin-top: 0; position: sticky; top: 84px; }
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-family: var(--font-head); font-weight: 500; font-size: 1rem; text-decoration: none; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--basalt); border-bottom-color: var(--periwinkle); }
.tab:hover { color: var(--basalt); }
.tab__count { font-size: .75rem; background: var(--white); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; color: var(--text-muted); font-family: var(--font-body); }

.results-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-count { font-size: 1.125rem; margin: 0; font-family: var(--font-head); color: var(--text-muted); }
.results-controls { display: flex; gap: 12px; flex-wrap: wrap; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1400px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }
.load-more-row { grid-column: 1 / -1; text-align: center; padding: 8px; }

.card {
  position: relative; height: 100%; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--periwinkle); transform: translateY(-1px); }
.card__title { font-size: 1.25rem; margin: 0; }
.card__link { color: var(--basalt); text-decoration: none; }
.card__link::after { content: ""; position: absolute; inset: 0; }
.card__link:focus-visible { outline: none; }
.card:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.card__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .875rem; color: var(--text-muted); margin: 0; }
.card__foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--fog); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--jeju); }
.meta-icon--hard_deadline { background: var(--danger); }
.meta-icon--target { background: var(--periwinkle); }

.empty { position: relative; overflow: hidden; text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h2, .empty h3 { font-size: 1.375rem; position: relative; }
.empty p { position: relative; }
.empty__deco { position: absolute; right: -30px; bottom: -40px; height: 160px; width: auto; }

/* --- Detail ---------------------------------------------------------------------- */
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.banner p { margin: 0; }
.banner--draft { background: var(--sky); border: 1px dashed var(--periwinkle); }

.detail__head { background: var(--surface); border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
@media (min-width: 640px) { .detail__head { padding: 24px 28px; } }
.detail__status { margin-bottom: 8px; }
.detail__title { font-size: 1.75rem; margin-bottom: 12px; }
@media (min-width: 900px) { .detail__title { font-size: 2.25rem; } }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 24px; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--fog); }
.facts dt { font-family: var(--font-head); font-weight: 500; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.facts dd { margin: 2px 0 0; }

.detail__grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .detail__grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; } .detail__side { position: sticky; top: 84px; } }
.detail__content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
@media (min-width: 640px) { .detail__content { padding: 24px 28px; } }
.detail__side { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 899px) { .detail__side { order: -1; } }
.section + .section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--fog); }
.section__title { font-size: 1.125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--periwinkle); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel--volunteer { border-top: 4px solid var(--tang); }
.panel--manager { border-top: 4px solid var(--periwinkle); }
.panel__title { font-size: 1.25rem; margin: 0; }
.panel p { margin: 0; }
.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: 4px 0; }

.disclosure summary { cursor: pointer; font-family: var(--font-head); font-weight: 500; color: var(--link); padding: 6px 0; }
.disclosure[open] summary { margin-bottom: 8px; }
.disclosure--inline summary { padding: 0; }

.slots-form fieldset { margin: 0; }
.slots-form__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slots-form__counts { display: contents; }
.slots-form .input--num { width: 5rem; }

.related { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.related__kind { font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-right: 6px; }

.interests { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
@media (min-width: 640px) { .interests { padding: 24px 28px; } }
.interests__group { font-size: 1rem; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.interest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.interest { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.interest--pending { border-left-color: var(--tang); }
.interest--accepted { border-left-color: var(--periwinkle); }
.interest__head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: .9375rem; }
.interest__msg { margin: 8px 0; }
.interest__note { font-size: .875rem; margin: 0 0 8px; }
.interest__form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.interest__form .input--sm { flex: 1 1 200px; width: auto; }
.interest-state--accepted { color: var(--link); }
.interest-state--declined, .interest-state--withdrawn { color: var(--text-muted); }

.prose { overflow-wrap: anywhere; }
.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose blockquote { margin: 0 0 1em; padding: 4px 12px; border-left: 4px solid var(--border); color: var(--text-muted); }
.prose pre { background: var(--fog); padding: 10px; border-radius: var(--radius-sm); overflow-x: auto; }
.prose table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.prose h1, .prose h2, .prose h3 { font-size: 1.125rem; margin-top: 1em; }

/* --- Lists (My stuff) ------------------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: 14px 16px; }
.list__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 280px; }
.list__title { font-family: var(--font-head); font-weight: 500; font-size: 1.125rem; color: var(--basalt); text-decoration: none; }
.list__title:hover { text-decoration: underline; }
.list__aside { display: flex; align-items: center; gap: 12px; }

/* --- Admin ----------------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fog); vertical-align: top; }
.table thead th { font-family: var(--font-head); font-weight: 600; font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; background: var(--fog); }
.table thead a { color: var(--basalt); text-decoration: none; }
.table thead a[aria-current] { color: var(--periwinkle); text-decoration: underline; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }

/* --- Login & simple pages ---------------------------------------------------------- */
.login { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px var(--gutter); min-height: 80vh; }
.login::before { content: ""; position: absolute; left: 50%; top: -10%; width: 1px; height: 140%; background: var(--border); transform: rotate(40deg); }
.login__deco { position: absolute; pointer-events: none; width: auto; }
.login__deco--m { height: 260px; right: -40px; top: -30px; }
.login__deco--e { height: 220px; left: -60px; bottom: -40px; }
.login__card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 28px; text-align: center; }
.login__logo { width: 200px; height: auto; margin: 0 auto 8px; display: block; }
.login__lockup { width: 100%; max-width: 300px; height: auto; margin: 0 auto 16px; display: block; }
.login__title { font-size: 2rem; text-transform: uppercase; color: var(--periwinkle); letter-spacing: .04em; }
.login__card .lead { font-size: 1rem; }
.dev-login { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); text-align: left; }
.dev-login h2 { font-size: 1rem; margin-bottom: 0; }

.error-page { position: relative; overflow: hidden; padding: 48px 0; }
.error-page__code { font-family: var(--font-head); font-weight: 600; font-size: 4rem; color: var(--border); margin: 0; line-height: 1; }
.error-page__deco { position: absolute; right: -20px; top: 20px; height: 220px; width: auto; }
.test-email { margin-top: 8px; }

/* Status color bars (kept last so they win over component borders). */
.card--recruiting { border-left-color: var(--tang); }
.card--active { border-left-color: var(--periwinkle); }
.card--expired { border-left-color: var(--jeju); }
.card--archived { border-left-color: var(--basalt); }
.card--draft { border-left-color: var(--sky); border-left-style: dashed; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .fab, .detail__side, .interests, .filters { display: none !important; }
  body { background: var(--white); }
}

/* Touch screens: hover styles otherwise stick after a tap; use brief :active feedback instead. */
@media (hover: none) {
  .card:hover { border-color: var(--border); transform: none; }
  .card:active { border-color: var(--periwinkle); }
  .btn--primary:hover { background: var(--periwinkle); }
  .btn--accent:hover { background: var(--tang); }
  .btn--secondary:hover { background: var(--white); }
  .btn--danger:hover { background: var(--white); }
  .btn--primary:active { background: #4E569C; }
  .btn--accent:active { background: #E57E22; }
  .btn--secondary:active { background: var(--fog); }
  .btn--danger:active { background: #FBEAEA; }
  .site-nav a:not(.btn):hover { background: none; }
  .site-nav a:not(.btn):active, .tab:active { background: rgba(96, 104, 178, .08); }
}

/* ================================================================================== */
/* OSMED Learn components                                                             */
/* ================================================================================== */

.icon { display: inline-block; vertical-align: -0.15em; flex: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.page-title--sm { font-size: 1.75rem; text-transform: none; }
.page-head__action { position: relative; z-index: 1; margin-left: auto; align-self: center; }
.button-row--center { justify-content: center; }
.field-row--tight { gap: 8px; align-items: center; }
.field-row--end { align-items: flex-end; }
.checkbox--sm { min-height: 28px; font-size: .875rem; }
.field__label--sm { font-size: .875rem; }
.textarea--code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem; }
.chip--sm { font-size: .75rem; padding: 1px 8px; }
.table--compact th, .table--compact td { padding: 6px 8px; }
.toolbar--filters { justify-content: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.tabs--inline { border-bottom: 0; margin-bottom: 0; }
.results-note { margin-top: 12px; font-size: .875rem; }

/* --- Header additions --------------------------------------------------------------- */
.header-search { order: 3; width: 100%; }
.header-search__input { width: 100%; }
@media (min-width: 900px) {
  .site-header__inner { flex-wrap: nowrap; }
  .header-search { order: 0; width: auto; flex: 1 1 120px; max-width: 260px; min-width: 100px; }
  .site-nav { flex: none; }
}
@media (min-width: 900px) { .user-menu .user-menu__name { display: none; } .site-nav a:not(.btn), .menu > summary { padding-left: 8px; padding-right: 8px; } }
.brand { margin-right: 0; }
@media (max-width: 899px) { .brand { margin-right: auto; } }
.site-header__inner { gap: 12px 16px; }
@media (min-width: 900px) { .site-nav { margin-left: auto; } }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 8px; font-family: var(--font-head); font-weight: 500; border-radius: var(--radius-sm); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.menu > summary[aria-current="page"] { color: var(--periwinkle); }
.menu__list { list-style: none; margin: 4px 0 0; padding: 6px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(49, 38, 29, .14); min-width: 200px; }
.menu__list a, .menu__button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--basalt); font: inherit; background: none; border: 0; cursor: pointer; }
.menu__list a:hover, .menu__button:hover { background: rgba(96, 104, 178, .1); }
@media (min-width: 900px) {
  .menu__list { position: absolute; top: 100%; left: 0; z-index: 60; }
  .menu--right .menu__list { left: auto; right: 0; }
}
.user-menu { padding: 0; }
.user-menu__summary { padding: 4px 8px; }
.user-menu form { margin: 0; }
.rank { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.rank--sm { font-size: .6875rem; padding: 1px 8px; }
.rank--r1 { background: var(--white); color: var(--basalt); border-color: var(--border); }
.rank--r2 { background: var(--sky); color: var(--basalt); }
.rank--r3 { background: var(--aqua); color: var(--basalt); }
.rank--r4 { background: var(--moss); color: var(--basalt); }
.rank--r5 { background: var(--pumpkin); color: var(--basalt); }
.rank--r6 { background: var(--tang); color: var(--basalt); }
.rank--r7 { background: var(--periwinkle); color: var(--white); }
.rank--r8 { background: var(--basalt); color: var(--fog); }

.subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-bottom: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.subnav__link { font-family: var(--font-head); font-weight: 500; text-decoration: none; color: var(--text-muted); padding: 6px 0; }
.subnav__link[aria-current="page"] { color: var(--periwinkle); box-shadow: inset 0 -3px 0 var(--periwinkle); }
.subnav__cta { margin-left: auto; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 16px; background: var(--white); border: 1px dashed var(--periwinkle); border-radius: var(--radius); }
.admin-bar__label { font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--periwinkle); }

.badge--published { background: var(--moss); color: var(--basalt); }
.badge--scheduled { background: var(--tang); color: var(--basalt); }
.badge--req-planned { background: var(--sky); color: var(--basalt); }
.badge--req-done { background: var(--moss); color: var(--basalt); }
.badge--req-declined { background: var(--jeju); color: var(--basalt); }

/* --- Home ---------------------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.hero__text { position: relative; z-index: 1; max-width: 640px; }
.hero__deco { position: absolute; right: -30px; top: -50px; height: 200px; width: auto; display: none; }
@media (min-width: 1200px) { .hero__deco { display: block; } .hero { padding-right: 160px; } }
.stat-strip { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--basalt); font-size: .9375rem; }
.stat-strip:hover { border-color: var(--periwinkle); color: var(--basalt); }
.stat-strip__item { display: inline-flex; align-items: center; gap: 6px; }
.stat-strip__item .icon--flame { color: var(--tang); }
.stat-strip__next { display: flex; flex-direction: column; gap: 4px; min-width: 160px; font-size: .8125rem; }

.shelf { margin: 28px 0; }
.shelf__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.shelf__title { font-size: 1.375rem; margin: 0; }
@media (max-width: 639px) {
  .cards--shelf { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding: var(--gutter); }
  .cards--shelf > li { scroll-snap-align: start; }
}
@media (min-width: 640px) { .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }

/* --- Resource cards ------------------------------------------------------------------ */
.rcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.rcard:hover { border-color: var(--periwinkle); transform: translateY(-1px); }
.rcard:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.rcard__thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--fog); overflow: hidden; }
.rcard__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcard__placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--white); background: var(--periwinkle); }
.rcard__placeholder--audio { background: var(--glaucous); }
.rcard__placeholder--pdf, .rcard__placeholder--file { background: var(--moss); color: var(--basalt); }
.rcard__placeholder--link { background: var(--aqua); color: var(--basalt); }
.rcard__len { position: absolute; right: 8px; bottom: 8px; background: rgba(49, 38, 29, .85); color: var(--white); font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.rcard__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; width: 100%; }
.rcard__body { padding: 12px 14px 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rcard__kind { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.rcard__quiz { display: inline-flex; align-items: center; gap: 3px; color: var(--link); }
.rcard__title { font-size: 1.0625rem; margin: 0; line-height: 1.25; }
.rcard__people { margin: 0; font-size: .875rem; color: var(--text-muted); }
.rcard__meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8125rem; color: var(--text-muted); }
.rcard__meta span { display: inline-flex; align-items: center; gap: 4px; }
.rcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px 14px; border-top: 1px solid var(--fog); min-height: 48px; }
.rcard__foot form, .rcard__foot .iconbtn { position: relative; z-index: 2; }
.rcard__tags { flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.rcard__tags .chip { white-space: nowrap; }
.rcard__pct { font-size: .8125rem; }
.rcard--done .rcard__thumb::after { content: ""; position: absolute; inset: 0; background: rgba(233, 232, 224, .35); }
.done-label { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-head); font-weight: 600; font-size: .8125rem; color: #3E6B57; }
.done-label--lg { font-size: .9375rem; }

.iconbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border: 1px solid transparent; background: transparent; border-radius: 50%; color: var(--text-muted); cursor: pointer; font-size: 1.125rem; line-height: 1; }
.iconbtn:hover { background: var(--fog); color: var(--basalt); }
.iconbtn.is-on { color: var(--periwinkle); }
.lib-form, .like-form { display: inline-flex; margin: 0; }
.btn.is-on { border-color: var(--periwinkle); color: var(--periwinkle); }
.btn.is-liked { color: #A3323A; border-color: #A3323A; }
.btn__count { font-family: var(--font-body); font-weight: 600; text-transform: none; letter-spacing: 0; }

.pbar { display: block; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; }
.pbar__track { fill: var(--fog); }
.pbar__fill { fill: var(--periwinkle); }
.rcard__progress .pbar__track { fill: rgba(49, 38, 29, .35); }
.rcard__progress .pbar__fill { fill: var(--tang); }

/* Collection cards */
.ccards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ccard { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--tang); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.ccard:hover { border-color: var(--periwinkle); border-top-color: var(--tang); }
.ccard--done { border-top-color: var(--moss); }
.ccard__kind { margin: 0; display: flex; gap: 6px; align-items: center; font-family: var(--font-head); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.ccard__title { font-size: 1.25rem; margin: 0; }
.ccard__desc { margin: 0; font-size: .9375rem; color: var(--text-muted); }
.ccard__prog { margin: 0; font-size: .875rem; display: flex; gap: 4px; align-items: center; }

/* --- Browse ---------------------------------------------------------------------------- */
.filters__panel .field { margin-bottom: 16px; }
.field--inline-radios { display: flex; gap: 16px; margin-top: -10px; }
.results[aria-busy="true"] { opacity: .6; }

/* --- Resource page --------------------------------------------------------------------- */
.resource__head { margin-bottom: 16px; }
.resource__kind { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; font-family: var(--font-head); font-weight: 600; font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.resource__title { font-size: 1.75rem; margin-bottom: 10px; }
@media (min-width: 900px) { .resource__title { font-size: 2.25rem; } }
.people-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.resource__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; color: var(--text-muted); font-size: .9375rem; }
.resource__meta span { display: inline-flex; align-items: center; gap: 5px; }
.stars { display: inline-flex; align-items: center; gap: 4px; }
.stars .icon--star { color: var(--tang); }
.resource__grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .resource__grid--side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .resource__side { position: sticky; top: 84px; } }
.resource__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.resource__side { display: flex; flex-direction: column; gap: 16px; }
.resource__description { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.player__frame { position: relative; aspect-ratio: 16 / 9; background: var(--black); border-radius: var(--radius); overflow: hidden; }
.player__frame video, .player__yt, .player__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player__frame video { background: var(--black); }
.player-placeholder { aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: var(--basalt); color: var(--fog); border-radius: var(--radius); }
.player-placeholder p { margin: 0 0 4px; }
.player-placeholder .muted { color: #CFCDC2; }
.audio-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--periwinkle); border-radius: var(--radius); color: var(--white); }
.audio-card audio { flex: 1; width: 100%; min-width: 0; }
.audio-card__icon { flex: none; }
.doc-viewer__frame { display: block; width: 100%; height: 75vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.doc-viewer__alt { margin: 6px 0 0; font-size: .875rem; }
.file-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--moss); border-radius: var(--radius); }
.file-card--link { border-left-color: var(--aqua); }
.file-card > div { flex: 1; min-width: 180px; }
.file-card__name { margin: 0; font-family: var(--font-head); font-weight: 500; font-size: 1.125rem; overflow-wrap: anywhere; }
.file-card__icon { color: var(--text-muted); }
.chapter-bar { position: relative; height: 10px; margin-top: -8px; background: var(--fog); border-radius: 0 0 4px 4px; }
.chapter-bar__tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--periwinkle); }
.chapter-bar__now { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: rgba(96, 104, 178, .25); }

.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-bar__spacer { flex: 1; }
.completion form { margin: 0; }
.watch-progress p { margin: 6px 0 0; font-size: .875rem; }
.quiz-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 18px; background: var(--white); border: 1px solid var(--border); border-left: 6px solid var(--periwinkle); border-radius: var(--radius); }
.quiz-card > div { flex: 1; min-width: 200px; }
.quiz-card__title { font-size: 1.125rem; margin: 0 0 2px; }
.quiz-card p { margin: 0; }
.quiz-card__icon { color: var(--periwinkle); }
.panel--rate { border-top: 4px solid var(--tang); }
.rating-form { display: flex; flex-direction: column; gap: 8px; }
.rating-form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; border: 0; padding: 0; margin: 0; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { cursor: pointer; color: var(--border); padding: 2px; border-radius: 4px; }
.stars-input svg { fill: currentColor; display: block; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--tang); }
.stars-input input:focus-visible + label { outline: 3px solid var(--focus); }
.notes { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; }
.notes__form { display: flex; flex-direction: column; gap: 6px; }
.notes__foot { display: flex; justify-content: space-between; align-items: center; min-height: 24px; font-size: .8125rem; }
.notes-status--error { color: var(--danger); }
.note-excerpt { font-size: .9375rem; }

.side-panel { padding: 14px; }
.side-panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.side-panel__head .input { width: 100%; }
.chapters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.chapters__item, .transcript__btn { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; color: var(--basalt); }
.chapters__item:hover, .transcript__btn:hover { background: var(--fog); }
.chapters__item.is-current { background: rgba(96, 104, 178, .12); font-weight: 600; }
.chapters__time, .transcript__time { flex: none; font-variant-numeric: tabular-nums; color: var(--link); font-size: .875rem; min-width: 3.4em; }
.transcript { max-height: 420px; overflow-y: auto; border-top: 1px solid var(--fog); padding-top: 6px; }
.transcript__list { list-style: none; margin: 0; padding: 0; }
.transcript__text { font-size: .9375rem; }
.transcript__cue.is-current .transcript__btn { background: var(--sky); }
.side-panel--transcript .panel__title { margin: 0; }

.comments-wrap { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
@media (min-width: 640px) { .comments-wrap { padding: 24px 28px; } }
.comment-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.comment-form .textarea { width: 100%; }
.thread { border-top: 1px solid var(--fog); padding: 12px 0; }
.comment__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment__name { font-family: var(--font-head); font-weight: 500; text-decoration: none; color: var(--basalt); }
.comment__date { font-size: .8125rem; }
.comment__body { margin: 6px 0 4px 32px; }
.comment__actions { margin-left: 32px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-start; font-size: .875rem; }
.comment__actions form { margin: 0; }
.comment--reply { margin: 10px 0 0 32px; padding-left: 12px; border-left: 3px solid var(--fog); }
.comment__deleted { margin: 0; font-style: italic; }
.in-collections { margin-top: 20px; }

.share-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(520px, calc(100% - 32px)); box-shadow: 0 12px 40px rgba(49, 38, 29, .25); }
.share-dialog::backdrop { background: rgba(49, 38, 29, .45); }
.share-dialog__inner { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.share-dialog__title { font-size: 1.375rem; margin: 0; }
.share-dialog__inner p { margin: 0; }
.share-dialog__row { display: flex; gap: 8px; }
.share-dialog__row .input { flex: 1; min-width: 0; }
.share-dialog__status { min-height: 1.4em; font-size: .875rem; color: #3E6B57; }

/* --- Quiz ------------------------------------------------------------------------------ */
.quiz-q__prompt { font-family: var(--font-head); font-weight: 500; font-size: 1.125rem; padding: 0; margin-bottom: 8px; }
.quiz-q__num { color: var(--periwinkle); }
.quiz-q__choice { align-items: flex-start; padding: 6px 0; }
.quiz-q__choice input { margin-top: 3px; }
.quiz-result { display: flex; gap: 20px; align-items: center; padding: 20px; border-radius: var(--radius); margin-bottom: 20px; background: var(--white); border: 1px solid var(--border); border-left: 6px solid var(--pumpkin); }
.quiz-result--pass { border-left-color: var(--moss); }
.quiz-result__score { font-family: var(--font-head); font-weight: 600; font-size: 3rem; margin: 0; line-height: 1; }
.quiz-result__title { margin: 0 0 4px; }
.quiz-review { padding-left: 1.25em; display: flex; flex-direction: column; gap: 12px; }
.quiz-review__item { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--moss); border-radius: var(--radius-sm); padding: 10px 14px; }
.quiz-review__item.is-wrong { border-left-color: var(--pumpkin); }
.quiz-review__item p { margin: 0 0 4px; }

/* --- Stats, charts ------------------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi dt { font-family: var(--font-head); font-weight: 500; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.kpi dd { margin: 2px 0 0; font-family: var(--font-head); font-weight: 600; font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hbars__row { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; align-items: center; gap: 10px; font-size: .875rem; }
.hbars__row--wide { grid-template-columns: minmax(120px, 45%) 1fr auto; }
.hbars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars__bar { width: 100%; height: 12px; background: var(--fog); border-radius: 2px; }
.hbars__bar rect { fill: var(--periwinkle); }
.hbars__value { font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
.chart-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 900px) { .chart-grid { grid-template-columns: 1fr 1fr; } }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chart__title { font-family: var(--font-head); font-weight: 500; font-size: 1.0625rem; margin-bottom: 10px; }
.chart__svg { display: block; width: 100%; height: 180px; }
.chart__bar { fill: var(--periwinkle); }
.chart__hit { fill: transparent; }
.chart__col:hover .chart__bar { fill: #4E569C; }
.chart__col:hover .chart__hit { fill: rgba(96, 104, 178, .08); }
.chart__base { stroke: var(--border); stroke-width: .3; vector-effect: non-scaling-stroke; }
.chart__axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.chart__table { margin-top: 8px; font-size: .875rem; }

/* --- Leaderboard & profiles -------------------------------------------------------------- */
.lb-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .lb-grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.lb-side { display: flex; flex-direction: column; gap: 16px; }
.lb__pos { width: 3em; font-weight: 600; font-variant-numeric: tabular-nums; }
.lb__medal { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-family: var(--font-head); }
.lb__medal--1 { background: var(--tang); color: var(--basalt); }
.lb__medal--2 { background: var(--sky); color: var(--basalt); }
.lb__medal--3 { background: var(--pumpkin); color: var(--basalt); }
.lb__person { display: inline-flex; align-items: center; gap: 8px; color: var(--basalt); text-decoration: none; font-weight: 500; }
.lb__person:hover span { text-decoration: underline; }
.lb tr.is-me { background: rgba(96, 104, 178, .08); }
.lb__gap td { text-align: center; color: var(--text-muted); padding: 2px; }
.lb .icon--flame, .kpi .icon--flame { color: var(--tang); }
.mini-list { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; }
.rank-ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .875rem; }
.avatar--xl { width: 88px; height: 88px; font-size: 2rem; }
.profile-head { position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-head__text { position: relative; z-index: 1; }
.profile-head__name { font-size: 2rem; margin-bottom: 6px; }
.profile-head p { margin: 0 0 4px; }
.rank-progress { margin-bottom: 20px; }
.medals { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.medal { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.medal__disc { flex: none; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.medal__text { display: flex; flex-direction: column; font-size: .875rem; line-height: 1.3; }
.medal__desc { color: var(--text-muted); }
.medal__date { color: var(--text-muted); font-size: .75rem; }
.medal--tang .medal__disc { background: var(--tang); color: var(--basalt); }
.medal--sky .medal__disc { background: var(--sky); color: var(--basalt); }
.medal--periwinkle .medal__disc { background: var(--periwinkle); color: var(--white); }
.medal--basalt .medal__disc { background: var(--basalt); color: var(--fog); }
.medal--moss .medal__disc { background: var(--moss); color: var(--basalt); }
.medal--aqua .medal__disc { background: var(--aqua); color: var(--basalt); }
.medal--pumpkin .medal__disc { background: var(--pumpkin); color: var(--basalt); }
.medal--locked { background: transparent; border-style: dashed; }
.medal--locked .medal__disc { background: var(--fog); color: var(--text-muted); }

/* --- Collections ------------------------------------------------------------------------ */
.collection-head { border-left-color: var(--tang); }
.collection-head__progress { margin: 12px 0; max-width: 420px; }
.collection-head__progress p { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; }
.steps { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.step--next { border-color: var(--periwinkle); box-shadow: inset 4px 0 0 var(--periwinkle); }
.step__num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--fog); font-family: var(--font-head); font-weight: 600; }
.step--done .step__num { background: var(--moss); color: var(--basalt); }
.step__main { flex: 1; min-width: 0; }
.step__main p { margin: 2px 0 0; font-size: .875rem; }
.step__title { font-family: var(--font-head); font-weight: 500; font-size: 1.125rem; color: var(--basalt); text-decoration: none; }
.step__title:hover { text-decoration: underline; }

/* --- Requests --------------------------------------------------------------------------- */
.requests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.request { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.request__main { flex: 1; min-width: 0; }
.request__title { font-size: 1.25rem; margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.request__main p { margin: 0 0 6px; }
.request__meta { font-size: .8125rem; }
.request__note { background: var(--fog); padding: 6px 10px; border-radius: var(--radius-sm); }
.request__actions { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-start; font-size: .875rem; }
.request__actions form { margin: 0; }
.triage-form { min-width: 260px; max-width: 420px; padding: 8px 0; }
.vote-form { margin: 0; }
.vote { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: 52px; min-height: 56px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); color: var(--text-muted); cursor: pointer; font-family: var(--font-head); font-weight: 600; }
.vote:hover { border-color: var(--periwinkle); color: var(--periwinkle); }
.vote.is-on { background: var(--periwinkle); border-color: var(--periwinkle); color: var(--white); }
.vote[disabled] { opacity: .5; cursor: not-allowed; }
.vote__count { font-size: 1.125rem; }

/* --- Admin forms ------------------------------------------------------------------------- */
.form-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.form-head .page-title { margin-bottom: 4px; }
.resource-form, .form-page { max-width: 860px; }
.form-section--danger { max-width: 860px; border-color: #E8B4B0; }
.kind-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kind-card { position: relative; display: block; cursor: pointer; }
.kind-card input { position: absolute; opacity: 0; inset: 0; }
.kind-card__body { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #A39E92; border-radius: var(--radius-sm); background: var(--white); font-family: var(--font-head); font-weight: 500; min-height: 52px; }
.kind-card input:checked + .kind-card__body { border-color: var(--periwinkle); box-shadow: inset 0 0 0 2px var(--periwinkle); color: var(--periwinkle); }
.kind-card input:focus-visible + .kind-card__body { outline: 3px solid var(--focus); outline-offset: 2px; }
.kind-card input:disabled + .kind-card__body { opacity: .45; cursor: not-allowed; }
.uploader { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border: 1px dashed #A39E92; border-radius: var(--radius-sm); background: var(--white); }
.uploader.is-invalid { border-color: var(--danger); }
.uploader.is-dragover { border-color: var(--periwinkle); background: rgba(96, 104, 178, .06); }
.uploader__current { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.uploader__pick { cursor: pointer; }
.uploader__progress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.uploader__progress progress { flex: 1 1 200px; height: 10px; accent-color: var(--periwinkle); }
.media-status { font-size: .8125rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--fog); }
.media-status--ready { background: var(--moss); }
.media-status--processing { background: var(--sky); }
.media-status--failed { background: var(--pumpkin); }
.thumb-field { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.thumb-field__img { width: 192px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.youtube-preview { display: flex; gap: 12px; align-items: center; margin-top: 8px; padding: 8px; background: var(--fog); border-radius: var(--radius-sm); font-size: .9375rem; }
.youtube-preview img { width: 120px; border-radius: 3px; }
.contrib-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.contrib-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: var(--fog); border-radius: var(--radius-sm); }
.contrib-row__person { flex: 1 1 240px; }
.contrib-row__person .input { width: 100%; }
.contrib-row__kind { font-size: .75rem; width: 4.5em; }
.quiz-edit { padding: 16px 20px; }
.choice-list { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 6px; }
.choice-row { display: flex; align-items: center; gap: 8px; }
.choice-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--moss); flex: none; }
.choice-row .input { flex: 1; width: auto; }
.feedback-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feedback { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.feedback p { margin: 0 0 4px; }

@media (prefers-reduced-motion: reduce) { .rcard:hover { transform: none; } }
@media (hover: none) { .rcard:hover { border-color: var(--border); transform: none; } .rcard:active { border-color: var(--periwinkle); } }
@media print { .action-bar, .notes, .comments-wrap, .admin-bar, .player { display: none !important; } }
