/* =========================================================
   Security Advisor Hub — Theme CSS (DROP-IN REPLACE)
   Scoped to: body.sah
   ========================================================= */

/* =========================================================
   Palette compatibility layer (maps SAB palette -> system tokens)
   ========================================================= */
body.sah{
  --color-primary: var(--primary);
  --color-primary-rgb: var(--rgb-primary);

  --color-bg: var(--light);
  --color-bg-secondary: var(--light-l2);
  --color-text: var(--dark);

  --color-text-secondary: color-mix(in srgb, var(--dark) 55%, var(--light));
  --color-border: color-mix(in srgb, var(--tertiary) 85%, var(--light));
  --card-bg: var(--secondary-l3);

  --color-shadow: rgba(0,0,0,.18);

  --sah-radius-sm: 10px;
  --sah-radius-md: 14px;
  --sah-radius-lg: 18px;

  --sah-border: color-mix(in srgb, var(--color-border) 85%, transparent);
  --sah-surface: var(--card-bg);
  --sah-surface-2: var(--color-bg-secondary);

  --sah-shadow-1: 0 1px 2px var(--color-shadow);
  --sah-shadow-2: 0 14px 38px color-mix(in srgb, var(--color-shadow) 60%, transparent);

  --sah-focus: 0 0 0 .25rem rgba(var(--color-primary-rgb), .18);
  --sah-focus-border: rgba(var(--color-primary-rgb), .35);

  --sah-hero-h: min(70vh, 720px);
  --sah-hero-overlay-w: min(920px, 92vw);
  --sah-hero-overhang: clamp(3.25rem, 6vw, 5rem);
}

/* =========================================================
   Page background
   ========================================================= */
body.sah .content-stack.content-dynamic-list{
  background: var(--color-bg);
}

/* =========================================================
   HERO: full-bleed image + centered overlay that straddles boundary
   ========================================================= */
body.sah .sah-hero{
  position: relative;
  min-height: var(--sah-hero-h);
  /* overflow: clip; */
  background: #0b1320;
}

body.sah .sah-hero-bg{
  position: absolute;
  inset: 0;
  background-image: var(--sah-hero-bg);
  background-size: cover;
  background-position: center;
  transform: scale(1.01);
}

/* readability wash */
body.sah .sah-hero::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(900px 520px at 25% 70%, rgba(255,255,255,.16) 0%, transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.15) 55%, rgba(0,0,0,.35) 100%);
  pointer-events:none;
}

/* overlay wrapper sits at bottom and is centered */
body.sah .sah-hero-overlay-wrap{
  position:absolute;
  left:0; right:0;
  bottom:0;
  z-index: 2;
  display:flex;
  justify-content:center;
}

/* This creates the “50% in hero, 50% below hero” feel */
body.sah .sah-hero-overlay{
  width: var(--sah-hero-overlay-w);
  max-width: 100%;
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--sah-surface) 88%, transparent) 0%,
    color-mix(in srgb, var(--sah-surface) 28%, transparent) 55%,
    color-mix(in srgb, var(--sah-surface) 14%, transparent) 100%
  );

  /* (optional but recommended) slight saturation bump so blur looks richer */
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);

  border: 1px solid color-mix(in srgb, var(--sah-border) 70%, transparent);
  border-radius: var(--sah-radius-lg);
  box-shadow: var(--sah-shadow-2);
  padding: clamp(1.25rem, 2.2vw, 1.75rem);
  transform: translateY(var(--sah-hero-overhang));
  margin: 0 auto;
}

body.sah .sah-hero-overlay .theme-gradient{
  background-size: 120% 120%;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 1px rgba(0,0,0,.06);
}

/* push content below hero so overlay doesn’t collide */
body.sah #sah-reviews{
  padding-top: calc(var(--sah-hero-overhang) + 1.25rem);
}

/* Badge in overlay */
body.sah .sah-hero-overlay .badge.text-bg-light.border{
  border-color: var(--sah-border) !important;
  background: color-mix(in srgb, var(--sah-surface) 90%, transparent) !important;
  color: var(--color-text) !important;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .35rem .7rem;
  border-radius: 999px;
}

/* hero typography */
body.sah .sah-hero-overlay h1.display-5{
  letter-spacing: -0.02em;
  color: var(--primary);
}
body.sah .sah-hero-overlay p.lead{
  color: color-mix(in srgb, var(--color-text) 78%, var(--color-text-secondary));
  line-height: 1.6;
  max-width: 62ch;
}

/* =========================================================
   Pills + microcopy
   ========================================================= */
