/* File: /css/ss-shell.css */
/* SafeShare Shell — MASTER FINAL v2026-03-10-02
   - Load BEFORE /css/ss-page.css
   - Top gap fixed: header top:0 + padding-top safe-area
   - Content under header fixed: body padding-top uses --ss-header-real + safe-top
   - Backdrop/sheet interaction rules live here (NOT in ss-page.css)
   - Color refresh: softer mint + lilac accents, calmer contrast, friendlier readability
   - Header brand supports title + subtitle (.ss-brand__text / __name / __sub)
*/

:root{
  --ss-shell-max: 1120px;

  --ss-space-1: .25rem;
  --ss-space-2: .5rem;
  --ss-space-3: .75rem;
  --ss-space-4: 1rem;
  --ss-space-5: 1.25rem;
  --ss-space-6: 1.5rem;

  --ss-radius-1: 8px;
  --ss-radius-2: 12px;
  --ss-radius-3: 18px;
  --ss-radius-4: 20px;
  --ss-radius-pill: 999px;

  --ss-fs-1: .92rem;
  --ss-fs-2: 1rem;
  --ss-fs-3: 1.06rem;

  /* ===== Color system ===== */
  --ss-bg: #11161d;
  --ss-bg-2: #171e27;

  --ss-text: #f2f5f8;
  --ss-muted: rgba(242,245,248,.78);
  --ss-muted-2: rgba(242,245,248,.58);

  --ss-surface: rgba(255,255,255,.055);
  --ss-surface-2: rgba(255,255,255,.032);
  --ss-surface-3: rgba(127,211,193,.08);

  --ss-border: rgba(255,255,255,.10);
  --ss-border-strong: rgba(255,255,255,.14);

  --ss-accent: #7fd3c1;
  --ss-accent-strong: #5fc2ad;
  --ss-accent-soft: rgba(127,211,193,.14);
  --ss-accent-border: rgba(127,211,193,.34);

  --ss-link: #c7b9f2;
  --ss-link-hover: #ddd3fb;
  --ss-link-soft: rgba(199,185,242,.16);

  --ss-focus: 0 0 0 3px rgba(183,167,234,.28);
  --ss-shadow-1: 0 18px 42px rgba(0,0,0,.24);

  --ss-dur-ui: 160ms;
  --ss-dur-sheet: 220ms;
  --ss-ease: ease;

  --ss-z-header: 90;
  --ss-z-backdrop: 110;
  --ss-z-sheet: 120;

  --ss-safe-top: env(safe-area-inset-top, 0px);
  --ss-header-h: 64px;

  /* JS sets this; fallback is header-h */
  --ss-header-real: var(--ss-header-h);
}

@media (max-width: 900px){
  :root{ --ss-header-h: 104px; }
}

/* Base frame (shell owns offset) */
html{
  scroll-behavior: auto;
  scroll-padding-top: calc(var(--ss-header-real) + var(--ss-safe-top));
}

body{
  padding-top: calc(var(--ss-header-real) + var(--ss-safe-top)) !important;
  background: linear-gradient(180deg, var(--ss-bg) 0%, var(--ss-bg-2) 100%);
  color: var(--ss-text);
}

/* =========================
   Header / Nav
========================= */
header.ss-shell{
  display: block;
  visibility: visible;
  opacity: 1;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--ss-z-header);

  padding-top: var(--ss-safe-top);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background:
    linear-gradient(
      to bottom,
      rgba(17,22,29,.90),
      rgba(17,22,29,.76)
    );
  border-bottom: 1px solid var(--ss-border);
}

.ss-shell{
  padding: 12px 14px 10px;
}

.ss-shell__inner{
  width: min(var(--ss-shell-max), calc(100% - 2rem));
  min-height: var(--ss-header-h);
  margin-inline: auto;

  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0,1fr) auto;
  grid-template-areas: "brand nav more";
  align-items: center;
  column-gap: .9rem;
  row-gap: .55rem;
}

@media (max-width: 720px){
  .ss-shell__inner{
    width: calc(100% - 1rem);
  }
}

/* =========================
   Brand
========================= */
.ss-brand{
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: auto;
  max-width: 100%;
  text-decoration: none;
  color: var(--ss-text);
}

.ss-brand:hover,
.ss-brand:focus-visible{
  text-decoration: none;
}

.ss-brand__mark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
  filter: none;
  -webkit-filter: none;
  overflow: hidden;
  flex: 0 0 auto;
}

.ss-brand__mark img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 18px;
}

.ss-brand__text{
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .14rem;
}

