/* ==========================================================================
   Screen sizes
     Phone      < 600px    sidebar is a slide-in drawer, compact top bar
     Tablet     600–899px  sidebar is a slide-in drawer
     Laptop     900px+     full-height sidebar on the left (logo at its top),
                           top bar + tutorial on the right
     Large      1400px+    wider sidebar and bigger logo
   ========================================================================== */

:root {
  --accent: #103799;
  --accent-dark: #0B2566;
  --green: #009972;
  --ink: #1A2233;
  --text: #4A5868;
  --muted: #6B7A8C;
  --line: #DDE4EC;
  --tint: #F4F8FD;
  --tint-strong: #E6EEF9;
  --white: #FFFFFF;

  --gutter: 16px;            /* side padding on phones/tablets */
  --content-pad: 16px;       /* left/right padding of the top bar, tutorial and footer */
  --menu-width: 288px;
  --top-h: 60px;             /* top bar height = sidebar logo area height on laptops */
  --radius: 12px;
}
@media (min-width: 600px)  { :root { --gutter: 24px; --content-pad: 24px; --top-h: 68px; --radius: 16px; } }
@media (min-width: 900px)  { :root { --content-pad: clamp(32px, 4vw, 56px); --top-h: 88px; } }
@media (min-width: 1400px) { :root { --menu-width: 320px; --top-h: 96px; } }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; height: 100%; }
/* App-style page: exactly one window tall, never scrolls. If a window is too small,
   only the tutorial area scrolls; the header always stays put. */
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--white);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
img, svg, iframe { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
main:focus { outline: none; }

.skip { position: absolute; left: 16px; top: -100px; background: var(--accent); color: var(--white);
  padding: 10px 16px; border-radius: 8px; text-decoration: none; z-index: 60; }
.skip:focus { top: 16px; color: var(--white); }

.logo { display: block; aspect-ratio: 217 / 49; height: auto; }

.menu-btn, .drawer-close {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); cursor: pointer;
}
.menu-btn:hover, .drawer-close:hover { background: var(--tint-strong); color: var(--accent); }

/* ---------- Page layout ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .app { grid-template-columns: var(--menu-width) minmax(0, 1fr); } }
.main-col { min-width: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar { display: flex; flex-direction: column; background: var(--tint); }

/* Logo area — on laptops it is exactly as tall as the top bar so the lines meet */
.sidebar-brand { flex: none; display: flex; align-items: center; gap: 8px;
  height: var(--top-h); padding: 0 8px 0 20px;
  background: var(--white); border-bottom: 1px solid var(--line); }
.sidebar-brand .logo { width: 100%; max-width: 200px; min-width: 0; }
.drawer-close { margin-left: auto; }

.sidebar-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 12px 16px; }
.menu-label { padding: 0 12px; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted); }

/* Each section is separated by a line */
.menu-group { padding-top: 12px; }
.menu-group + .menu-group { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.menu-group h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px; margin-bottom: 8px; font-size: 0.9375rem; font-weight: 700; }
.menu-group .count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--white); border: 1px solid var(--line); color: var(--muted);
  font-size: 0.6875rem; font-weight: 600; line-height: 1; }

.menu-group ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.menu-group a.item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 44px; padding: 9px 12px; border-radius: 10px; text-decoration: none;
  color: var(--ink); font-size: 0.9375rem; line-height: 1.35;
  transition: background-color 0.15s ease, color 0.15s ease; }
.menu-group a.item .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--white); border: 1px solid var(--line); color: var(--accent);
  font-size: 0.75rem; font-weight: 700; line-height: 1; }
