/* =========================================================================
   Layouts: site header/footer, learner app shell, auth split screen, grids
   ========================================================================= */

/* ---- Header -------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent; transition: border-color var(--t), background var(--t); }
.site-header.is-scrolled { border-bottom-color: var(--border); background: color-mix(in oklab, var(--bg) 92%, transparent); }
.site-header .container { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.03em; text-decoration: none !important; flex: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--brand) 0%, color-mix(in oklab, var(--brand) 55%, var(--accent)) 100%); box-shadow: var(--shadow-brand); }
.brand-mark .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.brand-logo { height: 40px; width: auto; max-width: 180px; object-fit: contain; border-radius: 6px; }
/* Default logo is black on an opaque white PNG: multiply drops the white on light surfaces... */
.brand-logo-default { height: 43px; border-radius: 0; mix-blend-mode: multiply; }
/* ...and on dark surfaces invert it to white and let the (now black) background drop out. */
.learn-top .brand-logo-default,
.site-footer .brand-logo-default,
.auth-aside .brand-logo-default,
:root[data-theme="dark"] .brand-logo-default { filter: invert(1); mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo-default { filter: invert(1); mix-blend-mode: screen; } }
/* Tenant logos keep their colors; on dark bars they sit on a white chip. */
.learn-top .brand-logo:not(.brand-logo-default),
.site-footer .brand-logo:not(.brand-logo-default),
.auth-aside .brand-logo:not(.brand-logo-default) { background: #fff; padding: 3px 6px; }
.learn-top .brand-logo { height: 34px; }
.brand small { display: block; font-family: var(--font-sans); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin-top: -2px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.header-search { flex: 1; max-width: 360px; margin-left: auto; }
.header-search .input { height: 40px; border-radius: var(--r-full); background: var(--surface); font-size: var(--fs-sm); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-search + .header-actions { margin-left: 0; }
.menu-toggle { display: none; }
@media (max-width: 1100px) { .header-search { display: none; } .header-actions { margin-left: auto; } }
@media (max-width: 960px) {
  .nav, .header-search, .header-actions .hide-mobile { display: none; }
  .menu-toggle { display: inline-grid; }
}

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 80; display: none; }
.drawer.is-open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgb(5 10 22 / 0.5); backdrop-filter: blur(2px); animation: fade 200ms both; }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 88vw); background: var(--bg-elevated); box-shadow: var(--shadow-lg); padding: 18px; display: flex; flex-direction: column; gap: 6px; animation: slide-in 240ms var(--ease) both; overflow-y: auto; }
.drawer-panel .menu-item { font-size: var(--fs-base); padding: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { margin-top: var(--s-24); background: var(--ink-brand); color: rgb(255 255 255 / 0.72); padding: var(--s-16) 0 var(--s-8); }
.site-footer .brand { color: #fff; }
.site-footer h4 { color: #fff; font-size: var(--fs-sm); letter-spacing: 0.02em; margin-bottom: 14px; }
.site-footer a { color: rgb(255 255 255 / 0.72); font-size: var(--fs-sm); }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 36px; }
.footer-grid ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.footer-bottom { margin-top: var(--s-12); padding-top: var(--s-6); border-top: 1px solid rgb(255 255 255 / 0.12); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; font-size: var(--fs-xs); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ---- Sections & grids ------------------------------------------------- */
.section { padding-block: clamp(36px, 5.5vw, 72px); }
.section-tight { padding-block: clamp(24px, 3.5vw, 44px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: clamp(18px, 2.6vw, 28px); flex-wrap: wrap; }
.section-head p { max-width: 560px; color: var(--text-2); margin-top: 10px; font-size: var(--fs-md); }
.grid { display: grid; gap: var(--gap, 24px); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Learner app shell ------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100dvh - var(--header-h)); }
.app-sidebar { position: sticky; top: var(--header-h); height: calc(100dvh - var(--header-h)); padding: 20px 14px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); }
.side-link .soon { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--text-3); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.side-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; padding: 14px 12px 6px; }
.app-main { padding: clamp(18px, 3vw, 36px); min-width: 0; }
.bottom-nav { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { display: none; }
  .app-main { padding-bottom: 96px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 66px; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in oklab, var(--bg-elevated) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
  .bottom-nav a { display: grid; place-items: center; align-content: center; gap: 3px; font-size: 11px; font-weight: 650; color: var(--text-3); }
  .bottom-nav a[aria-current="page"] { color: var(--brand-700); }
  .bottom-nav a:hover { text-decoration: none; }
}

/* ---- Auth split screen ------------------------------------------------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside { position: relative; overflow: hidden; color: #fff; padding: clamp(24px, 3vw, 44px); display: flex; flex-direction: column; justify-content: flex-start; gap: clamp(28px, 6vh, 56px);
  background: radial-gradient(90% 70% at 10% 0%, color-mix(in oklab, var(--brand) 85%, #fff) 0%, transparent 55%), radial-gradient(70% 60% at 100% 100%, color-mix(in oklab, var(--accent) 70%, transparent) 0%, transparent 60%), linear-gradient(160deg, var(--brand-800), var(--ink-brand)); }
.auth-aside .brand, .auth-aside h2 { color: #fff; }
.auth-aside .grid-lines { position: absolute; inset: 0; opacity: 0.12; background-image: linear-gradient(rgb(255 255 255 / 0.6) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.6) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(80% 60% at 30% 30%, #000, transparent); pointer-events: none; }
.auth-aside > * { position: relative; }
.auth-point { display: flex; gap: 14px; align-items: flex-start; }
.auth-point .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.18); flex: none; }
.auth-point p { color: rgb(255 255 255 / 0.75); font-size: var(--fs-sm); }
.auth-main { display: grid; place-items: start center; padding: clamp(20px, 6vh, 64px) clamp(16px, 4vw, 48px) 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }
@media (min-width: 901px) { .hidden-desktop { visibility: hidden; } }

.auth-aside > p:last-child { margin-top: auto; }  /* footer note sits at the bottom, content stays near the top */

/* Logo + name (wordmark) and round badge logos */
.brand-logo.is-round { width: 44px; height: 44px; border-radius: 50%; padding: 0 !important; background: transparent !important;
  box-shadow: 0 0 0 1px var(--border), 0 4px 12px -6px rgb(0 0 0 / 0.35); }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-size: 1.08rem; font-weight: 800; color: inherit; white-space: nowrap; }
.brand-sub { font-family: var(--font-body, inherit); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.auth-aside .brand-sub, .site-footer .brand-sub { color: rgb(255 255 255 / 0.65); }
@media (max-width: 420px) { .brand-sub { display: none; } .brand-name { font-size: 0.98rem; } }

.footer-bottom a { font-size: inherit; color: rgb(255 255 255 / 0.85); text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.3); text-underline-offset: 3px; }
.auth-aside .copyright-company { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Sidebar with many links: scrolls on its own (page keeps its scroll), slim scrollbar, links never squash */
.app-sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; padding-bottom: 28px; }
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
.app-sidebar > * { flex-shrink: 0; }
.app-sidebar .side-link { padding: 8px 12px; }
@media (max-height: 760px) { .app-sidebar { padding-top: 12px; gap: 2px; } .app-sidebar .side-link { padding: 6px 12px; } }
.footer-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-bottom .footer-legal a { text-decoration: none; }
.footer-bottom .footer-legal a:hover { text-decoration: underline; }
@media (max-width: 1100px) and (min-width: 861px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } .footer-grid > :first-child { grid-column: 1 / -1; } }