.ss-brand__name{
  display: block;
  min-width: 0;
  font-size: clamp(1.3rem, 1.05rem + 1.2vw, 2rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.02em;
  color: rgba(242,245,248,.96);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.ss-brand__sub{
  display: block;
  min-width: 0;
  font-size: clamp(.88rem, .82rem + .25vw, 1.02rem);
  line-height: 1.2;
  font-weight: 600;
  color: var(--ss-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Nav lane
========================= */
.ss-navLane{
  grid-area: nav;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-x;
}

.ss-nav{
  min-width: 0;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;

  padding-inline: .25rem;
  touch-action: pan-x;
}

.ss-nav::-webkit-scrollbar{
  height: 6px;
}

.ss-nav::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.18);
  border-radius: var(--ss-radius-pill);
}

.ss-nav__link{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: .56rem .78rem;

  border-radius: var(--ss-radius-pill);
  border: 1px solid transparent;

  white-space: nowrap;
  text-decoration: none;
  color: var(--ss-muted);

  font-size: var(--ss-fs-2);
  font-weight: 680;
  line-height: 1;

  transition:
    color var(--ss-dur-ui) var(--ss-ease),
    background var(--ss-dur-ui) var(--ss-ease),
    border-color var(--ss-dur-ui) var(--ss-ease),
    box-shadow var(--ss-dur-ui) var(--ss-ease);
}

.ss-nav__link:hover{
  color: var(--ss-text);
  background: var(--ss-surface-2);
  border-color: var(--ss-border);
}

.ss-nav__link.is-active{
  color: var(--ss-text);
  background: linear-gradient(180deg, rgba(127,211,193,.18), rgba(127,211,193,.11));
  border-color: var(--ss-accent-border);
  box-shadow:
    inset 0 0 0 1px rgba(127,211,193,.10),
    0 6px 16px rgba(0,0,0,.10);
}

/* =========================
   Actions / More
========================= */
.ss-actions,
.ss-more{
  grid-area: more;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: .35rem;
}

.ss-iconBtn{
  width: 44px;
  height: 38px;
  min-width: 44px;
  min-height: 38px;

  border-radius: var(--ss-radius-pill);
  border: 1px solid var(--ss-border);

  background: rgba(255,255,255,.025);
  color: var(--ss-text);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition:
    transform var(--ss-dur-ui) var(--ss-ease),
    background var(--ss-dur-ui) var(--ss-ease),
    border-color var(--ss-dur-ui) var(--ss-ease),
    box-shadow var(--ss-dur-ui) var(--ss-ease);
}

.ss-iconBtn:hover{
  transform: translateY(-1px);
  background: var(--ss-surface-2);
  border-color: var(--ss-accent-border);
}

.ss-iconBtn:active{
  transform: translateY(0);
}

.ss-iconBtn:focus-visible{
  outline: none;
  box-shadow: var(--ss-focus);
}

.ss-icon{
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
  opacity: .92;
}

#ssCloseBtn.ss-iconBtn{
  width: 44px;
  height: 38px;
  min-width: 44px;
  min-height: 38px;
  border-radius: var(--ss-radius-pill);
}

/* =========================
   Language dropdown
========================= */
.ss-lang{
  position: relative;
}

.ss-lang > summary{
  list-style: none;
  cursor: pointer;
}

.ss-lang > summary::-webkit-details-marker{
  display: none;
}

.ss-lang__menu{
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  min-width: 180px;
  padding: .45rem;
  border-radius: 16px;
  background: rgba(12,18,30,.98);
  border: 1px solid var(--ss-border);
  box-shadow: var(--ss-shadow-1);
  display: grid;
  gap: .25rem;
}

.ss-lang__a{
  display: block;
  padding: .75rem .85rem;
  border-radius: 12px;
  color: var(--ss-text);
  text-decoration: none;
  font-weight: 600;
}

.ss-lang__a:hover,
.ss-lang__a:focus-visible,
.ss-lang__a.is-active{
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

/* =========================
   Tablet
========================= */
@media (max-width: 1100px){
  .ss-shell__inner{
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand more"
      "nav nav";
    align-items: center;
  }

  .ss-navLane{
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
  }

  .ss-navLane::-webkit-scrollbar{
    display: none;
  }

  .ss-nav{
    width: max-content;
    min-width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    padding-left: .25rem;
    padding-right: .25rem;
    scroll-padding-left: .25rem;
  }

  .ss-nav__link{
    flex: 0 0 auto;
  }
}

/* =========================
   Mobile
========================= */
@media (max-width: 900px){
  .ss-shell__inner{
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand more"
      "nav nav";
    column-gap: .75rem;
    row-gap: .7rem;
    padding-top: .25rem;
    padding-bottom: .25rem;
    min-height: var(--ss-header-h);
  }

  .ss-brand{
    width: 100%;
    max-width: 100%;
    gap: 10px;
    overflow: visible;
  }

  .ss-brand__mark{
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .ss-brand__mark img{
    border-radius: 16px;
  }

  .ss-brand__text{
    min-width: 0;
    flex: 1 1 auto;
  }

  .ss-brand__name{
    font-size: clamp(1.2rem, 1rem + 1.4vw, 1.8rem);
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  .ss-brand__sub{
    font-size: .95rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ss-actions{
    align-self: start;
    gap: .5rem;
  }

  .ss-lang > summary{
    min-height: 38px;
    padding: .56rem .78rem;
  }

  .ss-nav__link{
    padding: .5rem .68rem;
    font-size: .96rem;
  }
}

/* Small mobile:
   Brand gets its own row,
   actions below,
   nav stays separate
*/
@media (max-width: 640px){
  .ss-shell__inner{
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand brand"
      "more more"
      "nav nav";
    row-gap: .65rem;
  }

  .ss-brand{
    justify-self: start;
    width: 100%;
  }

  .ss-brand__mark{
    width: 50px;
    height: 50px;
  }

  .ss-brand__mark img{
    border-radius: 15px;
  }

  .ss-brand__name{
    font-size: clamp(1.15rem, .95rem + 1.8vw, 1.65rem);
  }

  .ss-brand__sub{
    font-size: .92rem;
  }

  .ss-actions,
  .ss-more{
    width: 100%;
    justify-content: space-between;
    justify-self: stretch;
  }

  .ss-lang{
    flex: 1 1 auto;
  }

  .ss-lang > summary{
    width: 100%;
    justify-content: center;
  }
}

/* Very small mobile:
   allow subtitle wrapping,
   keep title visible
*/
@media (max-width: 430px){
  .ss-brand{
    align-items: flex-start;
  }

  .ss-brand__text{
    padding-top: 1px;
  }

  .ss-brand__name{
    font-size: 1.9rem;
    line-height: 1;
    white-space: nowrap;
  }

  .ss-brand__sub{
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.18;
    max-width: 100%;
  }

  .ss-nav__link{
    padding: .66rem .88rem;
  }
}

@media (max-width: 420px){
  .ss-brand__mark,
  .ss-brand__mark img{
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .ss-brand__name{
    font-size: 1.55rem;
  }

  .ss-brand__sub{
    font-size: .88rem;
  }
}

/* =========================
   More Sheet (interaction lives here)
========================= */
#ssBackdrop{
  z-index: var(--ss-z-backdrop);
}

#ssSheet{
  z-index: var(--ss-z-sheet);
}

.ss-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.34);
  z-index: var(--ss-z-backdrop);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--ss-dur-ui) var(--ss-ease), visibility 0s linear var(--ss-dur-ui);
}

.ss-backdrop.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--ss-dur-ui) var(--ss-ease), visibility 0s linear 0s;
}