body.sah .sah-mini{
  font-size: .95rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

body.sah .sah-pill{
  appearance: none;
  border: 1px solid var(--sah-border);
  background: color-mix(in srgb, var(--sah-surface) 92%, transparent);
  color: var(--color-text);
  padding: .42rem .72rem;
  border-radius: 999px;
  font-size: .92rem;
  line-height: 1;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
body.sah .sah-pill:hover{
  transform: translateY(-1px);
  box-shadow: var(--sah-shadow-1);
  border-color: color-mix(in srgb, var(--color-primary) 32%, var(--sah-border));
}
body.sah .sah-pill:active{ transform: translateY(0); }
body.sah .sah-pill:focus-visible{
  outline: none;
  box-shadow: var(--sah-focus);
  border-color: var(--sah-focus-border);
}
body.sah .sah-pill-clear{
  border-color: color-mix(in srgb, var(--color-text-secondary) 35%, var(--sah-border));
  background: var(--sah-surface-2);
}

/* =========================================================
   Filters layout: keep wrapped pills left-aligned
   + Clear pinned bottom-right
   ========================================================= */
body.sah .sah-filter-wrap{
  display: flex;
  gap: .75rem;
  align-items: flex-end; /* Clear sits at bottom-right */
}

body.sah .sah-filter-groups{
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: .55rem;
}

body.sah .sah-filter-row{
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}

body.sah .sah-filter-label{
  flex: 0 0 auto;
  min-width: 92px; /* aligns Scenario/Decision labels */
  margin-top: .2rem;
}

body.sah .sah-filter-pills{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; /* key: no space distribution on wrap */
  align-content: flex-start;
  gap: .5rem;
}

body.sah .sah-filter-clear{
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

/* small screens: Clear moves to its own line, stays right-aligned */
@media (max-width: 640px){
  body.sah .sah-filter-wrap{
    flex-direction: column;
    align-items: stretch;
  }
  body.sah .sah-filter-clear{
    justify-content: flex-end;
  }
  body.sah .sah-filter-label{
    min-width: 78px;
  }
}

/* =========================================================
   Sidebar: framed cards
   ========================================================= */
body.sah #sah-reviews .sidebar{
  display: grid;
  gap: 1rem;
}

body.sah .sah-aside-card{
  border-radius: var(--sah-radius-md);
  border: 1px solid var(--sah-border);
  background: color-mix(in srgb, var(--sah-surface) 94%, transparent);
  box-shadow: var(--sah-shadow-1);
  padding: 1.1rem 1.1rem;
}

body.sah .sah-soft{
  background: color-mix(in srgb, var(--color-primary) 5%, var(--sah-surface));
  border: 1px solid color-mix(in srgb, var(--color-primary) 16%, var(--sah-border));
}

/* Step list with numbered circles */
body.sah .sah-steps{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}
body.sah .sah-steps li{
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: .75rem;
  align-items: start;
}
body.sah .sah-step-num{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
  font-size: .9rem;
  color: color-mix(in srgb, var(--color-primary) 85%, var(--color-text));
  background: color-mix(in srgb, var(--color-primary) 10%, var(--sah-surface));
  border: 1px solid color-mix(in srgb, var(--color-primary) 18%, var(--sah-border));
}
body.sah .sah-step-text{
  color: var(--color-text-secondary);
  line-height: 1.55;
  font-size: .95rem;
}

/* Sidebar buttons */
body.sah #sah-reviews .btn{
  border-radius: 999px;
  padding: .7rem 1rem;
  font-weight: 800;
  letter-spacing: .01em;
}
body.sah #sah-reviews .btn:focus-visible{
  outline: none;
  box-shadow: var(--sah-focus);
}
body.sah #sah-reviews .btn.btn-primary{
  background: var(--color-primary);
  border-color: color-mix(in srgb, var(--color-primary) 85%, #000);
}
body.sah #sah-reviews .btn.btn-primary:hover{
  filter: brightness(1.04);
  box-shadow: var(--sah-shadow-1);
}
body.sah #sah-reviews .btn.btn-outline-primary{
  color: var(--color-primary);
  border-color: color-mix(in srgb, var(--color-primary) 55%, var(--sah-border));
  background: color-mix(in srgb, var(--sah-surface) 78%, transparent);
}
body.sah #sah-reviews .btn.btn-outline-primary:hover{
  background: color-mix(in srgb, var(--color-primary) 6%, var(--sah-surface));
  border-color: color-mix(in srgb, var(--color-primary) 65%, var(--sah-border));
  box-shadow: var(--sah-shadow-1);
}

/* =========================================================
   List chrome
   ========================================================= */
body.sah .con-container{ background: transparent; }

body.sah .con-body{
  margin-top: .75rem;
  border-radius: var(--sah-radius-md);
  background: transparent;
}

