/* Tuotu Astro-projektista: src/styles/mobile/menu.css (bin/sync-astro.py). */
/* The menu panel on phones and tablets (<=1199 px), redone 2026-10-01 (Tapio: "Mobiilivalikko on karmea!").
   Loaded after header.css (src/layouts/Site.astro); desktop is untouched.

   What was wrong: the five main items were small and in another face than the links under them; an opened
   item poured out a dozen links, every one with a description in the same grey, so the panel read as a wall
   of text; the group headings were tiny grey capitals; and the header row had grown a round theme button
   that matched neither the search nor the menu button and, below 375 px, pushed the booking button onto
   the name.

   Now:
   - one face, Source Sans 3, as in the desktop menu; the main items big, with a rule between them, and the
     page you are on in teal;
   - an opened item lists its links under small teal headings, like the desktop panel: the first group
     ("Aloita tästä") as a tinted card with its descriptions, the others as a plain list of names (their
     descriptions show in the desktop panel);
   - at the end, the languages and, on phones, the theme as two segmented switches; from 641 px the theme
     stays in the header row as a square like the search and the menu buttons.
   The panel takes the header's tone in both themes: black in the dark one, navy in the light one. */

@media (max-width: 1199px) {
  body.product-home .product-nav {
    --menu-text: #ffffff;
    --menu-soft: #dfe4ea;
    --menu-muted: #9aa7b0;
    --menu-rule: rgba(255, 255, 255, 0.12);
    --menu-tint: rgba(255, 255, 255, 0.07);
    --menu-accent: #4cc8bf;
    padding: 0.25rem 1rem 1.5rem;
    border-top-color: var(--menu-rule);
    background: var(--gh-header, var(--gh-bg));
    font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
  }

  html.theme-light body.product-home .product-nav {
    --menu-muted: #aab0c8;
  }

  /* --- Main items -------------------------------------------------------------------------------- */

  body.product-home .product-nav .nav-list > .nav-item {
    border-bottom: 1px solid var(--menu-rule);
  }

  body.product-home .product-nav .nav-list > .nav-item > .nav-link {
    padding: 1rem 0;
    color: var(--menu-text);
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.25;
  }

  body.product-home .product-nav .nav-list > .nav-item.is-current > .nav-link,
  body.product-home .product-nav .nav-list > .nav-item.is-ancestor > .nav-link {
    color: var(--menu-accent);
  }

  body.product-home .product-nav .product-nav-expand {
    width: 2.75rem;
    height: 2.75rem;
    margin-right: -0.6rem;
    border-radius: 999px;
    color: var(--menu-soft);
  }

  body.product-home .product-nav .product-nav-expand svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  body.product-home .product-nav .nav-item.is-expanded > .product-nav-expand {
    background: var(--menu-tint);
    color: var(--menu-text);
  }

  /* --- An opened item's links ---------------------------------------------------------------------- */

  body.product-home .product-nav .nav-item > .sub-menu {
    padding: 0.1rem 0 1.25rem;
  }

  body.product-home .product-nav .sub-menu a {
    margin-inline: -0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    color: var(--menu-soft);
    font-family: inherit;
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.35;
  }

  body.product-home .product-nav .sub-menu a:hover {
    background: var(--menu-tint);
    color: var(--menu-text);
  }

  body.product-home .product-nav .sub-menu li.is-current > a {
    background: var(--menu-tint);
    color: var(--menu-accent);
    font-weight: 600;
  }

  /* Mega panels: groups under small teal headings. */
  body.product-home .product-nav .mega-menu > .sub-item + .sub-item {
    margin-top: 1.1rem;
  }

  body.product-home .product-nav .mega-menu > .sub-item > a {
    margin: 0;
    padding: 0 0 0.3rem;
    border-radius: 0;
    color: var(--menu-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  body.product-home .product-nav .mega-menu > .sub-item > a:hover {
    background: transparent;
    color: var(--menu-accent);
  }

  body.product-home .product-nav .mega-menu .sub-menu {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.product-home .product-nav .mega-menu .sub-menu a {
    padding-block: 0.55rem;
    font-size: 1.0625rem;
  }

  /* Only the names in the lists; the descriptions stay in the desktop panel and in the first group's card. */
  body.product-home .product-nav .nav-text {
    display: block;
  }

  body.product-home .product-nav .nav-desc {
    display: none;
  }

  /* The first group ("Aloita tästä", "Start here"): a tinted card, as in the desktop panel, its links with
     their descriptions. */
  body.product-home .product-nav .mega-menu > .sub-item:first-child {
    margin: 0.35rem 0 0.25rem;
    padding: 0.95rem 0.75rem 0.5rem;
    border-radius: 16px;
    background: color-mix(in srgb, #4cc8bf 12%, transparent);
  }

  body.product-home .product-nav .mega-menu > .sub-item:first-child .sub-menu a {
    margin-inline: -0.5rem;
    padding: 0.6rem 0.5rem;
  }

  body.product-home .product-nav .mega-menu > .sub-item:first-child .nav-text {
    display: grid;
    gap: 0.15rem;
  }

  body.product-home .product-nav .mega-menu > .sub-item:first-child .nav-label {
    color: var(--menu-text);
    font-weight: 600;
  }

  body.product-home .product-nav .mega-menu > .sub-item:first-child .nav-desc {
    display: block;
    color: var(--menu-muted);
    font-size: 0.9rem;
    line-height: 1.4;
  }

  /* --- The end of the panel: languages and theme as segmented switches ---------------------------- */

  body.product-home .product-nav-account {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.75rem;
  }

  body.product-home .product-nav-account .product-languages,
  body.product-home .product-nav-theme {
    display: flex;
    /* Side by side, as wide as each other; under each other where the words don't fit (320 px). */
    flex: 1 1 0;
    gap: 3px;
    margin: 0;
    padding: 3px;
    border: 1px solid var(--menu-rule);
    border-radius: 999px;
    list-style: none;
  }

  body.product-home .product-nav-account .product-languages li {
    display: flex;
    flex: 1;
  }

  body.product-home .product-nav-account .product-languages a,
  body.product-home .product-nav-theme button {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--menu-soft);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
  }

  body.product-home .product-nav-theme button svg {
    width: 1rem;
    height: 1rem;
  }

  body.product-home .product-nav-account .product-languages a[aria-current],
  body.product-home .product-nav-theme button[aria-pressed='true'] {
    background: #ffffff;
    color: var(--gh-header, #000000);
  }

  /* --- The header row: the theme button a square like its neighbours ------------------------------- */

  body.product-home .product-tools .product-theme button[aria-pressed='true'] {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid color-mix(in srgb, var(--gh-border) 85%, var(--gh-text));
    border-radius: 6px;
    background: transparent;
    color: var(--gh-text);
  }

  body.product-home .product-tools .product-theme button[aria-pressed='true'] svg {
    width: 1.1rem;
    height: 1.1rem;
  }
}

@media (max-width: 1199px) and (hover: hover) {
  body.product-home .product-nav .product-nav-expand:hover {
    background: var(--menu-tint);
    color: var(--menu-text);
  }

  body.product-home .product-nav-account .product-languages a:not([aria-current]):hover,
  body.product-home .product-nav-theme button[aria-pressed='false']:hover {
    background: var(--menu-tint);
    color: var(--menu-text);
  }

  body.product-home .product-tools .product-theme button[aria-pressed='true']:hover {
    border-color: var(--gh-muted);
  }
}

/* The panel slides in, and an opened item's links fade in under it. */
@media (max-width: 1199px) and (prefers-reduced-motion: no-preference) {
  body.product-home .product-nav.is-open {
    animation: product-menu-in 0.22s ease-out;
  }

  body.product-home .product-nav .nav-item.is-expanded > .sub-menu {
    animation: product-menu-drop 0.2s ease-out;
  }
}

/* Opacity only: a transform on the panel would move its box while the script measures it to fit the screen. */
@keyframes product-menu-in {
  from {
    opacity: 0;
  }
}

@keyframes product-menu-drop {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

/* Phones: the theme button leaves the header row (the panel has the switch), so the booking button no
   longer runs over the name at 320–374 px. */
@media (max-width: 640px) {
  body.product-home .product-tools .product-theme {
    display: none;
  }
}

/* From 641 px the header row has the theme button; the panel's switch would only repeat it. */
@media (min-width: 641px) {
  .product-nav-theme {
    display: none !important;
  }

  body.product-home .product-nav-account .product-languages {
    flex: 0 1 16rem;
  }
}

/* Tablets (700-1199 px): an opened item's groups stand side by side, as in the desktop panel, instead of one
   long column; the panel's rows keep the page's side margins. */
@media (min-width: 700px) and (max-width: 1199px) {
  body.product-home .product-nav {
    padding-inline: max(1.5rem, calc((100vw - var(--max, 1200px)) / 2));
  }

  body.product-home .product-nav .nav-item.is-expanded > .mega-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
  }

  body.product-home .product-nav .mega-menu > .sub-item + .sub-item {
    margin-top: 0;
  }

  body.product-home .product-nav .mega-menu > .sub-item:first-child {
    margin: 0;
  }

  body.product-home .product-nav .mega-menu > .sub-item:not(:first-child) {
    padding-top: 0.95rem;
  }
}

/* 1200–1279 px (one theme button, no menu panel): a square like the language button beside it. The body
   prefix outranks theme-light.css, which loads after this file. */
@media (min-width: 1200px) and (max-width: 1279px) {
  body .product-tools .product-theme button[aria-pressed='true'] {
    width: 2rem;
    height: 2rem;
    border: 1px solid color-mix(in srgb, var(--gh-border) 85%, var(--gh-text));
    border-radius: 6px;
    background: transparent;
    color: var(--gh-text);
  }
}
