/* Shared site chrome: application header and universal footer. */

/* Application header */
.app-shell-header {
  width: 100%;
  max-width: 1280px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: var(--z-sticky, 20);
}

.app-shell-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--header-fg, #f4f4f5);
  text-decoration: none;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.app-shell-header .brand .mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
}

.app-shell-header .brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 12px;
  background: #b596c8;
  color: #2a1245;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 2px 4px rgba(42,18,69,.22), 0 4px 0 #62298a;
}

.app-shell-header .header-tools,
.app-shell-header .tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  grid-column: 3;
  justify-self: end;
  min-width: 0;
}

.app-shell-header .nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.app-shell-header .header-button,
.app-shell-header .key.icon,
.app-shell-header .theme-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(42,18,69,.62);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f2e8fa 48%, #e0cfee 100%);
  color: #2a1245;
  box-shadow: inset 0 1px 0 #fff, inset 0 -3px 0 rgba(98,41,138,.18), 0 4px 0 #62298a, 0 8px 12px rgba(42,18,69,.22);
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms cubic-bezier(.2,.8,.2,1.08), box-shadow 140ms ease, background 180ms ease, color 180ms ease;
}

.app-shell-header .header-button.lav,
.app-shell-header .key.lav {
  background: linear-gradient(180deg, #d9c2ec 0%, #bb99d2 48%, #a27cb7 100%);
  color: #2a1245;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(42,18,69,.2), 0 4px 0 #4a1d6d, 0 8px 12px rgba(42,18,69,.22);
}

.app-shell-header .header-button:hover,
.app-shell-header .key.icon:hover,
.app-shell-header .theme-toggle:hover { transform: translateY(-1px); }

.app-shell-header .header-button:active,
.app-shell-header .key.icon:active,
.app-shell-header .theme-toggle:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 5px rgba(42,18,69,.28), 0 1px 0 #62298a, 0 2px 4px rgba(42,18,69,.22);
}

.app-shell-header .header-button svg,
.app-shell-header .key svg,
.app-shell-header .theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: #2a1245;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell-header .header-button svg *,
.app-shell-header .key svg *,
.app-shell-header .theme-toggle svg * {
  stroke: #2a1245;
  fill: none;
  color: currentColor;
}

.app-shell-header .nav .key,
.app-shell-header .nav a {
  width: auto;
  height: 42px;
  min-width: 42px;
  padding: 0 16px;
  flex: 0 0 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(42,18,69,.62);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f2e8fa 48%, #e0cfee 100%);
  color: #2a1245;
  font: 800 14px/1 "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
  box-shadow: inset 0 1px 0 #fff, inset 0 -3px 0 rgba(98,41,138,.18), 0 4px 0 #62298a, 0 8px 12px rgba(42,18,69,.22);
}

.app-shell-header .nav a { gap: 8px; }
.primary-nav-icon {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell-header .nav [aria-current="page"] {
  transform: translateY(3px);
  background: linear-gradient(180deg, #d9c2ec 0%, #bb99d2 48%, #a27cb7 100%);
  box-shadow: inset 0 2px 5px rgba(42,18,69,.28), 0 1px 0 #4a1d6d;
}

.app-shell-header .header-button[aria-current="page"],
.app-shell-header .key.icon[aria-current="page"] {
  transform: translateY(3px);
  background: linear-gradient(180deg, #d9c2ec 0%, #bb99d2 48%, #a27cb7 100%);
  box-shadow: inset 0 2px 5px rgba(42,18,69,.28), 0 1px 0 #4a1d6d;
  cursor: default;
}

.app-shell-header .acct {
  height: 42px;
  min-width: 0;
  max-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 6px;
  border: 1px solid rgba(42,18,69,.62);
  border-radius: 999px;
  background: #fff;
  color: #2a1245;
}

.app-shell-header .user-initial {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #b596c8;
  color: #2a1245;
  font-size: 12px;
  font-weight: 900;
}

.app-shell-header .acct-name {
  width: 110px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #2a1245;
  font-size: 14px;
  font-weight: 800;
}

.app-shell-header svg,
.app-shell-header svg *,
.app-shell-header .theme-toggle,
.app-shell-header .header-button {
  color: #2a1245;
  fill: none;
  stroke: #2a1245;
}

@media (max-width: 800px) {
  .app-shell-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
  }
  .app-shell-header .tools,
  .app-shell-header .header-tools { gap: 6px; }
  .app-shell-header .brand-name { display: none; }
  .app-shell-header .brand { font-size: 0; }
  .app-shell-header .nav { min-width: max-content; }
  .app-shell-header .acct { max-width: 42px; padding: 6px; border-radius: 12px; }
  .app-shell-header .acct-name { display: none; }
  .app-shell-header .nav { gap: 6px; }
  .app-shell-header .nav .key,
  .app-shell-header .nav a { padding: 0 10px; }
}

@media (max-width: 560px) {
  .app-shell-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 10px 8px;
  }
  .app-shell-header .brand { grid-column: 1; grid-row: 1; }
  .app-shell-header .tools,
  .app-shell-header .header-tools { grid-column: 2; grid-row: 1; }
  .app-shell-header .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
  }
  .app-shell-header .nav .key,
  .app-shell-header .nav a { padding: 0 9px; }
}

@media (max-width: 380px) {
  .app-shell-header .nav { gap: 4px; }
  .app-shell-header .nav .key,
  .app-shell-header .nav a {
    height: 38px;
    min-width: 36px;
    padding: 0 6px;
    font-size: 12px;
  }
}

