/**
 * Selfrag Components
 * Header, footer, navigation for standalone theme.
 */

/* ══ HEADER ══ */
.sf-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--sf-header-bg);
  height: 80px;
  box-shadow: 0 1px 0 var(--sf-header-shadow);
  transition: background 0.3s;
}

.sf-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.sf-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.sf-logo img {
  height: 50px;
  width: auto;
}

.sf-logo:hover img {
  opacity: 0.85;
}

/* Navigation — right-aligned and compact. */
.sf-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.sf-nav .visually-hidden { position: absolute !important; }
.sf-nav nav { display: contents; }

.sf-nav ul {
  display: flex;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.sf-nav > div:not(.sf-lang) { display: contents; }

.sf-nav li {
  margin: 0;
  padding: 0;
  position: relative;
}

.sf-nav li > a {
  font-family: var(--sf-font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--sf-text);
  padding: 8px 16px;
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  white-space: nowrap;
}

.sf-nav li > a:hover,
.sf-nav li > a.is-active {
  color: var(--sf-red);
}

.sf-nav li > a[aria-current="page"],
.sf-nav li.menu-item--active-trail > a {
  color: var(--sf-red);
  font-weight: 500;
}

/* Dropdowns */
.sf-nav li > ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px 0;
  min-width: 260px;
  z-index: 110;
  border-radius: 0 0 4px 4px;
  flex-direction: column;
}

.sf-nav li:hover > ul {
  display: flex;
}

.sf-nav li > ul > li > a {
  font-size: 13px;
  color: var(--sf-text-secondary);
  padding: 8px 20px;
}

.sf-nav li > ul > li > a:hover {
  color: var(--sf-red);
  background: var(--sf-bg-alt);
}

/* Header right side actions */
.sf-header__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Compact language switcher: one visible code + dropdown on hover/click. */
.sf-lang {
  position: relative;
  margin-left: 12px;
  padding-left: 14px;
  border-left: 1px solid var(--sf-border, #e5e5e5);
}
.sf-lang__current {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 6px 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--sf-text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}
.sf-lang__current:hover,
.sf-lang[data-open="true"] .sf-lang__current { color: var(--sf-red); }
.sf-lang__caret {
  display: inline-block;
  width: 0; height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.2s;
}
.sf-lang[data-open="true"] .sf-lang__caret { transform: rotate(180deg); }
.sf-lang__menu {
  display: none;
  position: absolute;
  top: 100%; right: 0;
  min-width: 68px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  z-index: 110;
  border-radius: 2px;
}
.sf-lang:hover .sf-lang__menu,
.sf-lang[data-open="true"] .sf-lang__menu { display: block; }
.sf-lang__item {
  display: block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--sf-text-secondary);
  text-decoration: none;
}
.sf-lang__item:hover,
.sf-lang__item--active { color: var(--sf-red); }

/* ══ MAIN ══ */
.sf-main {
  padding-top: 80px;
}

/* ══ FOOTER ══ */
.sf-footer {
  background: #1a1a1a;
  border-top: none;
  padding: 64px 48px 0;
  font-size: 14px;
  color: #999;
}

.sf-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 56px;
}

/* Newsletter banner: top strip with full width */
.sf-footer__newsletter-banner {
  border-bottom: 1px solid #333;
  padding: 32px 48px;
  margin: -64px -48px 48px;
}

.sf-footer__newsletter-banner .sf-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 0;
}

.sf-footer__newsletter-text {
  flex: 1;
  min-width: 0;
}