/* DevExtreme search */
body.sah .con-container .dx-texteditor{
  border-radius: 12px;
  background: var(--sah-surface);
}
body.sah .con-container .dx-texteditor.dx-state-focused{
  box-shadow: var(--sah-focus);
  border-color: var(--sah-focus-border);
}

/* =========================================================
   Review cards: logo LEFT, image top-aligned, CTA bottom-right
   ========================================================= */
body.sah .card.card-solution{
  border-radius: var(--sah-radius-md);
  border: 1px solid var(--sah-border);
  background: color-mix(in srgb, var(--sah-surface) 96%, transparent);
  box-shadow: var(--sah-shadow-1);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
body.sah .card.card-solution:hover{
  transform: translateY(-3px);
  box-shadow: var(--sah-shadow-2);
  border-color: color-mix(in srgb, var(--color-primary) 20%, var(--sah-border));
}

/* Force wide layout into a row */
body.sah .card-layout-wide{
  display: flex;
  flex-direction: row;
  align-items: stretch;
  margin: 1rem 0;
}

/* LEFT logo column */
body.sah .card-layout-wide.has-image .card-image{
  flex: 0 0 32%;
  min-width: 220px;
  min-height: 210px;

  background-size: cover;
  background-repeat: no-repeat;
  background-position: top center;

  border-right: 1px solid var(--sah-border);
  position: relative;
}

/* subtle wash so logos sit nicely */
body.sah .card-layout-wide.has-image .card-image::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(180deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.05) 55%, rgba(255,255,255,0) 100%);
  pointer-events:none;
}

/* BODY becomes a column so CTA can stick to bottom */
body.sah .card-layout-wide .card-body{
  flex: 1 1 auto;
  padding: 1rem 1.1rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  white-space: normal;
}

/* Badges */
body.sah .card-layout-wide .badge{
  font-weight: 750;
  border-radius: 999px;
  padding: .25rem .55rem;
  font-size: .78rem;
  letter-spacing: .01em;

  /* spacing when badges wrap to multiple rows */
  margin: 0 .4rem .4rem 0;
}

body.sah .card-layout-wide .badge.bg-secondary{
  background: color-mix(in srgb, var(--color-primary) 10%, var(--sah-surface-2)) !important;
  color: color-mix(in srgb, var(--color-primary) 85%, var(--color-text)) !important;
  border: 1px solid color-mix(in srgb, var(--color-primary) 20%, var(--sah-border));
}

/* Title: less harsh */
body.sah .card-layout-wide .card-title{
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin-bottom: .35rem;
  font-weight: 800;
  font-size: clamp(1.1rem, 1.25vw, 1.35rem);
}

/* Publish meta: more subtle than summary */
body.sah .card-layout-wide .text-body-secondary{
  color: color-mix(in srgb, var(--color-text-secondary) 92%, transparent) !important;
  font-size: .88rem;
  margin-bottom: .55rem !important;
}

/* Summary clamp */
body.sah .card-layout-wide .card-text{
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;

  line-height: 1.6;
  margin: .25rem 0 0 0;
  color: color-mix(in srgb, var(--color-text) 92%, transparent);
}

/* CTA pinned to bottom-right */
body.sah .card-cta-action{
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  padding-top: .6rem;
}

body.sah .card-cta-action a{
  font-weight: 900;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .55rem;
  border-radius: 999px;
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
body.sah .card-cta-action a:hover{
  background: rgba(var(--color-primary-rgb), .07);
  box-shadow: var(--sah-shadow-1);
  transform: translateY(-1px);
}
body.sah .card-cta-action a:active{ transform: translateY(0); }
body.sah .card-cta-action a:focus-visible{
  outline: none;
  box-shadow: var(--sah-focus);
}

body.sah .sah-icon-badge{
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px){
  body.sah .card-layout-wide.has-image .card-image{
    flex-basis: 36%;
    min-width: 200px;
  }
}

@media (max-width: 800px){
  body.sah .sah-hero{
    min-height: min(62vh, 620px);
  }

  body.sah .sah-hero-overlay{
    width: 94vw;
    transform: translateY(clamp(2.75rem, 7vw, 4rem));
  }

  body.sah #sah-reviews{
    padding-top: calc(clamp(2.75rem, 7vw, 4rem) + 1.15rem);
  }

  body.sah .card-layout-wide{
    flex-direction: column;
  }

  body.sah .card-layout-wide.has-image .card-image{
    width: 100%;
    min-width: 0;
    min-height: 190px;
    border-right: none;
    border-bottom: 1px solid var(--sah-border);
    background-position: top center;
  }
}

@media (max-width: 480px){
  body.sah .card-layout-wide .card-body{
    padding: .95rem;
  }
  body.sah #sah-reviews .btn{
    width: 100%;
    justify-content: center;
  }
}
