/* MELMA shell - header, global navigation, language switcher, footer.
   Shared specification with tools.melma.pl (docs/MELMA_SHARED_DESIGN_SYSTEM.md).
   Tokens first, then components. Content styles live in main.css. */

:root {
  --melma-shell-max-width: 1240px;
  --melma-header-height: 72px;
  --melma-header-height-mobile: 64px;
  --melma-page-padding: 24px;
  --melma-page-padding-mobile: 16px;
  --melma-service-logo-size: 38px;
  --melma-nav-font-size: 16px;
  --melma-nav-gap: 28px;
  --melma-section-gap: 64px;
  --melma-section-gap-mobile: 40px;
  --melma-radius-sm: 8px;
  --melma-radius-md: 12px;

  /* Apps service accent (gold from the Spin & Guess palette). The strong
     variant exists because gold on a light background does not reach 3:1,
     so focus rings and text-adjacent underlines use it instead. */
  --service-accent: #f6b93d;
  --service-accent-soft: #fff1c9;
  --service-accent-strong: #b07a1f;

  --melma-shell-font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --melma-shell-ink: #2f3a57;
  --melma-shell-ink-soft: #5e6b87;
  --melma-shell-surface: rgba(255, 255, 255, 0.72);
  --melma-shell-shadow: 0 4px 14px rgba(68, 80, 107, 0.1);
}

/* Consent bar and dialog (shared melma-consent core) -----------------------
   melma-consent.css is a byte-identical copy of the melma.pl plugin; it is
   themed only through its custom properties plus a few shape overrides so it
   matches the Apps shell (Nunito, navy surface, gold accent, pill buttons). */

:root {
  --melma-consent-bg: #2f3a57;
  --melma-consent-text: #f4f6fb;
  --melma-consent-muted: #c9d0e0;
  --melma-consent-accent: #f6b93d;
  --melma-consent-accent-text: #2f3a57;
  --melma-consent-border: rgba(255, 255, 255, 0.14);
  --melma-consent-font: var(--melma-shell-font);
}

.melma-consent-banner,
.melma-consent-dialog {
  font-size: 15px;
}

.melma-consent-btn {
  border-radius: 999px;
  padding-inline: 1.25rem;
}

.melma-consent-dialog {
  border-radius: var(--melma-radius-md);
}

.melma-consent-dialog::backdrop {
  background: rgba(20, 26, 46, 0.7);
}

/* The core hard-codes the "off" track as #5a5d60, which is only 1.7:1 on the
   navy surface. #7d88a6 gives 3.2:1 against the surface and 3.5:1 against the
   white knob (WCAG 1.4.11 non-text contrast). */
.melma-consent-switch__track {
  background: #7d88a6;
}

/* Container ------------------------------------------------------------- */

.melma-shell {
  width: min(100% - 2 * var(--melma-page-padding), var(--melma-shell-max-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--melma-shell-ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  z-index: 100;
  font-family: var(--melma-shell-font);
}

.skip-link:focus {
  top: 1rem;
}

.melma-header :focus-visible,
.melma-footer :focus-visible {
  outline: 3px solid var(--service-accent-strong);
  outline-offset: 3px;
  border-radius: var(--melma-radius-sm);
}

/* Header ---------------------------------------------------------------- */

.melma-header {
  position: relative;
  z-index: 60;
  font-family: var(--melma-shell-font);
  min-height: var(--melma-header-height);
}

.melma-header__inner {
  min-height: var(--melma-header-height);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem var(--melma-nav-gap);
}

.melma-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.melma-brand a {
  text-decoration: none;
  color: var(--melma-shell-ink);
}

.melma-brand a:hover {
  color: var(--service-accent-strong);
}

.melma-brand__parent {
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.melma-brand__sep {
  width: 1px;
  height: 1.5rem;
  background: var(--melma-shell-ink-soft);
  opacity: 0.35;
}

.melma-brand__service {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.15rem;
}

.melma-brand__logo {
  width: var(--melma-service-logo-size);
  height: var(--melma-service-logo-size);
  border-radius: var(--melma-radius-md);
  box-shadow: var(--melma-shell-shadow);
  display: block;
}

/* Global navigation ------------------------------------------------------ */

.melma-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--melma-nav-gap);
}

.melma-nav__link {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  font-size: var(--melma-nav-font-size);
  font-weight: 700;
  line-height: 1.4;
  color: var(--melma-shell-ink);
  text-decoration: none;
}

.melma-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--service-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.melma-nav__link:hover,
.melma-nav__link:focus-visible {
  color: var(--service-accent-strong);
}

.melma-nav__link:hover::after,
.melma-nav__link:focus-visible::after,
.melma-nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Language switcher ------------------------------------------------------ */

.melma-lang {
  margin-left: auto;
  display: inline-flex;
  background: var(--melma-shell-surface);
  border-radius: 999px;
  padding: 0.25rem;
  box-shadow: var(--melma-shell-shadow);
}

.melma-lang__item {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem; /* 36px + 4px pill padding = 44px touch target */
  padding: 0 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  color: var(--melma-shell-ink-soft);
}

.melma-lang__item:hover {
  color: var(--service-accent-strong);
}

.melma-lang__item.is-active {
  background: var(--melma-shell-ink);
  color: #fff;
}

/* Hamburger (mobile only, shown by melma-shell.js) ----------------------- */

.melma-burger {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--melma-radius-md);
  background: var(--melma-shell-surface);
  box-shadow: var(--melma-shell-shadow);
  color: var(--melma-shell-ink);
  cursor: pointer;
  display: none;
  place-items: center;
}

