/* THC PWA — plugin-owned UI (offline banner, header phone icon, offline button in the course pages' bars, offline panel, the /app/ page).
 * Uses the live theme palette tokens with literal fallbacks. Scoped to .thc-pwa-* only. */

:root {
  --thc-pwa-canvas: var(--wp--preset--color--canvas, #F7F1E4);
  --thc-pwa-raised: var(--wp--preset--color--raised-surface, #FCF8EF);
  --thc-pwa-muted: var(--wp--preset--color--muted-surface, #ECE4D9);
  --thc-pwa-border: var(--wp--preset--color--border-divider, #D9D0BC);
  --thc-pwa-text: var(--wp--preset--color--primary-text, #332D25);
  --thc-pwa-leaf: var(--wp--preset--color--leaf-accent, #5E7D53);
  --thc-pwa-deep: var(--wp--preset--color--deep-leaf-accent, #3F5C3B);
  --thc-pwa-sage: var(--wp--preset--color--soft-sage-accent, #A8B79A);
  --thc-pwa-font: var(--wp--preset--font-family--fira-sans, "THC Fira Sans", "Segoe UI", Arial, sans-serif);
  --thc-pwa-z: 99990;
}

/* ---- offline banner ---- */
.thc-pwa-banner {
  position: fixed; inset: 0 0 auto 0; z-index: var(--thc-pwa-z);
  padding: 0.6rem 1rem; text-align: center;
  background: var(--thc-pwa-deep); color: #fff;
  font: 500 0.9375rem/1.4 var(--thc-pwa-font);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.thc-pwa-banner[hidden] { display: none; }
html.thc-pwa-offline body { padding-top: 2.6rem; }

/* ---- focus ---- */
.thc-pwa-btn:focus-visible, .thc-pwa-panel__close:focus-visible, .thc-pwa-barbtn:focus-visible, .thc-pwa-header-icon:focus-visible {
  outline: 3px solid var(--thc-pwa-sage); outline-offset: 2px;
}

/* ---- panel ---- */
.thc-pwa-overlay {
  position: fixed; inset: 0; z-index: calc(var(--thc-pwa-z) + 1);
  background: rgba(51,45,37,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; overscroll-behavior: contain;
}
.thc-pwa-panel {
  width: 100%; max-width: 40rem; max-height: min(88vh, 44rem);
  display: flex; flex-direction: column;
  background: var(--thc-pwa-canvas); color: var(--thc-pwa-text);
  border: 1px solid var(--thc-pwa-border); border-bottom: 0;
  border-radius: 1rem 1rem 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,.25);
  font-family: var(--thc-pwa-font);
}
@media (min-width: 720px) {
  .thc-pwa-overlay { align-items: center; padding: 1.5rem; }
  .thc-pwa-panel { border-radius: 1rem; border-bottom: 1px solid var(--thc-pwa-border); }
}
.thc-pwa-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem 0.5rem;
}
.thc-pwa-panel__head h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; font-family: inherit; }
.thc-pwa-panel__close {
  appearance: none; background: none; border: 0; cursor: pointer; color: inherit;
  font-size: 1.75rem; line-height: 1; padding: 0.25rem 0.5rem; opacity: .75;
}
.thc-pwa-panel__close:hover { opacity: 1; }
.thc-pwa-panel__lead { margin: 0; padding: 0 1.25rem 0.75rem; font-size: 0.9375rem; line-height: 1.5; color: var(--thc-pwa-text); }
.thc-pwa-panel__body { overflow: auto; padding: 0 1.25rem 0.5rem; }
.thc-pwa-panel__foot { padding: 0.5rem 1.25rem 1rem; font-size: 0.8125rem; color: var(--thc-pwa-text); opacity: .8; border-top: 1px solid var(--thc-pwa-border); }

.thc-pwa-course { margin: 0.75rem 0 0.25rem; font-size: 1rem; font-family: inherit; }
.thc-pwa-course a { color: var(--thc-pwa-deep); }
.thc-pwa-row {
  display: grid; grid-template-columns: 1fr; gap: 0.25rem 1rem;
  padding: 0.75rem 0; border-top: 1px solid var(--thc-pwa-border);
}
.thc-pwa-row--all { border-top: 1px dashed var(--thc-pwa-border); justify-items: start; }
.thc-pwa-row__title { font-weight: 600; font-size: 0.9375rem; }
.thc-pwa-row__meta { font-size: 0.8125rem; opacity: .8; }
.thc-pwa-row__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.thc-pwa-status { font-size: 0.8125rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--thc-pwa-muted); }
.thc-pwa-status--ok { background: var(--thc-pwa-sage); color: var(--thc-pwa-text); }
.thc-pwa-btn {
  appearance: none; cursor: pointer; border-radius: 999px;
  padding: 0.4rem 0.9rem; font: 600 0.875rem/1.2 var(--thc-pwa-font);
  background: var(--thc-pwa-deep); color: #fff; border: 1px solid var(--thc-pwa-deep);
}
.thc-pwa-btn:hover { background: var(--thc-pwa-leaf); border-color: var(--thc-pwa-leaf); }
.thc-pwa-btn--ghost { background: transparent; color: var(--thc-pwa-deep); }
.thc-pwa-btn--ghost:hover { background: var(--thc-pwa-muted); color: var(--thc-pwa-deep); }
.thc-pwa-muted { font-size: 0.9375rem; opacity: .85; margin: 0.75rem 0; }
.thc-pwa-flash { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--thc-pwa-deep); background: var(--thc-pwa-muted); padding: 0.4rem 0.6rem; border-radius: 0.5rem; }

@media (prefers-reduced-motion: no-preference) {
  .thc-pwa-panel { animation: thc-pwa-rise .18s ease-out; }
  @keyframes thc-pwa-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media print { .thc-pwa-banner, .thc-pwa-barbtn, .thc-pwa-header-icon, .thc-pwa-overlay { display: none !important; } }


/* ---- header phone icon (after the person icon; in the hamburger menu on phones) ---- */
.thc-pwa-header-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none; border-radius: 999px; color: inherit; text-decoration: none;
}
.thc-pwa-header-icon:hover, .thc-pwa-header-icon:focus-visible, .thc-pwa-header-icon[aria-current="page"] { background: var(--thc-pwa-muted); }
.thc-pwa-header-icon .thc-pwa-icon { width: 22px; height: 22px; }
.wp-block-navigation .wp-block-navigation-item.thc-pwa-nav-item { display: none; }
@media not all and (min-width: 600px) {
  .thc-site-header .thc-pwa-header-icon { display: none; }
  .wp-block-navigation .wp-block-navigation-item.thc-pwa-nav-item { display: block; }
}

/* ---- offline button in the course pages' bars (lesson breadcrumb, dashboard menu) ---- */
.thc-pwa-barbtn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 999px; background: transparent;
  color: inherit; cursor: pointer; line-height: 0;
}
.thc-pwa-barbtn svg { width: 22px; height: 22px; }
.thc-pwa-barbtn:hover, .thc-pwa-barbtn:focus-visible, .thc-pwa-barbtn[aria-expanded="true"] { background: rgba(127,127,127,.15); }
/* THC 2026-10-25 (1.4.15): THC Courses' lesson breadcrumb and dashboard menu (1.4.16: Tutor's bar rules removed) */
.thc-lesson__crumbs:has(> .thc-pwa-barbtn) { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .375rem; }
.thc-lesson__crumbs > .thc-pwa-barbtn, .thc-dash__nav > .thc-pwa-barbtn { width: 44px; height: 44px; margin-inline-start: auto; color: inherit; }
.thc-dash__nav:has(> .thc-pwa-barbtn) { display: flex; align-items: flex-start; gap: .5rem; }
.thc-dash__nav:has(> .thc-pwa-barbtn) > ul { flex: 1; }

/* ---- the /app/ page ([thc_app]) ---- */
.thc-app .thc-app__card--wide { grid-column: 1 / -1; }
.thc-app__status { margin: 0.75rem 0 1rem; padding: 0.85rem 1rem; border-radius: 10px; background: var(--thc-pwa-muted); }
.thc-app__status-line { margin: 0; font-weight: 600; }
.thc-app__status .thc-actions { margin-top: 0.6rem; }
.thc-app__status [hidden] { display: none; }
/* 1.3.1: store buttons (outline, so the browser's own Install button stays the filled one). One colour visited or not. */
.thc-app__status .thc-actions { gap: 0.5rem 0.75rem; }
.thc-app .thc-app__store, .thc-app .thc-app__store:visited { color: var(--thc-leaf-deep, var(--thc-pwa-deep)); border-color: var(--thc-leaf-deep, var(--thc-pwa-deep)); text-decoration: none; }
.thc-app .thc-app__store:is(:hover, :focus-visible) { color: var(--thc-leaf-deep, var(--thc-pwa-deep)); text-decoration: underline; }
.thc-app__platforms { display: grid; gap: 0.35rem; }
.thc-app__platform { border: 1px solid var(--thc-pwa-border); border-radius: 10px; background: var(--thc-pwa-raised); padding: 0 0.9rem; }
.thc-app__platform[open] { padding-bottom: 0.5rem; }
.thc-app__platform > summary { cursor: pointer; padding: 0.7rem 0; font-weight: 600; display: flex; align-items: center; gap: 0.6rem; }
.thc-app__platform > summary::marker, .thc-app__platform > summary::-webkit-details-marker { color: var(--thc-pwa-deep); }
.thc-app__yours { font-size: 0.75rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--thc-pwa-deep); color: #fff; }
.thc-app__yours[hidden] { display: none; }
.thc-app__steps { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.thc-app__list { margin: 0; padding-left: 1.2rem; }
.thc-app__list li { margin: 0 0 0.6rem; }
.thc-app__steps li { margin: 0.25rem 0; }
.thc-app__offline .thc-pwa-course { margin-top: 1rem; }
.thc-app__course { border-top: 1px solid var(--thc-pwa-border); padding: 0.4rem 0; }
.thc-app__course > summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }
.thc-app__course-body { padding-bottom: 0.5rem; }
.thc-app .thc-pwa-row:first-child { border-top: 0; }
.thc-app--installed .thc-app__platforms { opacity: .85; }