.menu-group a.item .d { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.menu-group a.item:hover { background: var(--tint-strong); color: var(--accent); }

.menu-group a.item[aria-current="true"] { background: var(--accent); color: var(--white);
  box-shadow: 0 4px 12px rgba(16, 55, 153, 0.22); }
.menu-group a.item[aria-current="true"] .n { background: rgba(255, 255, 255, 0.18); border-color: transparent; color: var(--white); }
.menu-group a.item[aria-current="true"] .d { color: rgba(255, 255, 255, 0.85); }

.menu-group a.soon { color: var(--muted); font-size: 0.875rem; }
.menu-group a.soon .n { color: var(--muted); }
.menu-group .tag { padding: 2px 8px; border-radius: 999px; background: var(--tint-strong); color: var(--accent);
  font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.menu-group a.item[aria-current="true"] .tag { background: rgba(255, 255, 255, 0.2); color: var(--white); }

/* Help box pinned to the bottom of the sidebar */
.sidebar-copy { flex: none; padding: 0 28px 16px; font-size: 0.75rem; color: var(--muted); }
.sidebar-help { flex: none; margin: 0 12px 12px; padding: 14px 16px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--line); font-size: 0.8125rem; line-height: 1.5; }
.sidebar-help .help-title { color: var(--ink); font-weight: 700; font-size: 0.875rem; }
.sidebar-help a { word-break: break-all; }

/* Phones & tablets: sidebar slides in from the left */
@media (max-width: 899px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    width: min(320px, 86vw);
    box-shadow: 8px 0 32px rgba(16, 34, 80, 0.18);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  body.menu-open .sidebar { transform: none; visibility: visible; transition: transform 0.25s ease; }
  .sidebar-brand { height: 64px; }

  .scrim {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(10, 20, 45, 0.45);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  }
  body.menu-open .scrim { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
}

/* Laptop & up: full-height sidebar; logo fills the sidebar width */
@media (min-width: 900px) {
  .sidebar { height: 100vh; height: 100dvh; border-right: 1px solid var(--line); }
  .sidebar-brand { padding: 0 24px; }
  .sidebar-brand .logo { max-width: none; }
  .drawer-close, .scrim { display: none; }
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */
.topbar { flex: none; display: flex; align-items: center; gap: 12px;
  min-height: var(--top-h); padding: 8px var(--content-pad);
  background: var(--white); border-bottom: 1px solid var(--line); }
.menu-btn { margin-left: -10px; } /* line the icon up with the page edge */
.topbar-logo { height: 24px; width: auto; flex: none; }
.topbar-divider { width: 1px; height: 24px; background: var(--line); flex: none; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.topbar-title p { display: none; margin-top: 2px; font-size: 0.875rem; color: var(--muted); }

/* On phones the logo already says HolisticCare, so the heading shows just "Tutorials"
   (the full name is still read out by screen readers) */
@media (max-width: 599px) {
  .brand-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 600px) {
  .topbar { gap: 16px; }
  .topbar-logo { height: 30px; }
  .topbar-divider { height: 32px; }
  .topbar-title h1 { font-size: 1.125rem; }
}
@media (min-width: 760px) { .topbar-title p { display: block; } }

/* Laptop & up: logo lives in the sidebar, so the top bar is just the page title */
@media (min-width: 900px) {
  .menu-btn, .topbar-logo, .topbar-divider { display: none; }
  .topbar { padding-block: 0; }
  .topbar-title { padding-left: 16px; border-left: 3px solid var(--green); }
  .topbar-title h1 { font-size: 1.375rem; }
}

/* ==========================================================================
   TUTORIAL
   ========================================================================== */
/* Tutorial area fills the space under the header; scrolls only if the window is tiny */
.frame { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; padding: 16px var(--content-pad) 20px; }
@media (min-width: 600px) { .frame { padding-block: 24px; } }
@media (min-width: 900px) { .frame { padding-block: 28px 32px; } }
.panel { flex: 1; min-height: 0; width: 100%; max-width: 1200px; display: flex; flex-direction: column; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.8125rem; }
@media (min-width: 600px) { .meta { font-size: 0.875rem; } }
.meta .sec { color: var(--muted); }
.meta .num { font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.meta .dur { background: var(--tint-strong); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-weight: 500; }
.meta .dur:empty { display: none; } /* no duration known */
.panel h3 { font-size: clamp(1.25rem, 1rem + 1.4vw, 2rem); margin-top: 8px; letter-spacing: -0.01em; }
.panel p { margin-top: 8px; max-width: 65ch; }

/* Video: takes all the space left under the title and stays 16:9 —
   as big as fits both the width and the height of the window.
   Edge to edge on phones. */
.video-wrap { flex: 1; min-height: 160px; margin-top: 16px; container-type: size; }
@media (min-width: 600px) { .video-wrap { margin-top: 20px; } }
@media (max-width: 599px) { .video-wrap { margin-inline: calc(-1 * var(--content-pad)); } }
.video { position: relative; aspect-ratio: 16 / 9;
  width: min(100cqw, 100cqh * 16 / 9);
  background: var(--ink); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 6px 24px rgba(16, 55, 153, 0.08); }
@media (max-width: 599px) { .video { border-radius: 0; box-shadow: none; } }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.coming-soon { margin-top: 20px; padding: 40px 20px; text-align: center; background: var(--tint);
  border: 1px dashed #B9C7D8; border-radius: var(--radius); }
@media (min-width: 600px) { .coming-soon { padding: 64px 32px; } }
.coming-soon h3 { margin-top: 0; font-size: 1.25rem; }
.coming-soon p { margin: 8px auto 0; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 12px var(--content-pad); border-top: 1px solid var(--line);
  background: var(--tint); font-size: 0.875rem; color: var(--muted); }
@media (min-width: 600px) {
  .site-footer { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
}
/* Laptop & up: help and copyright are in the sidebar, so no footer is needed */
@media (min-width: 900px) {
  .site-footer { display: none; }
}

/* Very short windows (landscape phones): drop the extras so the video gets the room */
@media (max-height: 520px) {
  .site-footer, .panel > p, .topbar-title p { display: none; }
  .frame { padding-block: 12px; }
  .video-wrap { margin-top: 12px; min-height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