.sf-footer__newsletter-title {
  font-family: var(--sf-font-heading);
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.sf-footer__newsletter-sub {
  font-size: 14px;
  color: #999;
}

/* Brand column */
.sf-footer__col--brand {
  padding-right: 16px;
}

.sf-footer__logo {
  display: inline-block;
  margin-bottom: 14px;
  font-family: var(--sf-font-heading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #fff;
  text-decoration: none;
}

.sf-footer__logo:hover { color: var(--sf-red); }

.sf-footer__tagline {
  font-family: var(--sf-font-heading);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.sf-footer__mission {
  font-size: 13px;
  line-height: 1.6;
  color: #999;
  margin-bottom: 24px;
  max-width: 320px;
}

.sf-footer__address {
  font-size: 13px;
  line-height: 1.6;
  color: #999;
  margin-bottom: 16px;
}

.sf-footer__address strong {
  color: #fff;
  font-weight: 500;
}

.sf-footer__address--primary { margin-bottom: 16px; }

/* Section headings */
.sf-footer__heading {
  font-family: var(--sf-font-heading);
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
  position: relative;
  padding-bottom: 12px;
}

.sf-footer__heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 24px;
  height: 2px;
  background: var(--sf-red);
}

.sf-footer__heading--second {
  margin-top: 32px;
}

/* Nav links */
.sf-footer__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sf-footer__nav a {
  color: #bbb;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s;
}

.sf-footer__nav a:hover {
  color: var(--sf-red);
}

.sf-footer__nav--small a {
  font-size: 13px;
  color: #888;
}

/* Social */
.sf-footer__social {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.sf-footer__social a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #333;
  border-radius: 50%;
  color: #999;
  transition: all 0.2s;
}

.sf-footer__social a:hover {
  border-color: var(--sf-red);
  color: #fff;
  background: var(--sf-red);
}

/* Newsletter form (in banner) */
.sf-footer__newsletter {
  display: flex;
  align-items: stretch;
  background: rgba(255,255,255,0.05);
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s;
  min-width: 440px;
  max-width: 520px;
}

.sf-footer__newsletter:focus-within {
  border-color: var(--sf-red);
}

.sf-footer__newsletter input {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 14px 18px;
  color: #fff;
  font-size: 15px;
  font-family: var(--sf-font-body);
  min-width: 0;
}

.sf-footer__newsletter input::placeholder { color: #777; }
.sf-footer__newsletter input:focus { outline: none; }

.sf-footer__newsletter button {
  background: var(--sf-red);
  color: #fff;
  border: 0;
  padding: 0 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  font-family: var(--sf-font-body);
  transition: background 0.2s;
  white-space: nowrap;
}

.sf-footer__newsletter button:hover { background: var(--sf-red-dark); }

.sf-footer__newsletter .sf-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none;
}

.sf-footer__newsletter-msg {
  max-width: 520px;
  margin: 12px 0 0 auto;
  padding: 10px 14px;
  font-size: 13px;
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid var(--sf-red);
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s ease, transform .25s ease;
}
.sf-footer__newsletter-msg:empty { display: none; }
.sf-footer__newsletter-msg.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.sf-footer__newsletter-msg--ok { border-left-color: #2ecc71; }
.sf-footer__newsletter-msg--invalid,
.sf-footer__newsletter-msg--error { border-left-color: #ff6b6b; }
.sf-footer__newsletter button[disabled] { opacity: 0.65; cursor: progress; }

/* Success state: replace form with centered confirmation (no layout shift). */
.sf-footer__newsletter-banner.is-success .sf-footer__newsletter,
.sf-footer__newsletter-banner.is-success .sf-footer__newsletter-text {
  display: none;
}
.sf-footer__newsletter-banner.is-success .sf-footer__inner {
  justify-content: center;
}
.sf-footer__newsletter-msg.is-hero {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: none;
  margin: 0;
  padding: 18px 28px;
  font-size: 15px;
  font-weight: 500;
  background: rgba(46, 204, 113, 0.12);
  border-left: 3px solid #2ecc71;
  border-radius: 4px;
  color: #fff;
}
.sf-footer__newsletter-check {
  flex-shrink: 0;
  color: #2ecc71;
}

/* Typo-suggestion clickable fix */
.sf-footer__newsletter-suggest {
  background: transparent;
  border: 0;
  padding: 0 2px;
  margin: 0;
  font: inherit;
  color: var(--sf-red);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.sf-footer__newsletter-suggest:hover {
  color: #ff6b6b;
  text-decoration-thickness: 2px;
}

/* Trust badges row */
.sf-footer__trust {
  border-top: 1px solid #333;
  padding: 24px 48px;
}

.sf-footer__trust .sf-footer__inner {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0;
}

.sf-footer__trust-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #999;
  letter-spacing: 0.02em;
}

.sf-footer__trust-item svg { color: var(--sf-red); flex-shrink: 0; }

/* Bottom row: copyright + back-to-top */
.sf-footer__bottom {
  border-top: 1px solid #333;
  padding: 20px 48px;
}

.sf-footer__bottom .sf-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.sf-footer__copyright {
  font-size: 13px;
  color: #999;
}

.sf-footer__back-to-top {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #333;
  border-radius: 50%;
  color: #999;
  transition: all 0.2s;
}

.sf-footer__back-to-top:hover {
  border-color: var(--sf-red);
  color: #fff;
  background: var(--sf-red);
}

/* Hamburger button — hidden on desktop */
.sf-hamburger {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  margin-left: 8px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.sf-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--sf-text);
  transition: transform 0.25s, opacity 0.2s;
}
.sf-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sf-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sf-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sf-lang--mobile { display: none; }

/* ══ RESPONSIVE ══ */
@media (max-width: 1024px) {
  .sf-footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
  .sf-footer__col--brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .sf-hamburger { display: flex; }
  .sf-lang--desktop { display: none; }
  .sf-nav {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 99;
    gap: 16px;
  }
  .sf-nav.is-open { transform: translateX(0); }
  body.sf-nav-open { overflow: hidden; }
  .sf-nav > div,
  .sf-nav nav { display: block; width: 100%; }
  .sf-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }
  .sf-nav li > a {
    padding: 16px 8px;
    font-size: 18px;
    border-bottom: 1px solid var(--sf-border);
  }
  .sf-nav li > ul {
    position: static;
    display: none;
    box-shadow: none;
    padding: 0 0 0 16px;
    min-width: 0;
  }
  .sf-nav li:hover > ul { display: none; }
  .sf-nav li.is-open > ul { display: flex; }
  /* Mobile language switcher: render EN/FR/DE inline as tabs, no dropdown.
     The .sf-lang__current (EN ▾ button) is hidden; the menu is always open
     and laid out horizontally. Active item is red. */
  .sf-lang--mobile {
    display: block;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--sf-border);
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
  .sf-lang--mobile .sf-lang__current { display: none; }
  .sf-lang--mobile .sf-lang__menu {
    display: flex;
    position: static;
    box-shadow: none;
    background: transparent;
    padding: 0;
    min-width: 0;
    gap: 0;
  }
  .sf-lang--mobile .sf-lang__item {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 14px;
    border: 1px solid var(--sf-border);
    border-right: 0;
  }
  .sf-lang--mobile .sf-lang__item:last-child { border-right: 1px solid var(--sf-border); }
  .sf-lang--mobile .sf-lang__item--active {
    background: var(--sf-red);
    color: #fff;
    border-color: var(--sf-red);
  }
}

@media (max-width: 768px) {
  .sf-header__inner { padding: 0 24px; gap: 12px; }
  .sf-footer { padding: 40px 24px 0; }
  /* Mobile footer: 2 cols, brand+address spans both, link cols sit side by side */
  .sf-footer__inner { grid-template-columns: 1fr 1fr; gap: 28px 24px; }
  .sf-footer__col--brand { grid-column: 1 / -1; }
  .sf-footer__trust { padding: 20px 24px; }
  .sf-footer__trust .sf-footer__inner { gap: 20px; }
  .sf-footer__bottom { padding: 16px 24px; }

  /* Newsletter banner: stack vertically so the form gets full width and the
     heading doesn't break one-word-per-line. */
  .sf-footer__newsletter-banner {
    padding: 28px 24px;
    margin: -40px -24px 40px;
  }
  .sf-footer__newsletter-banner .sf-footer__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .sf-footer__newsletter-title { font-size: 20px; }
  .sf-footer__newsletter {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .sf-footer__newsletter input {
    min-width: 0;
    padding: 12px 14px;
    font-size: 14px;
  }
  .sf-footer__newsletter button {
    padding: 0 16px;
    font-size: 13px;
  }
}