.melma-burger__icon {
  width: 1.5rem;
  height: 1.5rem;
}

.melma-burger__icon--close,
.melma-burger[aria-expanded="true"] .melma-burger__icon--open {
  display: none;
}

.melma-burger[aria-expanded="true"] .melma-burger__icon--close {
  display: block;
}

@media (max-width: 767px) {
  .melma-shell {
    width: calc(100% - 2 * var(--melma-page-padding-mobile));
  }

  .melma-header,
  .melma-header__inner {
    min-height: var(--melma-header-height-mobile);
  }

  .melma-header__inner {
    gap: 0.5rem 0.75rem;
  }

  .melma-brand__parent {
    font-size: 0.9rem;
  }

  .melma-brand__service {
    font-size: 1.05rem;
  }

  .melma-brand__logo {
    width: 32px;
    height: 32px;
  }

  .melma-lang__item {
    padding: 0 0.75rem;
  }

  .melma-burger:not([hidden]) {
    display: grid;
  }

  /* With JS the nav is a panel, so the top row never needs to wrap. */
  .js .melma-header__inner {
    flex-wrap: nowrap;
  }

  /* Without JS the nav simply wraps under the brand row. */
  .melma-nav {
    flex-basis: 100%;
    order: 10;
    padding-bottom: 0.5rem;
  }

  .melma-nav__list {
    flex-direction: column;
    gap: 0;
  }

  .melma-nav__link {
    display: block;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(68, 80, 107, 0.12);
  }

  .melma-nav__link::after {
    display: none;
  }

  .melma-nav__link[aria-current="page"] {
    color: var(--service-accent-strong);
    box-shadow: inset 4px 0 0 var(--service-accent);
    padding-left: 0.75rem;
  }

  /* With JS the nav becomes a panel toggled by the hamburger. */
  .js .melma-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: #fff;
    padding: 0.5rem var(--melma-page-padding-mobile) 0.75rem;
    box-shadow: 0 12px 30px rgba(68, 80, 107, 0.18);
    border-bottom-left-radius: var(--melma-radius-md);
    border-bottom-right-radius: var(--melma-radius-md);
  }

  .js .melma-nav.is-open {
    display: block;
  }
}

/* Narrowest phones (320–359px): tighten the brand row so brand, language
   pill and hamburger stay on one 64px line without shrinking touch targets. */
@media (max-width: 359px) {
  .melma-header__inner {
    gap: 0.5rem;
  }

  .melma-brand {
    gap: 0.45rem;
  }

  .melma-brand__parent {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
  }

  .melma-brand__service {
    gap: 0.35rem;
    font-size: 0.95rem;
  }

  .melma-brand__logo {
    width: 28px;
    height: 28px;
  }

  .melma-lang__item {
    padding: 0 0.55rem;
  }
}

/* Footer ---------------------------------------------------------------- */

.melma-footer {
  font-family: var(--melma-shell-font);
  margin-top: var(--melma-section-gap-mobile);
  padding: 2rem 0 1.75rem;
  border-top: 3px solid var(--service-accent-soft);
  color: var(--melma-shell-ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Phones: two columns in natural order (the first two sections side by side,
   a third one wraps below). Tablets and up: three equal columns. */
.melma-footer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1rem;
}

.melma-footer a {
  overflow-wrap: anywhere;
}

.melma-footer__brand {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--melma-shell-ink);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.melma-footer__title {
  margin: 0 0 0.5rem;
  font-weight: 800;
  color: var(--melma-shell-ink);
}

.melma-footer__nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.melma-footer a {
  color: var(--melma-shell-ink-soft);
  text-decoration: none;
}

.melma-footer a:hover,
.melma-footer a:focus-visible {
  color: var(--service-accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.melma-footer__nav a[aria-current="page"] {
  color: var(--melma-shell-ink);
  font-weight: 700;
}

.melma-footer__text {
  margin: 0;
}

/* Copyright is just another grid cell; on phones it fills the slot next to
   the publisher instead of adding a separate bar. */
.melma-footer__col--copy {
  align-self: end;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* "Cookie settings" opens the shared consent dialog (data-melma-consent-open);
   styled like the footer links, with a comfortable touch target. */
.melma-footer__consent {
  padding: 0.35rem 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  color: var(--melma-shell-ink-soft);
  text-align: inherit;
  cursor: pointer;
}

.melma-footer__consent:hover,
.melma-footer__consent:focus-visible {
  color: var(--service-accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

@media (min-width: 768px) {
  .melma-footer {
    margin-top: var(--melma-section-gap);
    padding-top: var(--melma-section-gap);
  }

  .melma-footer__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
  }

  .melma-footer__col--copy {
    grid-column: -2 / -1;
    text-align: right;
    align-items: flex-end;
  }
}