.ss-sheet{
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: min(720px, calc(100% - 1rem));
  z-index: var(--ss-z-sheet);
  background: linear-gradient(180deg, rgba(23,30,39,.98), rgba(17,22,29,.99));
  border: 1px solid var(--ss-border);
  border-bottom: none;
  border-radius: var(--ss-radius-4) var(--ss-radius-4) 0 0;
  box-shadow: var(--ss-shadow-1);
  max-height: min(88dvh, 760px);
  overflow: auto;
  visibility: hidden;
  pointer-events: none;
  transition: transform var(--ss-dur-sheet) var(--ss-ease);
}

.ss-sheet.is-open{
  transform: translate(-50%, 0%);
  visibility: visible;
  pointer-events: auto;
}

.ss-sheet__grip{
  width: 46px;
  height: 5px;
  border-radius: var(--ss-radius-pill);
  background: rgba(255,255,255,.22);
  margin: .55rem auto .15rem;
}

.ss-sheet__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .8rem .35rem;
}

.ss-sheet__title{
  margin: 0;
  color: var(--ss-muted);
  font-size: var(--ss-fs-1);
  font-weight: 700;
}

.ss-sheet__body{
  padding: .45rem .6rem .95rem;
}

.ss-group{
  margin-top: .75rem;
}

.ss-group:first-child{
  margin-top: 0;
}

