/* Scurlock home page. The shell follows the pattern of a launcher portal (top bar, sidebar,
   tiles, status); the colours are the kids' study pages' own, written here so this folder
   stands alone. Status is never colour alone: each state has a shape and a word. */

:root {
  --primary: #26263F; --primary-tint: #EEEFF9; --accent: #4651D2; --accent-tint: #ECEDFC;
  --ink: #20212C; --muted: #5A5B6B; --page: #FFFFFF; --surface: #F6F6FA; --rule: #DFDFE8; --rule-strong: #B9BAC8;
  --on-primary: #FFFFFF; --ok: #1E6B3A;
  --banner: #26263F; --on-banner: #FFFFFF; --banner-muted: #B9BAC8; --banner-accent: #949EF6;
  --top-h: 56px; --side-w: 248px; --radius: 8px;
  --shadow: 0 8px 24px rgba(38, 38, 63, .10);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #C2C5F4; --primary-tint: #22243B; --accent: #949EF6; --accent-tint: #262947;
    --ink: #EAEAF1; --muted: #A3A4B4; --page: #121219; --surface: #1B1C26; --rule: #2D2E3D; --rule-strong: #4A4B5E;
    --on-primary: #121219; --ok: #8FD9A8; --banner: #0B0B11; --banner-muted: #8E8FA3;
    --shadow: 0 8px 24px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #C2C5F4; --primary-tint: #22243B; --accent: #949EF6; --accent-tint: #262947;
  --ink: #EAEAF1; --muted: #A3A4B4; --page: #121219; --surface: #1B1C26; --rule: #2D2E3D; --rule-strong: #4A4B5E;
  --on-primary: #121219; --ok: #8FD9A8; --banner: #0B0B11; --banner-muted: #8E8FA3;
  --shadow: 0 8px 24px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body.pt { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.55 Arial, Helvetica, 'Helvetica Neue', sans-serif;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--page); color: var(--primary); padding: 10px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 8px; }

/* ---- top bar ---- */
.pt-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: var(--top-h);
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: var(--banner); color: var(--on-banner); border-bottom: 2px solid var(--banner-accent); }
.pt-top :focus-visible { outline-color: var(--banner-accent); }
.pt-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--on-banner); padding: 8px 0; min-height: 44px; }
.pt-brand-name { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
.pt-brand-sep { width: 1px; height: 20px; background: var(--banner-accent); }
.pt-brand-sub { font-size: 15px; color: var(--banner-muted); }
.pt-top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.pt-date { font-size: 14px; color: var(--banner-muted); white-space: nowrap; }
.pt-iconbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 12px;
  font: inherit; font-size: 15px; color: var(--on-banner); background: transparent; border: 1px solid var(--banner-muted); border-radius: 999px; cursor: pointer; }
.pt-iconbtn:hover { border-color: var(--on-banner); }
.pt-iconbtn svg { width: 16px; height: 16px; display: block; }
.pt-theme .i-sun { display: none; }
.pt-theme.is-dark .i-sun { display: block; }
.pt-theme.is-dark .i-moon { display: none; }
.pt-menu { display: none; }
html:not(.js) .pt-theme { display: none; }

/* ---- shell ---- */
.pt-shell { flex: 1; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.pt-side { background: var(--surface); border-right: 1px solid var(--rule); padding: 20px 12px 32px; }
.pt-side-inner { position: sticky; top: calc(var(--top-h) + 20px); }
.pt-side-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 12px 8px; }
.pt-side-sub { font-size: 12px; color: var(--muted); margin: 12px 12px 4px; }
.pt-side-group + .pt-side-group { margin-top: 20px; }
.pt-side ul { list-style: none; margin: 0; padding: 0; }
.pt-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.3; }
.pt-link:hover { background: var(--page); }
.pt-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.pt-link[aria-current="page"] { background: var(--accent-tint); color: var(--primary); font-weight: 700; }
.pt-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.pt-link[aria-current="page"] svg { color: var(--accent); }
.pt-link .pt-status { margin-left: auto; }
.pt-side .pt-status .pt-status-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pt-main { min-width: 0; }

/* ---- status: shape plus word ---- */
.pt-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.pt-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1.5px solid var(--rule-strong); background: transparent; position: relative; }
.pt-status[data-state="up"] { color: var(--ok); }
.pt-status[data-state="up"] .pt-dot { background: var(--ok); border-color: var(--ok); }
.pt-status[data-state="down"] { color: var(--ink); }
.pt-status[data-state="down"] .pt-dot { border: 0; border-radius: 1px; }
.pt-status[data-state="down"] .pt-dot::before, .pt-status[data-state="down"] .pt-dot::after {
  content: ""; position: absolute; left: 50%; top: -1px; width: 2px; height: 12px; margin-left: -1px; background: var(--ink); }
