/* ==========================================================================
   USDM Play — public content pages (Learn / Blogs / About)
   Light theme matched to the USDM Play app: white chrome, slate text,
   purple→blue gradient accents. Fonts: Inter (body/display), JetBrains Mono.
   ========================================================================== */

:root{
  --heading:#0f172a;
  --text:#334155;
  --muted:#64748b;
  --line:#e2e8f0;
  --bg:#f8fafc;
  --card:#ffffff;
  --link:#2563eb;
  --link-hover:#1d4ed8;
  --purple:#7c3aed;
  --indigo:#4f46e5;
  --brand:#008cff;
  --grad:linear-gradient(90deg,#7c3aed 0%,#2563eb 100%);
  --radius:14px;
  --maxw:1180px;      /* readable article/content width */
  --nav-maxw:1400px;  /* header + footer width — matches the React login/app */
  --code-bg:#0f172a;
}

*{box-sizing:border-box;}
/* stable gutter stops the brand logo shifting between pages that scroll and
   pages that don't (matches the fixed-width React header/footer) */
html{scroll-behavior:smooth;scrollbar-gutter:stable;}
body{
  margin:0;
  background:
    radial-gradient(1200px 500px at 85% -100px, rgba(124,58,237,.06), transparent 60%),
    radial-gradient(1000px 500px at 0% 0%, rgba(37,99,235,.05), transparent 55%),
    var(--bg);
  color:var(--text);
  font-family:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  line-height:1.65;
  font-size:17px;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{
  font-family:'Inter',system-ui,sans-serif;
  color:var(--heading);
  line-height:1.2;
  font-weight:800;
  letter-spacing:-0.02em;
}
h1{font-size:2.4rem;margin:0 0 .5rem;}
h2{font-size:1.6rem;margin:2.6rem 0 1rem;padding-top:.4rem;border-top:1px solid var(--line);}
h2:first-of-type{border-top:none;padding-top:0;}
h3{font-size:1.18rem;margin:1.8rem 0 .7rem;font-weight:700;color:#1e293b;}
p{margin:0 0 1.1rem;}
a{color:var(--link);text-decoration:none;}
a:hover{color:var(--link-hover);text-decoration:underline;}
code, pre, .mono{font-family:'JetBrains Mono',monospace;}
ul,ol{margin:0 0 1.2rem;padding-left:1.4rem;}
li{margin-bottom:.4rem;}
strong{color:var(--heading);}

.skip-link{position:absolute;left:-999px;top:0;background:var(--indigo);color:#fff;padding:.5rem 1rem;z-index:100;border-radius:0 0 8px 0;}
.skip-link:focus{left:0;}

/* Smooth cross-document navigation between the static pages and the React
   app/login, with a header/footer that stay put and an underline that slides
   between menu items — mirroring the post-login SPA nav. No-op where the View
   Transitions API is unsupported (navigation is just instant, as before). */
@view-transition{navigation:auto;}
/* Header, footer and the active underline are their own transition groups
   (named below), so they stay put / slide; everything else ("root" = the
   content) gets this gentle cross-fade + lift on both soft-nav and full nav. */
::view-transition-old(root){animation:vt-out .16s ease both;}
::view-transition-new(root){animation:vt-in .30s cubic-bezier(.4,0,.2,1) both;}
@keyframes vt-out{to{opacity:0;}}
@keyframes vt-in{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:none;}}
@media (prefers-reduced-motion: reduce){
  ::view-transition-old(root),::view-transition-new(root){animation:none;}
}

/* ---------- header (must match the React login/app menubar exactly) ---------- */
.pg-header{
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(8px);
  position:sticky;top:0;z-index:50;
  border-bottom:1px solid var(--line);
  view-transition-name:site-header;   /* held stable across page loads */
}
.pg-nav{
  max-width:var(--nav-maxw);margin:0 auto;padding:.5rem 2rem;
  display:flex;align-items:center;gap:1.5rem;flex-wrap:wrap;
}
/* Brand: the actual logo.png lockup (mark + wordmark artwork), same as the
   React app's BrandLockup — never rebuilt as HTML text, so it renders
   identically on every page. */
.pg-brand{display:flex;align-items:center;}
.pg-brand img{display:block;height:40px;width:auto;}
.pg-footer .pg-brand img{height:36px;}
.pg-menu{position:relative;display:flex;align-items:center;gap:.25rem;flex-wrap:wrap;}
.pg-menu a{
  position:relative;
  display:inline-flex;align-items:center;gap:.3rem;
  padding:.5rem .75rem;border-radius:8px;
  font-size:.875rem;font-weight:600;color:#475569;
  transition:color .15s ease;
}
.pg-menu a:hover{color:#0f172a;text-decoration:none;}
.pg-menu a.active{color:var(--link);}

/* underline sits under the current page's item; because only the active item
   carries it, the shared view-transition-name makes it slide from the old
   item to the new one on navigation (same feel as the SPA's animated bar) */
.pg-menu a.active::after{
  content:"";position:absolute;left:.75rem;right:.75rem;bottom:-.4rem;
  height:3px;border-radius:99px;background:var(--grad);
  view-transition-name:nav-underline;
}
/* auth shortcuts into the app, register-header style:
   "Already registered? Log in →" | "Register"; Help always sits after them */
.pg-auth{margin-left:auto;display:inline-flex;align-items:center;gap:.1rem;}
.pg-signin{
  display:inline-flex;align-items:center;gap:.5rem;
  padding:.5rem .6rem;border-radius:8px;
  font-size:.875rem;white-space:nowrap;transition:background .15s ease;
}
.pg-signin:hover{background:#f8fafc;text-decoration:none;}
.pg-auth-q{color:#475569;}
.pg-auth-link{display:inline-flex;align-items:center;gap:.35rem;font-weight:600;color:var(--link);}
.pg-signin:hover .pg-auth-link{color:var(--link-hover);}
.pg-auth-link svg{width:16px;height:16px;}
.pg-auth-sep{width:1px;height:1.05rem;background:#cbd5e1;margin:0 .2rem;flex:0 0 auto;}
.pg-register{
  display:inline-flex;align-items:center;padding:.5rem .6rem;border-radius:8px;
  font-size:.875rem;font-weight:600;color:var(--link);transition:background .15s ease;
}
.pg-register:hover{background:#f8fafc;color:var(--link-hover);text-decoration:none;}
.pg-help{
  display:inline-flex;align-items:center;gap:.45rem;
  padding:.5rem .75rem;border-radius:8px;font-size:.875rem;font-weight:600;color:#475569;
}
.pg-help svg{width:18px;height:18px;}
.pg-help:hover{color:var(--heading);background:#f1f5f9;text-decoration:none;}

/* ---------- breadcrumb ---------- */
.breadcrumb{max-width:var(--maxw);margin:1.1rem auto 0;padding:0 1.5rem;font-size:.85rem;color:var(--muted);}
.breadcrumb a{color:var(--muted);}
.breadcrumb a:hover{color:var(--link);}

/* ---------- hero ---------- */
.hero{max-width:var(--maxw);margin:0 auto;padding:1.4rem 1.5rem 0;}
.eyebrow{
  display:inline-block;font-size:.76rem;font-weight:700;
  letter-spacing:.09em;text-transform:uppercase;color:var(--purple);
  background:rgba(124,58,237,.08);
  padding:.3rem .75rem;border-radius:100px;margin-bottom:.9rem;
}
.subhead{font-size:1.13rem;color:var(--muted);max-width:64ch;margin:0 0 1.4rem;}

.backbone{
  display:flex;align-items:center;gap:0;flex-wrap:wrap;
  background:var(--grad);
  border-radius:var(--radius);padding:1.3rem 1.4rem;margin:0 0 2rem;
  overflow-x:auto;
}
.backbone .bnode{display:flex;flex-direction:column;align-items:center;gap:.35rem;flex:0 0 auto;padding:0 .9rem;}
.backbone .dot{width:14px;height:14px;border-radius:50%;background:#c4b5fd;box-shadow:0 0 0 6px rgba(196,181,253,.2);}
.backbone .lbl{color:#eef2ff;font-size:.78rem;font-family:'JetBrains Mono';white-space:nowrap;}
.backbone .arrow{color:rgba(255,255,255,.45);flex:0 0 auto;font-size:1.1rem;}

/* ---------- layout ---------- */
main{max-width:var(--maxw);margin:0 auto;padding:0 1.5rem 4rem;}
.layout{display:grid;grid-template-columns:1fr 260px;gap:3rem;align-items:start;}
article{min-width:0;}
.toc{
  position:sticky;top:5rem;background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:1.2rem 1.3rem;font-size:.88rem;box-shadow:0 1px 3px rgba(15,23,42,.04);
}
.toc h4{margin:0 0 .7rem;font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);}
.toc ul{margin:0;padding:0;list-style:none;}
.toc li{margin-bottom:.5rem;}
.toc a{color:var(--text);}
.toc a:hover{color:var(--link);}

/* ---------- callouts / boxes ---------- */
.callout{
  background:var(--card);border:1px solid var(--line);border-left:4px solid var(--indigo);
  border-radius:10px;padding:1.1rem 1.3rem;margin:1.5rem 0;
}
.callout.amber{border-left-color:#f59e0b;}
.callout h4{margin:0 0 .4rem;font-size:1rem;}

.tldr{
  background:#eef2ff;border:1px solid #c7d2fe;border-radius:var(--radius);
  padding:1.2rem 1.4rem;margin:0 0 2rem;
}
.tldr h4{margin:0 0 .5rem;font-size:.9rem;text-transform:uppercase;letter-spacing:.05em;color:var(--indigo);}
.tldr p{margin:0;}

.download-box{
  display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;
  background:var(--grad);color:#fff;border-radius:var(--radius);padding:1.3rem 1.5rem;margin:1.8rem 0;
}
.download-box .file{font-family:'JetBrains Mono';font-size:.85rem;color:#ddd6fe;}
.download-box p{margin:0;color:#e0e7ff;}
.btn{
  display:inline-block;background:#fff;color:var(--indigo);font-weight:700;padding:.65rem 1.1rem;
  border-radius:9px;font-size:.9rem;white-space:nowrap;box-shadow:0 2px 6px rgba(15,23,42,.15);
}
.btn:hover{background:#eef2ff;color:var(--indigo);text-decoration:none;}
.btn.ghost{background:transparent;border:1px solid rgba(255,255,255,.5);color:#fff;box-shadow:none;}
.btn.ghost:hover{background:rgba(255,255,255,.12);color:#fff;}

/* ---------- tables ---------- */
table{width:100%;border-collapse:collapse;margin:1.2rem 0 1.8rem;font-size:.94rem;background:var(--card);}
th,td{text-align:left;padding:.65rem .8rem;border-bottom:1px solid var(--line);}
th{background:#f1f5f9;color:var(--heading);font-weight:700;font-size:.82rem;text-transform:uppercase;letter-spacing:.03em;}
tr:last-child td{border-bottom:none;}

/* ---------- code ---------- */
pre{
  background:var(--code-bg);color:#e2e8f0;border-radius:10px;padding:1.1rem 1.3rem;overflow-x:auto;
  font-size:.86rem;line-height:1.55;margin:1.2rem 0 1.8rem;border:1px solid #1e293b;
}
pre .k{color:#a5b4fc;}
pre .s{color:#fbbf24;}
code.inline{background:#eef2ff;color:var(--indigo);padding:.15rem .4rem;border-radius:5px;font-size:.88em;}

/* ---------- cards / grid ---------- */
.grid-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:1.1rem;margin:1.6rem 0 2rem;}
.grid-cards .card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1.1rem 1.2rem;box-shadow:0 1px 3px rgba(15,23,42,.04);}
.grid-cards .card h4{margin:0 0 .4rem;font-size:1rem;}
.grid-cards .card p{margin:0;font-size:.9rem;color:var(--muted);}

/* ---------- hub index grid ---------- */
.hub-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:1.2rem;margin:1.6rem 0 2.5rem;}
.hub-card{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:1.4rem;
  transition:transform .15s ease, box-shadow .15s ease;box-shadow:0 1px 3px rgba(15,23,42,.04);
}
.hub-card:hover{transform:translateY(-3px);box-shadow:0 14px 30px rgba(79,70,229,.12);}
.hub-card .tag{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--purple);font-weight:700;}
.hub-card h3{margin:.4rem 0 .5rem;font-size:1.05rem;}
.hub-card p{color:var(--muted);font-size:.9rem;margin:0 0 .8rem;}
.hub-card a.readmore{font-weight:600;font-size:.88rem;}

/* ---------- faq ---------- */
.faq details{
  background:var(--card);border:1px solid var(--line);border-radius:10px;padding:1rem 1.2rem;margin-bottom:.8rem;
}
.faq summary{font-weight:700;color:var(--heading);cursor:pointer;}
.faq p{margin:.7rem 0 0;color:var(--muted);}

/* ---------- keyword chips ---------- */
.chips{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0 2rem;}
.chip{background:#eef2ff;color:#4338ca;font-size:.78rem;padding:.35rem .75rem;border-radius:100px;font-family:'JetBrains Mono';}

/* ---------- related ---------- */
.related{background:#eef2ff;border-radius:var(--radius);padding:1.4rem 1.6rem;margin:2.5rem 0;}
.related h4{margin:0 0 .8rem;}
.related ul{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.5rem .8rem;}
.related a{font-weight:600;}

/* ---------- svg diagram frame ---------- */
.diagram{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:1.2rem;margin:1.6rem 0 2rem;text-align:center;box-shadow:0 1px 3px rgba(15,23,42,.04);
}
.diagram svg{max-width:100%;height:auto;}
.diagram figcaption{font-size:.85rem;color:var(--muted);margin-top:.7rem;}

/* ---------- footer ---------- */
.pg-footer{background:#ffffff;border-top:1px solid var(--line);margin-top:3rem;view-transition-name:site-footer;}
.pg-footer-grid{
  max-width:var(--nav-maxw);margin:0 auto;padding:2.6rem 2rem;
  display:grid;grid-template-columns:1.4fr 1fr 1fr 1fr;gap:2rem;
}
.pg-footer-brand p{color:var(--muted);font-size:.9rem;max-width:36ch;margin:.9rem 0 0;}
.pg-footer h5{color:var(--heading);font-size:.82rem;text-transform:uppercase;letter-spacing:.06em;margin:0 0 .8rem;font-weight:700;}
.pg-footer h5 a{color:inherit;}
.pg-footer h5 a:hover{color:var(--link);}
.pg-footer ul{list-style:none;padding:0;margin:0;}
.pg-footer li{margin-bottom:.5rem;font-size:.88rem;}
.pg-footer ul a{color:#475569;}
.pg-footer ul a:hover{color:var(--link);}
.pg-footer-bottom{
  border-top:1px solid var(--line);
  max-width:var(--nav-maxw);margin:0 auto;padding:1.1rem 2rem;
  display:flex;align-items:center;justify-content:space-between;gap:.8rem;flex-wrap:wrap;
  font-size:.83rem;color:var(--muted);
}
.pg-footer-links{display:inline-flex;gap:1.4rem;}
.pg-footer-bottom a{color:#475569;}
.pg-footer-bottom a:hover{color:var(--link);}
.pg-support{font-weight:700;color:var(--link) !important;}

@media (max-width:900px){
  .layout{grid-template-columns:1fr;}
  .toc{position:static;margin-bottom:1.5rem;}
  .pg-footer-grid{grid-template-columns:1fr 1fr;}
  h1{font-size:1.9rem;}
}
/* ---------- cookie consent (compact card, bottom-left) ---------- */
.cookie-consent{
  position:fixed;left:1.5rem;bottom:1.5rem;z-index:80;
  width:calc(100% - 3rem);max-width:23rem;
  background:rgba(255,255,255,.98);backdrop-filter:blur(8px);
  border:1px solid var(--line);border-radius:18px;
  box-shadow:0 22px 50px rgba(15,23,42,.20);padding:1.25rem;
  animation:cookie-in .4s cubic-bezier(.4,0,.2,1);
  view-transition-name:cookie-banner;   /* stays put during page transitions */
}
@keyframes cookie-in{from{opacity:0;transform:translateY(16px);}to{opacity:1;transform:translateY(0);}}
.cookie-head{display:flex;align-items:center;gap:.65rem;margin-bottom:.7rem;}
.cookie-badge{
  flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  width:36px;height:36px;border-radius:10px;background:var(--grad);color:#fff;
}
.cookie-badge svg{width:20px;height:20px;}
.cookie-title{margin:0;font-size:.98rem;font-weight:700;color:var(--heading);}
.cookie-text{margin:0 0 .5rem;font-size:.82rem;color:var(--muted);line-height:1.55;}
.cookie-text.small{font-size:.76rem;}
.cookie-text a{font-weight:600;}
.cookie-actions{display:flex;gap:.6rem;margin-top:.95rem;}
.cookie-btn{
  flex:1 1 0;padding:.55rem .9rem;border-radius:10px;font-size:.85rem;font-weight:600;
  cursor:pointer;border:1px solid transparent;font-family:inherit;
  transition:filter .15s ease,background .15s ease;
}
.cookie-btn.ghost{background:#fff;border-color:var(--line);color:#475569;}
.cookie-btn.ghost:hover{background:#f1f5f9;}
.cookie-btn.solid{background:var(--grad);color:#fff;}
.cookie-btn.solid:hover{filter:brightness(1.07);}

/* ---------- newsletter subscribe (footer form + popup) ---------- */
.pg-subscribe{margin-top:1.1rem;}
.pg-subscribe h5{margin:0 0 .55rem;}
.pg-subscribe-row{display:flex;gap:.5rem;flex-wrap:wrap;max-width:22rem;}
.pg-subscribe-input{
  flex:1 1 12rem;min-width:0;padding:.55rem .8rem;font-size:.85rem;
  border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--text);
  font-family:inherit;
}
.pg-subscribe-input:focus{outline:none;border-color:#93c5fd;box-shadow:0 0 0 3px rgba(37,99,235,.15);}
.pg-subscribe-btn{
  flex:0 0 auto;padding:.55rem 1.1rem;border-radius:10px;border:1px solid transparent;
  font-size:.85rem;font-weight:600;color:#fff;background:var(--grad);cursor:pointer;
  font-family:inherit;transition:filter .15s ease;
}
.pg-subscribe-btn:hover{filter:brightness(1.07);}
.pg-subscribe-btn:disabled{opacity:.6;cursor:default;}
.pg-subscribe-note{margin:.5rem 0 0;font-size:.78rem;color:var(--muted);}
.pg-subscribe-note.ok{color:#059669;font-weight:600;}
.pg-subscribe-note.err{color:#dc2626;}

.sub-modal-overlay{
  position:fixed;inset:0;z-index:90;
  display:flex;align-items:center;justify-content:center;padding:1.25rem;
  background:rgba(15,23,42,.55);backdrop-filter:blur(4px);
  animation:sub-fade .25s ease;
}
.sub-modal-overlay[hidden]{display:none;}
@keyframes sub-fade{from{opacity:0;}to{opacity:1;}}
.sub-modal{
  position:relative;width:100%;max-width:34rem;
  background:var(--card);border:1px solid var(--line);border-radius:22px;
  box-shadow:0 30px 70px rgba(15,23,42,.35);padding:2.6rem 2.4rem 2.2rem;
  text-align:center;animation:sub-pop .32s cubic-bezier(.4,0,.2,1);
}
@keyframes sub-pop{from{opacity:0;transform:translateY(18px) scale(.96);}to{opacity:1;transform:none;}}
@keyframes sub-slide-up{from{opacity:0;transform:translateY(100%);}to{opacity:1;transform:none;}}
.sub-popup-close{
  position:absolute;top:1rem;right:1.1rem;width:2.2rem;height:2.2rem;
  border:none;background:transparent;color:var(--muted);font-size:1.6rem;line-height:1;
  cursor:pointer;border-radius:10px;
}
.sub-popup-close:hover{background:#f1f5f9;color:var(--heading);}
.sub-modal h3{margin:0 0 .6rem;font-size:1.55rem;font-weight:800;color:var(--heading);}
.sub-modal p{margin:0 auto 1.4rem;max-width:26rem;font-size:.98rem;color:var(--muted);line-height:1.6;}
.sub-modal .pg-subscribe-row{max-width:26rem;margin:0 auto;}
.sub-modal .pg-subscribe-input{padding:.7rem 1rem;font-size:.95rem;}
.sub-modal .pg-subscribe-btn{padding:.7rem 1.5rem;font-size:.95rem;}
.sub-modal .pg-subscribe-note{margin-top:.8rem;}

@media (max-width:560px){
  .pg-footer-grid{grid-template-columns:1fr;}
  .pg-nav{gap:.4rem;padding:.55rem 1rem;}
  .pg-auth{margin-left:0;}
  .pg-auth-q{display:none;}
  .pg-footer-bottom{justify-content:center;text-align:center;}
  .cookie-consent{left:1rem;right:1rem;bottom:1rem;width:auto;max-width:none;}

  /* Mobile: NOT a full-screen interstitial (Google penalises those). Render as
     a compact bottom banner that leaves the article visible and tappable, so
     the page content stays accessible from search. */
  .sub-modal-overlay{
    position:fixed;inset:auto 0 0 0;top:auto;
    display:block;padding:0;
    background:transparent;backdrop-filter:none;animation:none;
    pointer-events:none;               /* taps pass through to the content */
  }
  .sub-modal{
    pointer-events:auto;               /* …except on the banner itself */
    width:100%;max-width:none;
    border:none;border-top:1px solid var(--line);
    border-radius:16px 16px 0 0;
    box-shadow:0 -12px 30px rgba(15,23,42,.16);
    padding:1.25rem 1.25rem 1.4rem;
    text-align:left;
    animation:sub-slide-up .3s ease;
  }
  .sub-modal h3{font-size:1.15rem;margin-bottom:.35rem;}
  .sub-modal p{font-size:.85rem;margin:0 0 .9rem;max-width:none;line-height:1.5;}
  .sub-modal .pg-subscribe-row{max-width:none;margin:0;flex-direction:column;}
  .sub-modal .pg-subscribe-btn{width:100%;}
  .sub-popup-close{top:.6rem;right:.7rem;}
}
