/* =====================================================================
   LAYOUT.CSS — parts shared by every page:
   1. Preloader   2. Header   3. Full-screen menu   4. Footer
   ===================================================================== */

/* ---------- 1. PRELOADER (shown while settings load) ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 999;
  display: none;                    /* only shown when JavaScript is running */
  place-items: center;
  background: #000;
  transition: opacity .6s ease, visibility .6s ease;
}
.preloader__inner { display: grid; justify-items: center; gap: var(--space-6); }
.preloader__mark {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12); border-top-color: var(--color-primary);
  animation: spin 1s linear infinite;
}
.preloader__bar { width: 140px; height: 1px; background: rgba(255,255,255,.12); overflow: hidden; }
.preloader__bar::after {
  content: ""; display: block; width: 40%; height: 100%; background: var(--color-primary);
  animation: loadbar 1.2s var(--ease) infinite;
}
.js .preloader { display: grid; }
.noscript-msg { margin: 8rem var(--gutter); }
.is-loaded .preloader { opacity: 0; visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- 2. HEADER ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding-inline: var(--gutter);
  color: var(--hero-text);                 /* white over the hero photo */
  transition: background-color .4s ease, color .4s ease, height .4s ease, box-shadow .4s ease;
}
/* After scrolling on inner pages, the header becomes solid */
.site-header.is-solid {
  background: var(--header-bg);
  color: var(--color-text);
  box-shadow: 0 1px 0 var(--color-border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.site-header__logo { display: flex; align-items: center; height: 100%; padding-block: 14px; }
.site-header__logo img { height: 100%; width: auto; max-width: 220px; object-fit: contain; }
.site-header__logo .logo-for-light { display: none; }
/* Day mode + solid header: show the dark version of the logo */
[data-theme="light"] .site-header.is-solid .logo-for-dark { display: none; }
[data-theme="light"] .site-header.is-solid .logo-for-light { display: block; }
.site-header__logo-text { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; letter-spacing: .12em; }

.site-header__actions { display: flex; align-items: center; gap: var(--space-2); }

/* Day/Night toggle */
.theme-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  transition: background-color .3s;
}
.theme-toggle:hover { background: rgba(127,127,127,.18); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Left group: ☰ button then logo */
.site-header__left { display: flex; align-items: center; gap: var(--space-3); height: 100%; }

/* ☰ MENU button (3 lines that turn into an X) */
.menu-toggle {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-left: -10px;
}
.menu-toggle__lines { position: relative; width: 26px; height: 20px; }
.menu-toggle__lines span {
  position: absolute; left: 0; width: 100%; height: 3px; border-radius: 2px; background: currentColor;
  transition: transform .5s var(--ease), width .4s var(--ease), top .5s var(--ease), opacity .3s;
}
.menu-toggle__lines span:nth-child(1) { top: 0; }
.menu-toggle__lines span:nth-child(2) { top: 8.5px; }
.menu-toggle__lines span:nth-child(3) { top: 17px; }
.menu-toggle:hover .menu-toggle__lines span:nth-child(2) { width: 70%; }
/* When open, the lines turn into an X */
.menu-open .menu-toggle__lines span:nth-child(1) { top: 8.5px; transform: rotate(45deg); }
.menu-open .menu-toggle__lines span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle__lines span:nth-child(3) { top: 8.5px; transform: rotate(-45deg); }
/* Header always white while the dark menu is open */
.menu-open .site-header { color: var(--menu-text); background: transparent; box-shadow: none; backdrop-filter: none; }
.menu-open .site-header .logo-for-dark { display: block !important; }
.menu-open .site-header .logo-for-light { display: none !important; }

/* ---------- 3. FULL-SCREEN MENU ---------- */
.site-menu {
  position: fixed; inset: 0; z-index: 90;
  display: grid; align-content: safe center;   /* centred, but never cut off at the top */
  padding: calc(var(--header-h) + var(--space-4)) var(--gutter) var(--space-8);
  background:
    radial-gradient(ellipse 60% 70% at 85% 30%, rgba(229, 9, 20, .10), transparent 70%),
    var(--menu-bg);
  color: var(--menu-text);
  overflow-y: auto;
  clip-path: inset(0 0 100% 0);                 /* hidden: folded up to the top */
  visibility: hidden;
  transition: clip-path .8s var(--ease), visibility 0s linear .8s;
}
.menu-open .site-menu { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .8s var(--ease), visibility 0s; }

.site-menu__grid { display: grid; gap: var(--space-12); width: 100%; max-width: var(--container); margin-inline: auto; }
@media (min-width: 960px) { .site-menu__grid { grid-template-columns: 1.4fr 1fr; align-items: center; } }
/* thin divider line between links and contact details on big screens */
@media (min-width: 960px) { .site-menu__info { border-left: 1px solid rgba(255,255,255,.1); padding-left: var(--space-12); } }

.site-menu__nav ol { list-style: none; padding: 0; counter-reset: menu; }
.site-menu__nav li { overflow: hidden; }       /* hides the link until it slides up */
.site-menu__nav a {
  counter-increment: menu;
  position: relative;
  display: flex; align-items: center; gap: 1.4rem;
  padding-block: .55rem;
  /* Thin, widely spaced capitals = calm, premium look */
  font-family: var(--font-hero); font-weight: 300; text-transform: uppercase;
  font-size: clamp(1.1rem, .85rem + 1vw, 1.7rem); line-height: 1.3; letter-spacing: .24em;
  color: var(--menu-text-muted);
  transform: translateY(110%);
  transition: color .4s ease, transform .8s var(--ease-out), letter-spacing .5s var(--ease-out);
}
/* small number before each item */
.site-menu__nav a::before {
  content: counter(menu, decimal-leading-zero);
  font-size: .62rem; font-weight: 500; letter-spacing: .15em; color: var(--color-primary);
  min-width: 1.8rem;
}
/* thin line that grows in on hover */
.site-menu__nav a::after {
  content: ""; height: 1px; width: 0; background: var(--color-primary);
  transition: width .5s var(--ease-out);
}
.site-menu__nav ol:hover a { color: rgba(255, 255, 255, .35); }
.site-menu__nav a:hover, .site-menu__nav a:focus-visible,
.site-menu__nav ol:hover a:hover { color: var(--menu-text); letter-spacing: .3em; }
.site-menu__nav a:hover::after, .site-menu__nav a:focus-visible::after { width: 48px; }
.site-menu__nav a[aria-current="page"] { color: var(--menu-text); }
.site-menu__nav a[aria-current="page"]::after { width: 24px; }
.menu-open .site-menu__nav a { transform: translateY(0); }
/* Stagger: each link slides up a little after the previous one */
.menu-open .site-menu__nav li:nth-child(1) a { transition-delay: .25s; }
.menu-open .site-menu__nav li:nth-child(2) a { transition-delay: .30s; }
.menu-open .site-menu__nav li:nth-child(3) a { transition-delay: .35s; }
.menu-open .site-menu__nav li:nth-child(4) a { transition-delay: .40s; }
.menu-open .site-menu__nav li:nth-child(5) a { transition-delay: .45s; }
.menu-open .site-menu__nav li:nth-child(6) a { transition-delay: .50s; }
.menu-open .site-menu__nav li:nth-child(7) a { transition-delay: .55s; }
.menu-open .site-menu__nav li:nth-child(8) a { transition-delay: .60s; }
.menu-open .site-menu__nav li:nth-child(n+9) a { transition-delay: .65s; }

.site-menu__info {
  display: grid; gap: var(--space-6);
  color: var(--menu-text-muted); font-size: var(--fs-sm);
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s var(--ease-out);
}
.menu-open .site-menu__info { opacity: 1; transform: none; transition-delay: .6s; }
.site-menu__info h2 { font-family: var(--font-hero); font-weight: 500; font-size: .7rem; letter-spacing: .32em; color: var(--color-primary); margin-bottom: var(--space-2); }
.site-menu__info p { letter-spacing: .02em; line-height: 1.8; }
.site-menu__info a:hover { color: var(--menu-text); }
.site-menu__info .social { color: var(--menu-text); }

/* ---------- 4. FOOTER (inner pages) ---------- */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-16) var(--space-8);
  font-size: var(--fs-sm); color: var(--color-text-muted);
}
.site-footer__grid { display: grid; gap: var(--space-12); }
@media (min-width: 768px)  { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer__brand img { height: 56px; width: auto; margin-bottom: var(--space-4); }
.site-footer__brand .logo-for-light { display: none; }
[data-theme="light"] .site-footer__brand .logo-for-dark { display: none; }
[data-theme="light"] .site-footer__brand .logo-for-light { display: block; }
.site-footer__brand .social { margin-top: var(--space-6); }
.site-footer h2 { font-family: var(--font-hero); font-weight: 600; font-size: .75rem; letter-spacing: .28em; color: var(--color-text); margin-bottom: var(--space-4); }
.site-footer ul:not(.social) { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
/* Phones: the Explore links in two columns side by side (keeps the footer short) */
@media (max-width: 767px) {
  .site-footer__grid { gap: var(--space-8); }
  .site-footer nav ul:not(.social) { display: block; columns: 2; column-gap: var(--space-6); }
  .site-footer nav li { break-inside: avoid; padding-bottom: var(--space-2); }
}
.site-footer a:hover { color: var(--color-primary); }
.site-footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4);
  margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--color-border);
}

/* Inner pages: the content area is at least one screen tall, so the footer
   (drawn after the content loads) never jumps up into view (no layout shift) */
.page-inner #main { min-height: 100vh; min-height: 100svh; }
