/* ===== Design tokens ===== */
:root{
  /* brand + UI */
  --banner:#2C3A5B;
  --text:#111827;
  --muted:#6b7280;
  --white-1:#ffffff;
  --white-2:#f8fafc;
  --white-3:#f1f5f9;

  /* pills */
  --pill-bg:#ecfeff;
  --pill-bd:#a7f3d0;
  --pill-fg:#134e4a;

  /* header sizing/spacing */
  --sb-header-h: 70px;
  --sb-header-pad-x: 20px;
  --sb-brand-size: 28px;

  /* nav (aliases so older code still reads well) */
  --nav-bg: var(--banner);
  --nav-fg: #BFBFBF;

  /* misc */
  --login:#00B050;
  --panel-gap:16px;
  --page-pad-x: var(--sb-header-pad-x);
}

*{ box-sizing: border-box; }
html,body{ margin:0; height:100%; }
body{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,"Noto Sans";
  color:var(--text);
  background:#f9fafb;
}

.visually-hidden{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
}

/* ===== Header / Nav ===== */
.sb-header{
  height: var(--sb-header-h);
  padding: 12px var(--sb-header-pad-x);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:var(--nav-bg); color:var(--nav-fg);
  position:sticky; top:0; z-index:100;
}
.sb-brand{ display:flex; align-items:center; gap:10px; }
#sb-logo{
  width: calc(var(--sb-header-h) - 16px);
  height: calc(var(--sb-header-h) - 16px);
  background:#e5e7eb; border-radius:8px;
}
.sb-name{
  font-variant:small-caps; font-weight:800; letter-spacing:.6px;
  font-size: var(--sb-brand-size); line-height:1;
  color:inherit; text-decoration:none; display:inline-block;
}
.sb-name:focus-visible{ outline:2px solid #fff; outline-offset:2px; }
.tm{ font-variant:normal; font-size:.8em; margin-left:2px; color:#BFBFBF; }

/* top-level links */
.sb-nav{ display:flex; gap:13.6px; align-items:center; }
.sb-nav a{ color:var(--nav-fg); text-decoration:none; font-weight:700; letter-spacing:.6px; padding:8px 4px; }
.sb-nav a.login{ color:var(--login); }
.sb-nav a.active{ border-bottom:2px solid #BFBFBF; }
.sb-nav a:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

/* dropdowns */
.nav-item{ position:relative; }
.nav-item .submenu{
  position:absolute; left:0; top:100%; min-width:260px;
  background:#161d2d; color:#fff; border:1px solid #1f2937; border-radius:8px;
  padding:8px 0; display:none;
}
.nav-item.open .submenu{ display:block; }
.submenu a{ display:block; color:#fff; text-decoration:none; padding:8px 12px; }

/* mobile nav toggle */
.nav-toggle{ display:none; background:transparent; border:0; color:#fff; }
.nav-toggle span{ display:block; width:22px; height:2px; background:#fff; margin:4px 0; }

/* responsive nav */
@media (max-width: 900px){
  .nav-toggle{ display:block; }
  .sb-nav{
    position:absolute; left:0; right:0; top:56px; background:var(--nav-bg);
    padding:10px; border-radius:8px; flex-direction:column; gap:8.5px; min-width:160px; display:none;
  }
  .sb-nav.open{ display:flex; }
  .nav-item .submenu{ position:static; border:0; background:transparent; padding:0; }
  .submenu a{ padding:8px 6px; }
}

/* ===== Layout ===== */
#main{
  flex:1 0 auto;
  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x);
}

/* ===== Page titles ===== */
#main > h1{
  margin:48px auto 32px;
  font-size:clamp(2.4rem, 5vw, 3.4rem);
  line-height:1.05;
  color:var(--banner);
  text-align:center;
  max-height:320px;
  overflow:hidden;
  transition:
    margin var(--diagram-condense-duration, .4s) ease,
    max-height var(--diagram-condense-duration, .4s) ease,
    opacity var(--diagram-condense-duration, .4s) ease,
    transform var(--diagram-condense-duration, .4s) ease;
}
body.diagram-condensed #main > h1{
  margin:0 auto;
  max-height:0;
  opacity:0;
  transform:translateY(-16px);
  pointer-events:none;
}
.sb-main{
  display:grid;
  grid-template-columns:65fr 35fr;
  gap:16px;
  width:100%;
  margin:16px auto;
  padding:0 var(--sb-header-pad-x);
  transition:margin var(--diagram-condense-duration, .4s) ease;
}
@media (max-width:1000px){ .sb-main{ grid-template-columns:1fr } }
.span-all{ grid-column:1 / -1; }
body.diagram-condensed .sb-main{
  margin-top:8px;
}

/* panels */
.panel{ background:#fff; border:4px solid var(--banner); padding:12px; margin-top: var(--panel-gap); }
.panel h2{ margin:0 0 8px 0; }

/* ===== Homepage hero ===== */
.home-hero{
  display:grid;
  grid-template-columns:1fr;
  gap:32px;
  align-items:center;
  margin:48px auto;
  max-width:1200px;
}
@media (min-width:960px){
  .home-hero{
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  }
}
.hero-copy{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.hero-eyebrow{
  margin:0;
  font-size:12px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--muted);
}
.home-hero h1{
  margin:0;
  font-size:clamp(2.6rem, 5vw, 3.6rem);
  line-height:1.05;
  color:var(--banner);
}
.hero-subtitle{
  margin:0;
  font-size:1.1rem;
  line-height:1.6;
  color:#475569;
}
.hero-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:4px;
}
.hero-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 22px;
  border-radius:999px;
  font-weight:600;
  font-size:15px;
  text-decoration:none;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.hero-btn.primary{
  background:var(--banner);
  color:#fff;
  box-shadow:0 16px 40px rgba(15,23,42,.25);
}
.hero-btn.secondary{
  background:transparent;
  border:2px solid var(--banner);
  color:var(--banner);
}
.hero-btn.primary:hover,
.hero-btn.primary:focus-visible{
  transform:translateY(-1px);
  box-shadow:0 22px 48px rgba(15,23,42,.3);
}
.hero-btn.secondary:hover,
.hero-btn.secondary:focus-visible{
  background:rgba(44,58,91,.1);
  transform:translateY(-1px);
}
.hero-btn:focus-visible{
  outline:2px solid var(--banner);
  outline-offset:3px;
}
.hero-carousel{ position:relative; width:100%; max-width:640px; justify-self:center; }

/* ===== Corpus Diagrammatum ===== */
.literature-hero{
  max-width:1100px;
  margin:48px auto 64px;
  display:flex;
  flex-direction:column;
  gap:36px;
}

.literature-hero__header{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  text-align:center;
}

.literature-hero__header h1{
  margin:0;
  font-size:clamp(2.4rem, 5vw, 3.4rem);
  color:var(--banner);
}

.literature-hero__subtitle{
  margin:0;
  font-size:1.15rem;
  line-height:1.6;
  color:#475569;
}

.literature-hero__grid{
  display:grid;
  gap:24px;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
}

.literature-card{
  background:#fff;
  border-radius:20px;
  border:2px solid #e5e7eb;
  padding:28px 24px;
  box-shadow:0 18px 36px rgba(15,23,42,0.08);
  display:flex;
  flex-direction:column;
  gap:16px;
}

.literature-card__icon{
  width:88px;
  height:auto;
  align-self:flex-start;
}

.literature-card h2{
  margin:0;
  font-size:1.45rem;
  color:var(--banner);
}

.literature-card p{
  margin:0;
  color:#475569;
  line-height:1.6;
}

.cta-button{
  display:inline-flex;
  align-items:center;
  gap:12px;
  padding:14px 22px;
  border-radius:999px;
  background:var(--banner);
  color:#fff;
  font-weight:700;
  font-size:14px;
  text-decoration:none;
  border:0;
  box-shadow:0 16px 30px rgba(44,58,91,0.28);
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
  margin-top:auto;
}

.cta-button__icon{
  width:34px;
  height:34px;
  border-radius:50%;
  background:#fff;
  color:var(--banner);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  font-weight:700;
}

.cta-button__label{
  white-space:normal;
}

.cta-button:hover,
.cta-button:focus-visible{
  transform:translateY(-1px);
  box-shadow:0 20px 40px rgba(44,58,91,0.32);
}

.cta-button:focus-visible{
  outline:3px solid #fff;
  outline-offset:4px;
}

@media (max-width:720px){
  .literature-hero{
    margin:40px auto 56px;
    gap:28px;
  }
}

@media (max-width:520px){
  .literature-hero{
    margin:32px auto 48px;
  }

  .literature-card{
    padding:24px 20px;
  }
}

/* ===== Sentence bar (Builder) ===== */
.sentence-bar-wrap{ position:relative; margin:0; }
.sentence-bar{ position:relative; margin:0; }
.sentence-bar textarea{
  width:100%;
  resize:none;
  min-height:44px;
  padding:10px var(--inline-controls-padding, 140px) 10px 12px;
  border:1px solid #cbd5e1;
  background:#f3f4f6;
  border-radius:6px;
  font-size:14px;
  line-height:1.4;
  overflow:hidden;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.inline-controls{ position:absolute; right:8px; top:50%; transform:translateY(-50%); display:flex; gap:6px; align-items:center; }

.icon-btn{ display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:6px; border:0; background:transparent; color:#374151; border-radius:8px; cursor:pointer; }
.icon-btn.disabled, .icon-btn:disabled{ opacity:.5; cursor:not-allowed; }
.icon-btn svg,
.icon-btn img,
.icon-btn .icon{ width:18px; height:18px; display:block; }

.wrench-icon{
  background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAiElEQVR4nGP4//8/AzUwVQwZoQYJAHEWlK0AxKGUukgUSocSMgzG6EdyATbsAMTziTGo4T8EFKApAHkrAIktSsggEF4FNewxlA3jI6vpw2UYNi9MBeL9ULwe6hJYBLyCipMV/aJQl7z6jwCPyTEIZtj+/6jAgRyDYPgxpS5CD0eywogoPPgMAgChs+RdNrU+kQAAAABJRU5ErkJggg==");
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
}
@supports ((-webkit-mask-image: url("")) or (mask-image: url(""))){
  .wrench-icon{
    background-image:none;
    background-color:currentColor;
    -webkit-mask-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAiElEQVR4nGP4//8/AzUwVQwZoQYJAHEWlK0AxKGUukgUSocSMgzG6EdyATbsAMTziTGo4T8EFKApAHkrAIktSsggEF4FNewxlA3jI6vpw2UYNi9MBeL9ULwe6hJYBLyCipMV/aJQl7z6jwCPyTEIZtj+/6jAgRyDYPgxpS5CD0eywogoPPgMAgChs+RdNrU+kQAAAABJRU5ErkJggg==");
    -webkit-mask-repeat:no-repeat;
    -webkit-mask-position:center;
    -webkit-mask-size:contain;
    mask-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAiElEQVR4nGP4//8/AzUwVQwZoQYJAHEWlK0AxKGUukgUSocSMgzG6EdyATbsAMTziTGo4T8EFKApAHkrAIktSsggEF4FNewxlA3jI6vpw2UYNi9MBeL9ULwe6hJYBLyCipMV/aJQl7z6jwCPyTEIZtj+/6jAgRyDYPgxpS5CD0eywogoPPgMAgChs+RdNrU+kQAAAABJRU5ErkJggg==");
    mask-repeat:no-repeat;
    mask-position:center;
    mask-size:contain;
  }
}

.diagram-btn{
  display:inline-flex; align-items:center; gap:6px; padding:6px 10px;
  background:#d1d5db; color:#111827; border:1px solid #9ca3af; border-radius:10px; cursor:not-allowed;
}
.diagram-btn img{ width:16px; height:16px; display:block; }
.diagram-btn.ready{ background:var(--pill-bg); color:var(--pill-fg); border-color:var(--pill-bd); cursor:pointer; }
.diagram-btn.locked:hover{ box-shadow:none; }

.input-error{ color:#dc2626; margin:0 2px 0; min-height:0; }
.input-error:empty{ display:none; }
.sentence-progress{
  position:absolute;
  top:calc(100% + 2px);
  left:2px;
  right:2px;
  color:#dc2626;
  font-weight:600;
  font-size:14px;
  line-height:1.3;
  letter-spacing:0.01em;
  opacity:0;
  transition:opacity .25s ease;
  pointer-events:none;
  z-index:2;
}
.sentence-progress.is-active{ opacity:1; }
.sentence-progress__text{
  display:inline-block;
  opacity:0;
  will-change:opacity, clip-path;
  white-space:normal;
}

/* ===== Carousel ===== */
.carousel{
  position:relative;
  overflow:hidden;
  background:#0f172a;
  border-radius:24px;
  aspect-ratio:16/9;
  min-height:280px;
  box-shadow:0 20px 45px rgba(15,23,42,.22);
}
.car-track{
  position:relative;
  width:100%;
  height:100%;
}
.car-track img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  opacity:0;
  visibility:hidden;
  transition:opacity .4s ease;
}
.car-track img.active{
  opacity:1;
  visibility:visible;
}
.car-btn,
.car-toggle{
  position:absolute;
  z-index:2;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:46px;
  height:46px;
  border-radius:999px;
  border:0;
  background:rgba(15,23,42,.65);
  color:#fff;
  font-size:28px;
  line-height:1;
  cursor:pointer;
  transition:background .2s ease, transform .2s ease;
}
.car-btn:hover,
.car-toggle:hover{
  background:rgba(15,23,42,.85);
  transform:scale(1.05);
}
.car-btn:focus-visible,
.car-toggle:focus-visible{
  outline:2px solid #fff;
  outline-offset:3px;
}
.car-btn.prev{ left:16px; top:50%; transform:translateY(-50%); }
.car-btn.next{ right:16px; top:50%; transform:translateY(-50%); }
.car-toggle{
  top:16px;
  right:16px;
  width:40px;
  height:40px;
  font-size:16px;
}
.car-toggle[aria-pressed="true"]{
  background:rgba(30,64,175,.85);
}
.car-toggle-icon{ pointer-events:none; }
.car-dots{
  position:absolute;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  display:flex;
  gap:10px;
  z-index:2;
}
.car-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  border:0;
  padding:0;
  background:rgba(255,255,255,.45);
  cursor:pointer;
  transition:transform .2s ease, background .2s ease;
}
.car-dot.active{ background:#fff; transform:scale(1.15); }
.car-dot:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

@media (max-width:640px){
  .carousel{ border-radius:18px; min-height:220px; }
  .car-btn,
  .car-toggle{ width:38px; height:38px; font-size:22px; }
  .car-btn.prev{ left:10px; }
  .car-btn.next{ right:10px; }
  .car-toggle{ top:12px; right:12px; }
}

/* ===== Diagram stage (Builder) ===== */
.diagram-stage{
  display:block;
  background:#f1f5f9;
  height:auto;
  min-height:0;
  position:relative;
  padding:0;
}
.diagram-stage.empty{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px 16px;
  min-height:220px;
}
.diagram-stage.empty img{ display:none; }
.diagram-stage img{ width:100%; height:auto; touch-action:manipulation; transition:opacity 0.5s ease; }
.diagram-stage__outgoing{
  position:absolute;
  inset:0;
  pointer-events:none;
  width:100%;
  height:100%;
  object-fit:contain;
  transition:opacity 0.5s ease;
}

/* ===== Sentence Diagrammer canvas ===== */
.diagram-stage--144x77{
  aspect-ratio:144 / 77;
  width:100%;
  max-width:100%;
  border:1px solid #cbd5e1;
  border-radius:6px;
  display:grid;
  grid-template-rows:var(--canvas-stage-gap, 12px) 1fr;
  justify-items:center;
  align-items:center;
  justify-content:center;
  background:#f1f5f9;
  overflow:auto;
}

.diagram-stage--144x77:not(.empty){
  background:#fff;
}
.diagram-stage--144x77 > *{
  grid-row:2;
  align-self:center;
  justify-self:center;
}
.diagram-stage--144x77 .diagram-stage__outgoing{
  top:var(--canvas-stage-gap, 12px);
}
.diagram-stage--144x77 img{
  width:auto;
  height:auto;
  touch-action:manipulation;
  object-fit:initial;
  max-width:none;
  max-height:none;
  margin:0;
}
.diagram-stage--144x77.empty{
  min-height:0;
  padding:0;
  overflow:auto;
  background:#f1f5f9;
}
.diagram-stage--144x77.empty .diagram-placeholder{
  padding:32px 16px;
}
.diagram-stage--144x77 .diagram-placeholder{
  margin:0 auto;
  max-height:100%;
  overflow:auto;
}
.diagram-placeholder{
  max-width:520px;
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  text-align:center;
  color:#1e293b;
}
.diagram-placeholder__note{
  font-size:0.875rem;
  line-height:1.5;
  color:#475569;
  margin:0;
}
.diagram-placeholder__status{
  font-size:0.875rem;
  line-height:1.4;
  min-height:1.2em;
  color:#475569;
  margin:0;
}
.diagram-placeholder__status.error{ color:#b91c1c; }
.diagram-placeholder__status.success{ color:#047857; }
.diagram-placeholder .pill{
  background:#0f172a;
  color:#f8fafc;
}

/* ===== Bottom controls (Builder) ===== */
.bottom-controls{
  display:flex; align-items:center; gap:8px; justify-content:flex-start; margin:12px 0 0;
}
.panel.canvas{
  position:relative;
  --canvas-stage-gap:12px;
}
.canvas-settings{
  position:absolute;
  inset:0;
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  pointer-events:none;
  z-index:3;
}
.canvas-settings .settings{
  background:transparent;
  margin:0;
  opacity:0;
  position:absolute;
  transition:opacity 1s ease;
  pointer-events:auto;
}
.canvas-settings .settings[hidden]{
  display:none;
}
.pill{ padding:6px 10px; border-radius:10px; background:var(--pill-bg); color:var(--pill-fg); border:1px solid var(--pill-bd); cursor:pointer; }
.pill.disabled, .pill:disabled{ opacity:.5; cursor:not-allowed; }
.icon-btn.gear.locked{ opacity:.5; cursor:not-allowed; }

/* ===== Settings panel (Builder) ===== */
.settings{ border:0; border-radius:10px; padding:12px; max-width:420px; }
.settings h3{ margin:0 0 8px 0; }
.toggles{ display:grid; grid-template-columns:1fr; gap:6px; }
.toggles .toggle{
  display:flex;
  align-items:center;
  gap:8px;
  position:relative;
  cursor:pointer;
  color:#0f172a;
}
.toggles .toggle__input{
  position:absolute;
  inset:auto;
  width:1px;
  height:1px;
  margin:-1px;
  padding:0;
  border:0;
  opacity:0;
  clip:rect(0 0 0 0);
  clip-path:inset(50%);
  overflow:hidden;
}
.toggles .toggle__control{
  position:relative;
  flex-shrink:0;
  width:32px;
  height:18px;
  display:inline-block;
  border-radius:999px;
  background:#cbd5e1;
  transition:background .2s ease;
}
.toggles .toggle__thumb{
  position:absolute;
  top:2px;
  left:2px;
  width:14px;
  height:14px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 1px 2px rgba(15,23,42,.25);
  transition:transform .2s ease;
}
.toggles .toggle__label{ flex:1; }
.toggles .toggle__input:focus-visible + .toggle__control{
  outline:2px solid #38bdf8;
  outline-offset:2px;
}
.toggles .toggle__input:checked + .toggle__control{
  background:#22c55e;
}
.toggles .toggle__input:checked + .toggle__control .toggle__thumb{
  transform:translateX(14px);
}
.toggles .toggle__input:disabled + .toggle__control{
  background:#e2e8f0;
}
.toggles .toggle__input:disabled + .toggle__control .toggle__thumb{
  box-shadow:none;
}

/* ===== Info panel ===== */
.info h2{ font-size:18px; margin:0 0 12px; text-align:center; text-transform:none; color:#000; }
.info .tm{ color:#000; }
.video{ margin-top:12px; aspect-ratio:16/9; background:#000; }
.video iframe{ width:100%; height:100%; border:0; }
.info .bullets{ margin:8px 0 16px 0; padding-left:16px; }
.info a{ color:#0f766e; }

/* center the instructions stack vertically */
.panel.info{
  display:flex; flex-direction:column; justify-content:center; align-items:stretch;
}

/* ===== Parse panels (Builder) ===== */
.parse-panels{
  display:grid; grid-template-columns:1fr; gap:var(--panel-gap); margin:0; padding:0;
}
@media (min-width:1000px){ .parse-panels{ grid-template-columns:repeat(3,1fr); } }

.panel-head{ display:flex; justify-content:space-between; align-items:center; gap:12px; }
.panel-head__actions{ display:flex; flex-direction:row; align-items:center; gap:6px; align-self:center; }
.panel-head h3{ margin:0; font-size:16px; color:#334155; }

/* code panel theme */
.panel.code{ background:#0b1220; color:#e5e7eb; border-color:var(--banner); }
.panel.code .panel-head h3{ color:#e5e7eb; }
.panel.code .icon-btn{ color:#e5e7eb; }
.panel.code .icon-btn:hover{ background:rgba(255,255,255,.08); }
.panel.code .icon-btn:active{ background:rgba(255,255,255,.12); }
.panel.code .icon-btn:focus-visible{ outline-color:#34d399; }
.panel.code pre{
  margin:8px 0 0; background:transparent; color:inherit;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  font-size:13px; line-height:1.5; white-space:pre-wrap; word-break:break-word;
}
.panel.code pre[data-source-label]{
  position:relative;
  padding-top:26px;
}
.panel.code pre[data-source-label]::before{
  content:attr(data-source-label);
  position:absolute;
  top:0;
  left:0;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:6px;
  padding:2px 10px;
  border-radius:999px;
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  background:rgba(148,163,184,.28);
  color:inherit;
}
.parse-panels pre[data-placeholder]:empty::before{
  content:attr(data-placeholder);
  display:block;
  color:rgba(229,231,235,.68);
  font-style:italic;
}

.parse-editor{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.parse-editor__input{
  width:100%;
  min-height:160px;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid rgba(148,163,184,.4);
  background:rgba(15,23,42,.78);
  color:inherit;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  font-size:13px;
  line-height:1.5;
  resize:vertical;
}
.parse-editor__input:focus{
  outline:2px solid #38bdf8;
  outline-offset:2px;
}
.parse-editor__actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.parse-editor__error{
  margin:0;
  color:#fca5a5;
  font-size:13px;
}
.parse-editor__hint{
  margin:0;
  font-size:12px;
  color:rgba(226,232,240,.7);
}

.panel-actions{
  margin-top:12px;
  display:flex;
  justify-content:flex-end;
}

/* copy feedback */
.copy-btn{ position:relative; }
.copy-btn .copy-label{ font-size:13px; transition: opacity .15s ease, transform .15s ease; }
.copy-btn.copied .copy-label{ opacity:.4; transform:scale(.98); }

/* ===== Footer ===== */
.sb-footer{
  margin-top:16px;
  padding:12px var(--page-pad-x);
  min-height:80px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
  background:var(--nav-bg);
  color:var(--nav-fg);
  font-size:17px;
  flex-shrink:0;
}
.foot-links a{
  color:inherit;
  text-decoration:none;
  margin-right:12px;
}
.foot-links a:hover,
.foot-links a:focus-visible{
  color:#fff;
  text-decoration:underline;
}
.copy{
  display:flex;
  align-items:center;
  gap:12px;
  color:inherit;
}
.copy__icon{
  flex:0 0 28px;
  width:28px;
  height:28px;
  display:inline-block;
  background-repeat:no-repeat;
  background-size:cover;
  background-position:center;
  border-radius:6px;
}
.copy__icon--left{
  background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyOCcgaGVpZ2h0PScyOCcgdmlld0JveD0nMCAwIDI4IDI4Jz4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0nZ3JhZExlZnQnIHgxPScwJScgeTE9JzAlJyB4Mj0nMTAwJScgeTI9JzEwMCUnPgogICAgICA8c3RvcCBvZmZzZXQ9JzAlJyBzdG9wLWNvbG9yPScjMGVhNWU5Jy8+CiAgICAgIDxzdG9wIG9mZnNldD0nMTAwJScgc3RvcC1jb2xvcj0nIzYzNjZmMScvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICA8L2RlZnM+CiAgPHJlY3Qgd2lkdGg9JzI4JyBoZWlnaHQ9JzI4JyByeD0nNicgZmlsbD0ndXJsKCNncmFkTGVmdCknLz4KICA8cGF0aCBkPSdNMTYuNSA3LjVsLTYgNiA2IDYnIGZpbGw9J25vbmUnIHN0cm9rZT0nI2Y4ZmFmYycgc3Ryb2tlLXdpZHRoPScyLjUnIHN0cm9rZS1saW5lY2FwPSdyb3VuZCcgc3Ryb2tlLWxpbmVqb2luPSdyb3VuZCcvPgogIDxjaXJjbGUgY3g9JzE3JyBjeT0nMTQnIHI9JzInIGZpbGw9JyNmOGZhZmMnLz4KPC9zdmc+");
}
.copy__icon--right{
  background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyOCcgaGVpZ2h0PScyOCcgdmlld0JveD0nMCAwIDI4IDI4Jz4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0nZ3JhZFJpZ2h0JyB4MT0nMCUnIHkxPScwJScgeDI9JzEwMCUnIHkyPScxMDAlJz4KICAgICAgPHN0b3Agb2Zmc2V0PScwJScgc3RvcC1jb2xvcj0nIzYzNjZmMScvPgogICAgICA8c3RvcCBvZmZzZXQ9JzEwMCUnIHN0b3AtY29sb3I9JyMwZWE1ZTknLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPScyOCcgaGVpZ2h0PScyOCcgcng9JzYnIGZpbGw9J3VybCgjZ3JhZFJpZ2h0KScvPgogIDxwYXRoIGQ9J00xMS41IDcuNWw2IDYtNiA2JyBmaWxsPSdub25lJyBzdHJva2U9JyNmOGZhZmMnIHN0cm9rZS13aWR0aD0nMi41JyBzdHJva2UtbGluZWNhcD0ncm91bmQnIHN0cm9rZS1saW5lam9pbj0ncm91bmQnLz4KICA8Y2lyY2xlIGN4PScxMScgY3k9JzE0JyByPScyJyBmaWxsPScjZjhmYWZjJy8+Cjwvc3ZnPg==");
}

/* ===== A11y helpers ===== */
.sr-only{ position:absolute; left:-9999px; }

/* hide img until src present (avoids broken image flash) */
.diagram-wrap img:not([src]),
.diagram-wrap img[src=""],
.diagram-stage img:not([src]),
.diagram-stage img[src=""]{ display:none; }

/* ===== Bibliotheca Diagrammatica ===== */
.bibliotheca-hero{
  max-width:1100px;
  margin:48px auto 36px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  text-align:center;
}

.bibliotheca-hero__header{ display:flex; flex-direction:column; align-items:center; gap:12px; }
.bibliotheca-hero__header h1{ margin:0; font-size:clamp(2.4rem, 5vw, 3.4rem); color:var(--banner); }
.bibliotheca-hero__subtitle{ margin:0; font-size:1.18rem; line-height:1.6; color:#475569; }
.bibliotheca-hero__copy{ margin:0; max-width:720px; color:#334155; line-height:1.65; font-size:1.05rem; }

.catalog-section{ max-width:1100px; margin:0 auto 96px; display:flex; flex-direction:column; gap:24px; }
.catalog-section--search{ margin-bottom:0; }
.catalog-section--search .feed-status:empty{ display:none; margin-top:0; min-height:0; }
.catalog-header{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; }
.catalog-header h2{ margin:0; font-size:clamp(2rem, 4vw, 2.6rem); color:var(--banner); }
.catalog-header p{ margin:0; color:#475569; max-width:720px; line-height:1.6; }

.catalog-search{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  align-items:flex-end;
  background:#fff;
  border-radius:22px;
  border:2px solid #e5e7eb;
  padding:22px 26px;
  box-shadow:0 16px 36px rgba(15,23,42,0.08);
}
.catalog-search__controls{ display:flex; flex:1 1 360px; gap:12px; align-items:center; flex-wrap:wrap; }
.catalog-search__select{ min-width:150px; padding:12px 14px; border-radius:12px; border:1px solid #cbd5e1; background:rgba(255,255,255,0.9); font-weight:600; font-size:15px; color:#1f2937; }
.catalog-search__select:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; }
.catalog-search__field{ flex:1 1 220px; }
.catalog-search__input{
  width:100%;
  padding:12px 16px;
  border-radius:12px;
  border:1px solid #cbd5e1;
  background:#f3f4f6;
  font-size:16px;
  color:#111827;
  box-shadow:inset 0 1px 2px rgba(15,23,42,0.08);
}
.catalog-search__input:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; background:#fff; }
.catalog-search__input::placeholder{ color:#6b7280; }

.catalog-sort{ display:flex; flex:0 0 auto; gap:10px; align-items:center; }
.catalog-sort__label{ font-weight:600; color:#334155; }
.catalog-sort__select{ padding:12px 14px; border-radius:12px; border:1px solid #cbd5e1; background:rgba(255,255,255,0.9); font-size:15px; font-weight:600; color:#1f2937; }
.catalog-sort__select:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; }

.catalog-meta{ margin:0; font-size:15px; color:#475569; }
.catalog-meta:empty{ display:none; }

.catalog-feed{ display:flex; flex-direction:column; gap:24px; }
.catalog-feed--static{ margin-top:0; }

.catalog-card{
  position:relative;
  display:flex;
  gap:18px;
  padding:22px;
  background:#fff;
  border-radius:22px;
  border:2px solid #e5e7eb;
  box-shadow:0 18px 36px rgba(15,23,42,0.09);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  width:100%;
}
.catalog-card:hover,
.catalog-card:focus-within{ transform:translateY(-2px); box-shadow:0 24px 46px rgba(15,23,42,0.16); border-color:rgba(44,58,91,0.45); }
.catalog-card__cover{
  flex:0 0 120px;
  width:120px;
  height:168px;
  border-radius:16px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  background:linear-gradient(135deg, var(--accent, rgba(44,58,91,0.9)), rgba(15,23,42,0.9));
  color:#fff;
  box-shadow:0 16px 30px rgba(15,23,42,0.18);
}
.catalog-card__cover img{ width:100%; height:100%; object-fit:cover; display:block; }
.catalog-card__cover:focus-visible{ outline:3px solid #fff; outline-offset:3px; }
.catalog-card__placeholder{ font-size:32px; font-weight:700; letter-spacing:.08em; }

.catalog-card__body{ display:flex; flex-direction:column; gap:12px; min-width:0; }
.catalog-card__title{ margin:0; font-size:1.32rem; color:var(--banner); }
.catalog-card__title a{ color:inherit; text-decoration:none; }
.catalog-card__title a:hover,
.catalog-card__title a:focus-visible{ text-decoration:underline; }
.catalog-card__meta{ margin:0; display:flex; flex-wrap:wrap; gap:6px 10px; font-size:14px; color:#475569; }
.catalog-card__dot{ color:rgba(71,85,105,0.6); }
.catalog-card__summary{ margin:0; color:#334155; line-height:1.6; font-size:15px; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.catalog-card__tags{ margin:0; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:6px; }
.catalog-card__tag{ margin:0; padding:4px 10px; font-size:11px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; border-radius:999px; background-color:rgba(15,118,110,.12); background-color:color-mix(in srgb, var(--accent,#0f766e) 12%, transparent); border:1px solid rgba(15,118,110,.24); border-color:color-mix(in srgb, var(--accent,#0f766e) 30%, transparent); color:var(--accent,#0f766e); }
.catalog-card__tag:focus-visible{ outline:2px solid currentColor; outline-offset:2px; }
.catalog-card__foot{ margin:0; font-size:12px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:#0f766e; }

.catalog-empty{ margin:28px 0; text-align:center; color:#475569; font-size:16px; }

.catalog-load-more{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin:24px auto 0;
  padding:12px 26px;
  border-radius:999px;
  border:0;
  background:var(--banner);
  color:#fff;
  font-weight:700;
  font-size:15px;
  cursor:pointer;
  box-shadow:0 18px 36px rgba(44,58,91,0.34);
  transition:transform .18s ease, box-shadow .18s ease;
}
.catalog-load-more:hover,
.catalog-load-more:focus-visible{ transform:translateY(-1px); box-shadow:0 24px 46px rgba(44,58,91,0.38); }
.catalog-load-more:focus-visible{ outline:3px solid #fff; outline-offset:3px; }

@media (max-width:820px){
  .catalog-search{ padding:20px; }
  .catalog-sort{ width:100%; justify-content:space-between; flex-wrap:wrap; }
}
@media (max-width:640px){
  .catalog-search{ padding:18px; gap:14px; }
  .catalog-search__controls{ flex-direction:column; align-items:stretch; }
  .catalog-sort{ flex-direction:column; align-items:stretch; gap:6px; }
  .catalog-sort__label{ margin-bottom:0; }
}
@media (max-width:480px){
  .bibliotheca-hero{ margin:40px auto 28px; }
  .catalog-section{ margin-bottom:72px; }
  .catalog-search{ padding:16px; }
}


/* ===== Testimonials ===== */
.testimonials-hero{ margin:16px 0 32px; display:flex; justify-content:center; position:relative; }
.testimonials-hero img{ max-width:min(960px, 100%); width:100%; height:auto; border-radius:16px; box-shadow:0 12px 40px rgba(17,24,39,0.18); }

.testimonials-hero--collage{ margin:24px 0 48px; padding:0 24px; }
.testimonials-hero--collage::before,
.testimonials-hero--collage::after{
  content:"";
  position:absolute;
  inset:0;
  max-width:min(980px, 100%);
  margin:0 auto;
  border-radius:28px;
  pointer-events:none;
}
.testimonials-hero--collage::before{
  background:linear-gradient(135deg, rgba(59,130,246,0.25), rgba(14,116,144,0.18));
  transform:rotate(4deg);
  opacity:.7;
  z-index:0;
}
.testimonials-hero--collage::after{
  background:rgba(255,255,255,0.88);
  transform:rotate(-3deg);
  box-shadow:0 32px 64px rgba(15,23,42,0.25);
  z-index:1;
}
.testimonials-hero--collage img{
  position:relative;
  z-index:2;
  border-radius:26px;
  transform:rotate(-2.6deg);
  box-shadow:0 28px 70px rgba(15,23,42,0.35);
}

.testimonials-board{ position:relative; padding-bottom:120px; }
.testimonials-board--collage{ padding-bottom:180px; }

.testimonials-feed{
  max-width:960px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.testimonials-feed--collage{
  display:block;
  max-width:1280px;
  margin:0 auto;
  column-width:300px;
  column-gap:0;
  padding:56px 28px 120px;
  position:relative;
}
.testimonials-feed--collage .testimonial-card{
  display:inline-block;
  width:100%;
  margin:0 0 42px;
  break-inside:avoid;
  break-inside:avoid-column;
}
.testimonials-feed--collage .feed-sentinel{
  display:block;
  width:100%;
  height:1px;
  margin:0;
  break-inside:avoid;
}

@media (max-width:1180px){
  .testimonials-feed--collage{ column-width:260px; padding-left:20px; padding-right:20px; }
}

@media (max-width:960px){
  .testimonials-feed--collage{ column-count:2; column-width:240px; }
}

@media (max-width:640px){
  .testimonials-feed--collage{ column-count:1; column-width:auto; column-gap:0; padding:32px 12px 88px; }
  .testimonials-feed--collage .testimonial-card{ margin-bottom:36px; }
}

.testimonials-board--collage .feed-status{ max-width:1280px; }

@media (max-width:720px){
  .testimonials-board{ padding-bottom:150px; }
}

.feed-status{ margin:12px auto 0; text-align:center; color:var(--muted); font-size:14px; min-height:20px; max-width:960px; }

.feed-sentinel{ width:100%; height:1px; }

.testimonial-card{ position:relative; background:#fff; border-radius:16px; border:2px solid #e5e7eb; padding:18px 18px 16px; display:flex; flex-direction:column; gap:14px; box-shadow:0 6px 20px rgba(17,24,39,0.07); transition:box-shadow .24s ease; }
.testimonial-card.pinned{ border-color:var(--banner); box-shadow:0 10px 26px rgba(44,58,91,0.22); }

.testimonial-card__badge{ position:absolute; top:14px; left:14px; background:var(--banner); color:#fff; font-size:12px; font-weight:700; letter-spacing:.4px; padding:4px 8px; border-radius:999px; text-transform:uppercase; }

.testimonial-card__image{ background:#fff; padding:12px; border-radius:12px; display:flex; justify-content:center; align-items:center; min-height:160px; }
.testimonial-card__image img{ width:100%; height:auto; max-height:420px; object-fit:contain; border-radius:10px; background:#fff; }

.testimonial-card__details{ display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:12px; color:#374151; font-size:14px; }
.testimonial-card__meta{ display:flex; flex-direction:column; gap:2px; }
.testimonial-card__name{ font-weight:700; }
.testimonial-card__date{ color:var(--muted); font-size:13px; }

.testimonial-card__actions{ display:flex; align-items:center; gap:16px; margin-left:auto; }
.testimonial-card__upload{ margin-top:auto; display:flex; }
.testimonial-upload{ background-color:transparent; color:var(--banner); border:1px solid rgba(55,65,81,0.3); border-radius:999px; padding:6px 14px; font-size:13px; font-weight:600; letter-spacing:.2px; text-transform:lowercase; cursor:pointer; transition:background-color .18s ease, border-color .18s ease, color .18s ease; }
.testimonial-upload:hover:not(:disabled){ border-color:rgba(44,58,91,0.6); color:var(--navy); }
.testimonial-upload:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; }
.testimonial-upload:disabled{ cursor:progress; opacity:.6; }

.testimonial-like{ display:inline-flex; align-items:center; gap:6px; border:0; background:transparent; color:var(--banner); font-weight:700; font-size:16px; cursor:pointer; padding:4px 6px; border-radius:999px; transition:background .15s ease, color .15s ease; }
.testimonial-like[aria-pressed="true"]{ background:rgba(44,58,91,0.12); color:var(--banner); }
.testimonial-like:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; }

.testimonial-share{ color:var(--banner); font-weight:600; font-size:15px; text-decoration:none; position:relative; padding-bottom:2px; border:0; background:transparent; cursor:pointer; }
.testimonial-share::after{ content:""; position:absolute; left:0; right:0; bottom:0; height:2px; background:var(--banner); opacity:.4; transition:opacity .2s ease; }
.testimonial-share:hover::after, .testimonial-share:focus-visible::after{ opacity:1; }

.testimonial-card--collage{
  --tilt:-5deg;
  --collage-offset-x:-32px;
  --collage-offset-y:12px;
  --collage-pop:0px;
  --collage-layer:12;
  --collage-scale:1;
  --collage-accent:linear-gradient(135deg, rgba(148,163,184,0.32), rgba(241,245,249,0.4));
  --collage-paper:linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  --collage-paper-border:rgba(148,163,184,0.28);
  --collage-tape:linear-gradient(130deg, rgba(255,255,255,0.72), rgba(148,163,184,0.35));
  --collage-tape-angle:-8deg;
  --collage-pin-bg:rgba(30,41,59,0.88);
  --collage-pin-fg:#f8fafc;
  --collage-caption-gap:28px;
  position:relative;
  display:block;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  margin:0 0 28px;
  padding-bottom:0;
  transition:transform .28s ease, filter .28s ease;
  transform:translate3d(
    calc(var(--collage-offset-x) * var(--collage-scale)),
    calc(var(--collage-offset-y) * var(--collage-scale) + var(--collage-pop)),
    0
  );
  z-index:calc(10 + var(--collage-layer));
}
.testimonial-card--collage:nth-of-type(6n+1){
  --tilt:-6.6deg;
  --collage-offset-x:-52px;
  --collage-offset-y:-18px;
  --collage-layer:18;
  --collage-accent:linear-gradient(135deg, rgba(248,113,113,0.26), rgba(251,191,36,0.18));
  --collage-paper:linear-gradient(135deg, #fff9db, #fef3c7);
  --collage-paper-border:rgba(217,119,6,0.35);
  --collage-tape:linear-gradient(125deg, rgba(254,243,199,0.7), rgba(249,115,22,0.45));
  --collage-tape-angle:-10deg;
  --collage-pin-bg:rgba(217,119,6,0.9);
  --collage-pin-fg:#fffdf5;
}
.testimonial-card--collage:nth-of-type(6n+2){
  --tilt:5.4deg;
  --collage-offset-x:36px;
  --collage-offset-y:24px;
  --collage-layer:15;
  --collage-accent:linear-gradient(135deg, rgba(14,165,233,0.24), rgba(56,189,248,0.16));
  --collage-paper:linear-gradient(140deg, #e0f2fe, #f0f9ff);
  --collage-paper-border:rgba(14,116,144,0.3);
  --collage-tape:linear-gradient(125deg, rgba(191,219,254,0.7), rgba(56,189,248,0.45));
  --collage-tape-angle:9deg;
  --collage-pin-bg:rgba(14,116,144,0.85);
  --collage-pin-fg:#f0f9ff;
}
.testimonial-card--collage:nth-of-type(6n+3){
  --tilt:-4.6deg;
  --collage-offset-x:-18px;
  --collage-offset-y:18px;
  --collage-layer:14;
  --collage-accent:linear-gradient(135deg, rgba(236,72,153,0.24), rgba(244,114,182,0.12));
  --collage-paper:linear-gradient(140deg, #fde2e4, #fff1f5);
  --collage-paper-border:rgba(190,24,93,0.28);
  --collage-tape:linear-gradient(125deg, rgba(251,207,232,0.75), rgba(244,114,182,0.45));
  --collage-tape-angle:-4deg;
  --collage-pin-bg:rgba(190,24,93,0.86);
  --collage-pin-fg:#fff7fb;
}
.testimonial-card--collage:nth-of-type(6n+4){
  --tilt:6.8deg;
  --collage-offset-x:48px;
  --collage-offset-y:-12px;
  --collage-layer:17;
  --collage-accent:linear-gradient(135deg, rgba(74,222,128,0.22), rgba(34,197,94,0.12));
  --collage-paper:linear-gradient(140deg, #dcfce7, #ecfdf5);
  --collage-paper-border:rgba(22,163,74,0.27);
  --collage-tape:linear-gradient(125deg, rgba(187,247,208,0.7), rgba(74,222,128,0.42));
  --collage-tape-angle:7deg;
  --collage-pin-bg:rgba(22,163,74,0.82);
  --collage-pin-fg:#f0fdf4;
}
.testimonial-card--collage:nth-of-type(6n+5){
  --tilt:-7.4deg;
  --collage-offset-x:-6px;
  --collage-offset-y:32px;
  --collage-layer:16;
  --collage-accent:linear-gradient(135deg, rgba(167,139,250,0.26), rgba(129,140,248,0.16));
  --collage-paper:linear-gradient(140deg, #ede9fe, #f5f3ff);
  --collage-paper-border:rgba(109,40,217,0.32);
  --collage-tape:linear-gradient(125deg, rgba(221,214,254,0.72), rgba(129,140,248,0.45));
  --collage-tape-angle:-12deg;
  --collage-pin-bg:rgba(109,40,217,0.84);
  --collage-pin-fg:#f5f3ff;
}
.testimonial-card--collage:nth-of-type(6n){
  --tilt:4.8deg;
  --collage-offset-x:22px;
  --collage-offset-y:-26px;
  --collage-layer:19;
  --collage-accent:linear-gradient(135deg, rgba(251,146,60,0.24), rgba(254,202,202,0.16));
  --collage-paper:linear-gradient(140deg, #fee2e2, #fff5f5);
  --collage-paper-border:rgba(220,38,38,0.26);
  --collage-tape:linear-gradient(125deg, rgba(254,215,170,0.7), rgba(251,191,36,0.45));
  --collage-tape-angle:5deg;
  --collage-pin-bg:rgba(194,65,12,0.88);
  --collage-pin-fg:#fff7ed;
}

.testimonial-card--collage .testimonial-card__badge{
  top:26px;
  left:26px;
  transform:rotate(calc(var(--tilt) * -1.1));
  box-shadow:0 14px 28px rgba(15,23,42,0.35);
}

.testimonial-card--collage .testimonial-card__image{
  position:relative;
  border-radius:24px;
  overflow:hidden;
  padding:56px 32px var(--collage-caption-gap);
  background:var(--collage-paper);
  border:1px solid var(--collage-paper-border);
  box-shadow:0 28px 64px rgba(15,23,42,0.28);
  transform:rotate(var(--tilt));
  transition:transform .28s ease, box-shadow .28s ease;
  cursor:zoom-in;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:0;
}
.testimonial-card--collage .testimonial-card__image img{
  width:100%;
  height:auto;
  max-height:none;
  border-radius:14px;
  background:transparent;
  box-shadow:0 0 0 1px rgba(15,23,42,0.08);
}

.testimonial-card--collage .testimonial-card__byline{
  margin:var(--collage-caption-gap) 0 0;
  text-align:center;
  font-weight:600;
  font-size:16px;
  line-height:1.4;
  color:#0f172a;
  width:100%;
}

.testimonial-card--collage .testimonial-like--floating,
.testimonial-card--collage .testimonial-share--floating{
  position:absolute;
  top:16px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 6px;
  border-radius:999px;
  background:transparent;
  color:var(--collage-pin-bg);
  border:0;
  box-shadow:none;
  font-weight:700;
  font-size:15px;
  text-decoration:none;
  pointer-events:auto;
  z-index:3;
  transition:transform .2s ease, color .2s ease, opacity .2s ease;
}
.testimonial-card--collage .testimonial-like--floating{ left:18px; }
.testimonial-card--collage .testimonial-share--floating{ right:18px; }
.testimonial-card--collage .testimonial-share--floating::after{ display:none; }
.testimonial-card--collage .testimonial-like--floating:hover,
.testimonial-card--collage .testimonial-share--floating:hover{
  transform:translateY(-1px);
  opacity:0.85;
}
.testimonial-card--collage .testimonial-like--floating:focus-visible,
.testimonial-card--collage .testimonial-share--floating:focus-visible{
  outline:2px solid var(--collage-pin-bg);
  outline-offset:3px;
}
.testimonial-card--collage .testimonial-like--floating[aria-pressed="true"]{
  color:#1f2937;
}

@media (max-width:960px){
  .testimonial-card--collage{ --collage-scale:.65; padding-bottom:72px; --collage-caption-gap:26px; }
}

@media (max-width:720px){
  .testimonial-card--collage{ --collage-scale:.45; padding-bottom:60px; --collage-caption-gap:24px; }
  .testimonial-card--collage .testimonial-like--floating,
  .testimonial-card--collage .testimonial-share--floating{ top:14px; }
  .testimonial-card--collage .testimonial-card__image{ padding:52px 28px var(--collage-caption-gap); }
}

@media (max-width:640px){
  .testimonial-card--collage{ --collage-scale:.3; margin-bottom:64px; padding-bottom:56px; --collage-caption-gap:22px; }
  .testimonial-card--collage .testimonial-card__image{ padding:48px 24px var(--collage-caption-gap); }
}

@media (max-width:520px){
  .testimonial-card--collage{ --collage-scale:0; margin-bottom:56px; padding-bottom:48px; --collage-caption-gap:18px; }
  .testimonial-card--collage .testimonial-card__image{ padding:44px 18px var(--collage-caption-gap); }
  .testimonial-card--collage .testimonial-like--floating{ left:18px; }
  .testimonial-card--collage .testimonial-share--floating{ right:18px; }
}

.testimonial-card--collage:hover,
.testimonial-card--collage:focus-within{
  --collage-pop:-10px;
  filter:drop-shadow(0 26px 54px rgba(15,23,42,0.28));
}
.testimonial-card--collage:hover .testimonial-card__image,
.testimonial-card--collage:focus-within .testimonial-card__image{
  transform:translateY(-8px) scale(1.02) rotate(var(--tilt));
  box-shadow:0 32px 72px rgba(15,23,42,0.34);
}
.testimonial-card--collage.pinned .testimonial-card__image{
  box-shadow:0 24px 64px rgba(59,130,246,0.32);
}
.testimonial-card--collage.highlight .testimonial-card__image{
  box-shadow:0 0 0 4px rgba(59,130,246,0.5), 0 32px 70px rgba(59,130,246,0.35);
}

.testimonial-card--collage.testimonial-card--expanded{
  --collage-pop:0px;
  --collage-scale:1;
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  width:min(92vw, 1100px);
  max-height:92vh;
  overflow:auto;
  margin:0;
  padding:32px 36px 40px;
  padding-bottom:0;
  display:flex;
  flex-direction:column;
  gap:24px;
  z-index:990;
  filter:none;
}
.testimonial-card--collage.testimonial-card--expanded .testimonial-card__badge{
  top:40px;
  left:48px;
  transform:none;
}
.testimonial-card--collage.testimonial-card--expanded .testimonial-card__image{
  transform:none;
  padding:0;
  border-radius:24px;
  box-shadow:0 36px 70px rgba(15,23,42,0.5);
  cursor:zoom-out;
}
.testimonial-card--collage.testimonial-card--expanded .testimonial-card__image img{
  width:100%;
  max-height:80vh;
  height:auto;
  object-fit:contain;
}
.testimonial-card--collage.testimonial-card--expanded .testimonial-like--floating,
.testimonial-card--collage.testimonial-card--expanded .testimonial-share--floating{
  position:absolute;
  top:32px;
  box-shadow:none;
}
.testimonial-card--collage.testimonial-card--expanded .testimonial-like--floating{ left:36px; }
.testimonial-card--collage.testimonial-card--expanded .testimonial-share--floating{ right:36px; }

body.is-collage-expanded{ overflow:hidden; }
body.is-collage-expanded::before{
  content:"";
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.6);
  z-index:980;
  pointer-events:none;
}
body.is-collage-expanded .testimonials-fab{
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
}

.testimonials-fab{ position:fixed; right:32px; bottom:32px; display:inline-flex; align-items:center; gap:12px; padding:14px 22px; border-radius:999px; background:var(--banner); color:#fff; border:0; box-shadow:0 16px 30px rgba(44,58,91,0.35); font-weight:700; font-size:16px; cursor:pointer; z-index:200; transition:opacity .2s ease, transform .2s ease; }
.testimonials-fab .fab-icon{ width:34px; height:34px; border-radius:50%; background:#fff; color:var(--banner); display:inline-flex; align-items:center; justify-content:center; font-size:24px; font-weight:700; }
.testimonials-fab .fab-label{ white-space:nowrap; }
.testimonials-fab:focus-visible{ outline:3px solid #fff; outline-offset:4px; }

@media (max-width:720px){
  .testimonials-fab{ left:50%; right:auto; transform:translateX(-50%); bottom:24px; padding:12px 18px; font-size:15px; }
  .testimonials-fab .fab-label{ white-space:normal; }
}

.testimonials-modal{ border:0; padding:0; border-radius:18px; max-width:min(680px, 92vw); }
.testimonials-modal::backdrop{ background:rgba(15,23,42,0.45); }
.modal-surface{ position:relative; padding:28px 28px 24px; display:flex; flex-direction:column; gap:18px; background:#f9fafb; border-radius:18px; min-width:clamp(280px, 70vw, 640px); }
.modal-close{ position:absolute; top:16px; left:16px; border:0; background:rgba(44,58,91,0.1); width:36px; height:36px; border-radius:50%; font-size:22px; font-weight:700; color:var(--banner); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.modal-close:focus-visible{ outline:2px solid var(--banner); outline-offset:2px; }

.commenter-label{ font-weight:700; margin:0; }
.comment-modal__alerts{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; min-height:36px; }
.comment-modal__alerts p{ margin:0; font-size:13px; }
.comment-modal__alerts[aria-live]{ width:100%; }

.comment-modal{ --comment-modal-spacing-adjust:8px; }
.comment-modal #comment-modal-title{ margin:calc(16px + var(--comment-modal-spacing-adjust)) 0 0; }
.comment-modal .modal-surface{ gap:6px; }
.comment-modal .commenter-label{ margin:calc(12px - var(--comment-modal-spacing-adjust)) 0 0; }
.comment-modal .comment-modal__alerts{ min-height:0; }
.comment-modal .sentence-bar{ margin:0; }
.comment-modal .sentence-bar textarea{ min-height:88px; padding:16px 140px 16px 12px; }
.comment-modal .sentence-guidance{ margin-top:6px; }

.preview-modal{ --preview-modal-spacing-adjust:8px; }
.preview-modal #preview-title{ margin:calc(16px + var(--preview-modal-spacing-adjust)) 0 0; }
.preview-modal .modal-surface{ gap:6px; }
.preview-modal .commenter-label{ margin:calc(12px - var(--preview-modal-spacing-adjust)) 0 6px; }
.preview-modal .preview-guidance{ margin:6px 0 0; }

.sentence-guidance{ color:#047857; font-weight:600; margin:0; font-size:14px; }

.preview-frame{ background:#fff; border-radius:14px; padding:18px; display:flex; justify-content:center; align-items:center; min-height:220px; }
.preview-frame img{ max-width:100%; height:auto; border-radius:12px; }

.modal-actions{ display:flex; gap:12px; justify-content:flex-end; flex-wrap:wrap; }
.modal-actions .pill{ font-weight:700; }

.pill.primary{ background:var(--banner); color:#fff; border-color:var(--banner); }
.pill.primary:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

.login-modal .modal-actions{ justify-content:flex-start; }
.login-modal .pill{ text-decoration:none; text-align:center; }

@media (max-width:540px){
  .modal-surface{ padding:24px 20px 20px; }
  .modal-close{ top:12px; left:12px; }
  .comment-modal__alerts{ align-items:flex-start; }
  .testimonials-modal{ max-width:92vw; }
}


.testimonial-card.highlight{ box-shadow:0 0 0 3px rgba(44,58,91,0.35), 0 12px 28px rgba(44,58,91,0.25); transition:box-shadow .4s ease; }

/* ===== Customers page ===== */
.customers-page{
  max-width:1200px;
  margin:0 auto 96px;
  display:flex;
  flex-direction:column;
  gap:72px;
  padding-bottom:24px;
}

.customers-hero{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:24px;
}

@media (max-width:1200px){
  .customers-hero{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width:720px){
  .customers-hero{ grid-template-columns:1fr; }
}

.customer-promo{
  background:var(--white-1);
  border-radius:28px;
  padding:32px 28px;
  box-shadow:0 20px 45px rgba(15,23,42,0.08);
  border:1px solid rgba(44,58,91,0.08);
  display:flex;
  flex-direction:column;
  gap:18px;
  align-items:flex-start;
  position:relative;
  overflow:hidden;
  min-height:100%;
}

.customer-promo--parents{ background:var(--white-2); }
.customer-promo--researchers{ background:var(--white-3); }
.customer-promo--gamers{ background:var(--white-2); }

.customer-promo__icon{
  width:96px;
  height:96px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0));
  box-shadow:0 16px 32px rgba(15,23,42,0.22);
}

.customer-promo__icon svg{ width:84px; height:84px; }

.customer-promo__title{
  margin:0;
  font-size:1.35rem;
  color:var(--banner);
}

.customer-promo p{
  margin:0;
  line-height:1.6;
  color:#475569;
}

.customer-promo__cta{
  margin-top:auto;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:12px 20px;
  border-radius:999px;
  font-weight:600;
  font-size:0.98rem;
  background:var(--banner);
  color:#fff;
  text-decoration:none;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.customer-promo__cta::after{
  content:"→";
  transition:transform .15s ease;
}

.customer-promo__cta:hover,
.customer-promo__cta:focus-visible{
  transform:translateY(-1px);
  box-shadow:0 18px 36px rgba(15,23,42,0.2);
}

.customer-promo__cta:hover::after,
.customer-promo__cta:focus-visible::after{
  transform:translateX(4px);
}

.customer-promo__cta:focus-visible{
  outline:2px solid #fff;
  outline-offset:2px;
}

.customer-section{
  background:var(--white-2);
  border-radius:32px;
  padding:56px 48px;
  box-shadow:0 26px 60px rgba(15,23,42,0.1);
  border:1px solid rgba(44,58,91,0.08);
  scroll-margin-top:calc(var(--sb-header-h) + 24px);
}

.customer-section--teachers{ background:var(--white-1); }
.customer-section--researchers{ background:var(--white-3); }
.customer-section--gamers{ background:var(--white-1); }

.customer-section__inner{
  display:grid;
  grid-template-columns:minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap:40px;
  align-items:center;
}

@media (max-width:960px){
  .customer-section__inner{ grid-template-columns:1fr; }
}

.customer-section__eyebrow{
  margin:0 0 10px;
  text-transform:uppercase;
  letter-spacing:.18em;
  font-size:12px;
  font-weight:700;
  color:var(--muted);
}

.customer-section__title{
  margin:0 0 18px;
  font-size:clamp(1.8rem, 4vw, 2.3rem);
  color:var(--banner);
}

.customer-section__text p{
  margin:0 0 16px;
  line-height:1.7;
  color:#475569;
}

.customer-section__list{
  margin:24px 0 0;
  padding-left:20px;
  display:grid;
  gap:12px;
  color:#1f2937;
}

.customer-section__list strong{ color:var(--banner); }

.customer-section__media{
  margin:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
}

.customer-section__cta-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 20px;
  border-radius:999px;
  background:var(--banner);
  color:#fff;
  font-weight:600;
  font-size:0.95rem;
  text-decoration:none;
  box-shadow:0 10px 24px rgba(44,58,91,0.18);
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.customer-section__cta-button:hover,
.customer-section__cta-button:focus-visible{
  transform:translateY(-1px);
  box-shadow:0 16px 32px rgba(44,58,91,0.24);
}

.customer-section__cta-button:focus-visible{
  outline:3px solid #fff;
  outline-offset:3px;
}

.image-placeholder{
  width:100%;
  aspect-ratio:3/2;
  border-radius:24px;
  background:linear-gradient(135deg, rgba(44,58,91,0.16), rgba(44,58,91,0.05));
  border:1px dashed rgba(44,58,91,0.35);
  color:rgba(44,58,91,0.7);
  display:flex;
  align-items:center;
  justify-content:center;
  text-transform:uppercase;
  letter-spacing:0.08em;
  font-weight:600;
  font-size:0.85rem;
  text-align:center;
  padding:12px;
}

@media (max-width:720px){
  .customers-page{ gap:56px; margin-bottom:72px; }
  .customer-section{ padding:44px 28px; }
  .customer-promo{ padding:28px 24px; }
  .customer-promo__icon{ width:88px; height:88px; }
  .customer-promo__icon svg{ width:78px; height:78px; }
}