.pt-status[data-state="down"] .pt-dot::before { transform: rotate(45deg); }
.pt-status[data-state="down"] .pt-dot::after { transform: rotate(-45deg); }
@media (prefers-reduced-motion: no-preference) { .pt-status[data-state="checking"] .pt-dot { animation: pt-pulse 1.2s ease-in-out infinite; } }
@keyframes pt-pulse { 50% { opacity: .3; } }

/* ---- home view ---- */
.pt-page { max-width: 1180px; padding: 40px 32px 56px; }
.pt-head { margin-bottom: 24px; }
.pt-h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.15; color: var(--primary); margin: 0 0 8px; padding-bottom: 12px; border-bottom: 3px solid var(--accent); }
.pt-sub { font-size: 17px; color: var(--muted); margin: 0; max-width: 40em; }
.pt-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 20px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 32px; }
.pt-summary-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.pt-summary-n { font-size: 17px; font-weight: 700; color: var(--primary); margin: 0; }
.pt-summary-when { font-size: 14px; color: var(--muted); margin: 0; }
.pt-summary .pt-btn { margin-left: auto; }
.pt-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 700; color: var(--primary); background: var(--page);
  border: 1px solid var(--rule-strong); border-radius: 999px; min-height: 44px; padding: 0 18px; cursor: pointer; }
.pt-btn:hover { border-color: var(--primary); }
.pt-btn svg { width: 14px; height: 14px; }
@media (prefers-reduced-motion: no-preference) { .pt-btn[aria-busy="true"] svg { animation: pt-spin 1s linear infinite; } }
@keyframes pt-spin { to { transform: rotate(360deg); } }

.pt-sec { margin-bottom: 40px; }
.pt-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 16px; }
.pt-h2 { font-size: 21px; color: var(--primary); margin: 0; }
.pt-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 24px 0 12px; }
.pt-sec-note { font-size: 14px; color: var(--muted); margin: 0; }
.pt-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pt-app { position: relative; display: flex; gap: 16px; align-items: flex-start; padding: 20px; background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius); }
.pt-app:hover, .pt-app:focus-within { border-color: var(--rule-strong); box-shadow: var(--shadow); }
.pt-app:focus-within { border-color: var(--accent); }
.pt-app-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius); background: var(--accent-tint); color: var(--accent); }
.pt-app-icon svg { width: 22px; height: 22px; display: block; }
.pt-app-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pt-app-name { font-size: 18px; line-height: 1.3; color: var(--primary); margin: 0; }
.pt-app-name a { color: inherit; text-decoration: none; }
.pt-app-name a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.pt-app-name a:focus-visible { outline: none; }
.pt-app-name a:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 3px; }
.pt-app-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pt-count { margin: 0; }
.pt-count-big { font-weight: 700; color: var(--accent); }
.pt-count-small { color: var(--ink); }
.pt-app-desc { font-size: 15px; line-height: 1.45; margin: 0; }
.pt-app-hint { font-size: 14px; color: var(--muted); margin: 0; }
.pt-app-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 4px 0 0; }
.pt-host { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.pt-foot { border-top: 1px solid var(--rule); background: var(--surface); color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 8px 20px; padding: 16px max(20px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.pt-foot p { margin: 0; max-width: 60ch; }

/* ---- narrow screens: the sidebar becomes a menu under the top bar ---- */
@media (max-width: 959px) {
  .pt-shell { grid-template-columns: minmax(0, 1fr); }
  .js .pt-menu { display: inline-flex; }
  .pt-side { border-right: 0; border-bottom: 1px solid var(--rule); padding: 12px; }
  .js .pt-side { display: none; }
  .js body.menu-open .pt-side { display: block; }
  .pt-side-inner { position: static; }
  .pt-side-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .pt-side-group:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .pt-top { gap: 10px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .pt-date { display: none; }
  .pt-page { padding: 24px 16px 40px; }
  .pt-summary .pt-btn { margin-left: 0; }
  .pt-side-nav { grid-template-columns: 1fr; }
  .pt-app { padding: 16px; gap: 12px; }
}
@media (max-width: 400px) { .pt-brand-sep, .pt-brand-sub { display: none; } }
@media print { .pt-top, .pt-side, .pt-foot { display: none; } .pt-shell { display: block; } }