/* Universal footer and information modal */
/* ─── Universal Site Footer ─────────────────────────────────────── */
.site-footer {
  --footer-fg: var(--fg, var(--text, #f4f4f5));
  --footer-muted: var(--muted, #a1a1aa);
  --footer-border: var(--border, rgba(255, 255, 255, 0.08));
  --footer-glass: var(--glass, var(--panel, rgba(9, 9, 11, 0.5)));

  z-index: 10;
  border-top: 1px solid var(--footer-border);
  background: var(--footer-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color 300ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.site-footer--hero {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  animation: siteFooterFadeIn 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.5s both;
}

/* Sticky footer: pinned to viewport bottom when content is short */
body.has-site-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body.has-site-footer .page-shell {
  flex: 1 0 auto;
  min-height: 0;
  display: grid;
  place-items: center;
}

body.has-site-footer > .app-header,
body.has-site-footer > .top,
body.has-site-footer > main.page-content,
body.has-site-footer > .site-footer--static {
  align-self: center;
  width: var(--app-chrome-width, min(1200px, calc(100% - 48px)));
  max-width: var(--app-chrome-max, 1200px);
}

body.has-site-footer > .page {
  width: 100%;
}

.site-footer--static {
  position: relative;
  margin-top: 0;
  margin-bottom: 16px;
  flex-shrink: 0;
  min-height: 58px;
  border-radius: var(--radius-container, 16px);
  border: 1px solid var(--footer-border);
  overflow: hidden;
}

@keyframes siteFooterFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px 24px 16px;
}

.site-footer-copy {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--footer-muted);
  letter-spacing: 0.02em;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.site-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--footer-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.site-footer-link:hover,
.site-footer-link:focus-visible {
  color: var(--footer-fg);
  outline: none;
}

.site-footer-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Info modal base (landing page does not load main.css) */
.footer-info-modal.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  transition: opacity 180ms cubic-bezier(.2,.8,.2,1);
}

.footer-info-modal.custom-modal-overlay.active {
  opacity: 1;
}

.footer-info-modal .custom-modal {
  background: #ffffff;
  border: 2px solid #d9d0df;
  box-shadow: 0 8px 0 #62298a, 0 24px 48px rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  color: var(--footer-fg);
  transform: translateY(8px) scale(0.96);
  transition: transform 230ms cubic-bezier(.2,.8,.2,1.08), opacity 190ms cubic-bezier(.2,.8,.2,1);
  opacity: 0;
}

.footer-info-modal.custom-modal-overlay.active .custom-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.footer-info-modal.custom-modal-overlay.is-closing,
.footer-info-modal.custom-modal-overlay.is-closing .custom-modal { transition-duration: 140ms; }

.footer-info-modal .custom-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.footer-info-modal .custom-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: #2a1245;
}

.footer-info-modal .custom-modal-body a {
  color: var(--accent, #8b5cf6);
}

.footer-info-modal .custom-modal-actions {
  display: flex;
  justify-content: center;
}

.footer-info-modal .custom-modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.footer-info-modal .custom-modal-btn.primary {
  background: linear-gradient(180deg, #d9c2ec 0%, #bb99d2 48%, #a27cb7 100%);
  border: 2px solid rgba(42,18,69,.72);
  color: #2a1245;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(42,18,69,.18), 0 5px 0 #4a1d6d;
}

.footer-info-modal .custom-modal-btn.primary:hover {
  background: linear-gradient(180deg, #d9c2ec 0%, #bb99d2 48%, #a27cb7 100%);
  border-color: rgba(42,18,69,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(42,18,69,.18), 0 8px 0 #4a1d6d, 0 14px 24px rgba(42,18,69,.32);
  transform: translateY(-3px) scale(1.015);
}

/* Scrollable info modals (terms, privacy, about) */
.footer-info-modal .custom-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 28px 28px 24px;
}

.footer-info-modal .custom-modal-title {
  text-align: center;
}

.footer-info-modal .custom-modal-body {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  scrollbar-gutter: stable;
  padding-right: 16px;
  text-align: justify;
  white-space: normal;
  color: var(--muted, #a1a1aa);
}

.footer-info-modal .custom-modal-body h4 {
  margin: 1.1em 0 0.35em;
  font-size: 0.92rem;
  color: var(--text, var(--fg, #f4f4f5));
}

.footer-info-modal .custom-modal-body h4:first-child {
  margin-top: 0;
}

.footer-info-modal .custom-modal-body p,
.footer-info-modal .custom-modal-body li {
  margin: 0 0 0.65em;
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: justify;
}

.footer-info-modal .custom-modal-body ul {
  margin: 0 0 0.75em;
  padding-left: 1.2em;
}

@media (max-width: 600px) {
  .site-footer--static { min-height: 0; }
  .site-footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 7px 12px 8px;
  }

  .site-footer-copy { font-size: 0.68rem; }

  .site-footer-nav {
    justify-content: center;
    gap: 2px 10px;
  }

  .site-footer-link { gap: 4px; padding: 2px 0; font-size: 0.68rem; }
  .site-footer-icon { width: 13px; height: 13px; }

  .site-footer-link span {
    max-width: min(42vw, 160px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Light appearance defaults promoted from the former theme rules. */
.app-shell-header .brand {
color: #2a1245;
}

.app-shell-header .acct,
.app-shell-header .acct-name {
color: #2a1245;
}

.footer-info-modal .custom-modal {
background: #ffffff;
  border-color: rgba(139, 92, 246, 0.12);
  color: #0f172a;
}

.footer-info-modal .custom-modal-title {
color: #0f172a;
}

.footer-info-modal .custom-modal-body {
color: #475569;
}

.footer-info-modal .custom-modal-body h4 {
color: #0f172a;
}

.sfv-inline.sfv-loaded {
color: rgba(109, 40, 217, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