.ss-group__title{
  margin: 0 0 .5rem;
  padding: 0 .25rem;
  color: var(--ss-muted-2);
  font-size: var(--ss-fs-1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
}

.ss-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .35rem;
}

.ss-list__a{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .75rem;
  text-decoration: none;
  color: var(--ss-text);
  background: rgba(255,255,255,.028);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--ss-radius-2);
  padding: .72rem .8rem;
  font-weight: 650;
  transition:
    background var(--ss-dur-ui) var(--ss-ease),
    border-color var(--ss-dur-ui) var(--ss-ease),
    color var(--ss-dur-ui) var(--ss-ease);
}

.ss-list__a:hover{
  background: var(--ss-surface-2);
  border-color: rgba(199,185,242,.24);
  color: var(--ss-link-hover);
}

.ss-list__a:focus-visible{
  outline: none;
  box-shadow: var(--ss-focus);
}

/* =========================
   Footer (shell owns it)
========================= */
#ss-footer-slot{
  width: 100%;
  display: block;
  margin-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ss-siteFooter{
  width: min(var(--ss-shell-max), calc(100% - 2rem));
  margin: var(--ss-space-4) auto var(--ss-space-4);
  padding: .9rem 1rem;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-3);
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.028));
  color: var(--ss-muted);
  clear: both;
}

.ss-siteFooter__top{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .55rem .9rem;
}

.ss-siteFooter__brand{
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  color: var(--ss-text);
}

.ss-siteFooter__brandMark{
  width: 18px;
  height: 18px;
  border-radius: 4px;
  margin-right: 6px;
}

.ss-siteFooter__links{
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
}

.ss-siteFooter__links a{
  text-decoration: none;
  color: var(--ss-text);
  border: 1px solid var(--ss-border);
  background: rgba(255,255,255,.022);
  padding: .3rem .52rem;
  border-radius: var(--ss-radius-pill);
  transition:
    background var(--ss-dur-ui) var(--ss-ease),
    border-color var(--ss-dur-ui) var(--ss-ease),
    color var(--ss-dur-ui) var(--ss-ease);
}

.ss-siteFooter__links a:hover{
  background: var(--ss-link-soft);
  border-color: rgba(199,185,242,.24);
  color: var(--ss-link-hover);
}

.ss-siteFooter__links a:focus-visible{
  outline: none;
  box-shadow: var(--ss-focus);
}

/* =========================
   Global link tone
========================= */
a{
  color: var(--ss-link);
}

a:hover{
  color: var(--ss-link-hover);
}

a:focus-visible{
  outline: none;
  box-shadow: var(--ss-focus);
  border-radius: 10px;
}

/* =========================
   Utilities
========================= */
.ss-no-scroll{
  overflow: hidden !important;
  touch-action: none;
}

@media (prefers-reduced-motion: reduce){
  .ss-nav__link,
  .ss-iconBtn,
  .ss-backdrop,
  .ss-sheet{
    transition: none !important;
  }
}

/* FINAL OVERRIDE: keep offset even if later CSS tries to reset it */
html{
  scroll-padding-top: calc(var(--ss-header-real) + var(--ss-safe-top)) !important;
}

body{
  padding-top: calc(var(--ss-header-real) + var(--ss-safe-top)) !important;
}

/* =========================
   Header scroll behavior
========================= */

/* smooth transitions */
header.ss-shell{
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, border-color 180ms ease;
}

header.ss-shell .ss-shell__inner{
  transition: padding 180ms ease, min-height 180ms ease;
}

.ss-brand__mark{
  transition: width 180ms ease, height 180ms ease, border-radius 180ms ease;
}

.ss-brand__name{
  transition: font-size 180ms ease;
}

.ss-brand__sub{
  transition: font-size 180ms ease, opacity 180ms ease;
}

/* Option 1: compact */
html.ss-hdr-mode-compact.ss-hdr-compact header.ss-shell .ss-shell__inner{
  padding-top: .25rem;
  padding-bottom: .25rem;
}

html.ss-hdr-mode-compact.ss-hdr-compact .ss-brand__mark{
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

html.ss-hdr-mode-compact.ss-hdr-compact .ss-brand__mark img{
  border-radius: 12px;
}

html.ss-hdr-mode-compact.ss-hdr-compact .ss-brand__name{
  font-size: 1.05rem;
}

html.ss-hdr-mode-compact.ss-hdr-compact .ss-brand__sub{
  font-size: .82rem;
}

/* Option 2: hide on scroll down */
html.ss-hdr-mode-hide.ss-hdr-hidden header.ss-shell{
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}
