/* ==========================================================================
   layout.css – the page frame

   1. Containers
   2. Stage (dark band with the scalloped edge)
   3. Header and navigation
   4. Hero (stage content on the start page)
   5. Stage title (stage content on all other pages)
   6. Sections and pastel bands
   7. Footer
   ========================================================================== */

/* ---------- 1. Containers ---------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--width-wide));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2 * var(--gutter), var(--width-content));
}

.site-main {
  min-height: 40vh;
}

/* ---------- 2. Stage ---------- */

/*
 * The dark theatre band at the top of every page. A soft spotlight falls in from above;
 * the lower edge is scalloped like the frame of the Tron-ton-ton logo.
 */
.stage {
  position: relative;
  color: var(--color-on-stage);
  background:
    radial-gradient(ellipse 48% 90% at 74% 0%, rgb(255 210 63 / 0.26), transparent 70%),
    var(--color-stage);
}

/* The scallops: a row of half circles hanging below the stage. */
.stage::after {
  content: "";
  position: absolute;
  inset: calc(100% - 1px) 0 auto;
  z-index: 1;
  height: var(--scallop-size);
  background:
    radial-gradient(
      circle at 50% 0,
      var(--color-stage) calc(var(--scallop-size) - 1px),
      transparent var(--scallop-size)
    )
    50% 0 / calc(var(--scallop-size) * 2) 100% repeat-x;
}

.stage h1 {
  color: var(--color-on-stage);
}


/* ---------- 3. Header and navigation ---------- */

.site-header {
  position: relative;
  z-index: 20; /* dropdown menus open above the stage content */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--color-on-stage);
  text-decoration: none;
}

.site-brand:hover {
  color: var(--color-sun);
}

.site-brand__emblem {
  width: auto;
  height: clamp(4rem, 6vw, 5.5rem);
}

.site-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.site-brand__name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: var(--font-display-weight);
}

.site-brand__tagline {
  font-size: var(--text-small);
  color: var(--color-on-stage-soft);
}

/* Works with a WordPress menu (.menu-item, .sub-menu) and with the page-list fallback (.page_item, .children). */
.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.site-nav li {
  position: relative;
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--color-on-stage);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav li:focus-within > a {
  color: var(--color-sun);
  background: rgb(255 255 255 / 0.1);
}

.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a,
.site-nav .current_page_item > a,
.site-nav .current_page_ancestor > a {
  color: var(--color-sun);
  background: rgb(255 210 63 / 0.14);
}

/* Small arrow on items that have a dropdown. */
.site-nav .menu-item-has-children > a::after,
.site-nav .page_item_has_children > a::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-left: 0.5em;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  translate: 0 -0.2em;
  rotate: 45deg;
}

.nav-toggle {
  display: none;
}

/* Wide screens: logo left and social links right, the menu on its own row below; child pages as dropdown. */
@media (min-width: 900px) {
  .site-header__social {
    order: 1;
  }

  .site-nav {
    order: 2;
    width: 100%;
  }

  .site-nav ul ul {
    position: absolute;
    top: 100%;
    right: 0;
    width: 19rem;
    padding: 0.5rem;
    border-radius: 20px;
    background: #3b2050;
    box-shadow: 0 18px 40px rgb(0 0 0 / 0.35);
    opacity: 0;
    visibility: hidden;
    translate: 0 6px;
    transition: opacity 0.15s, translate 0.15s, visibility 0.15s;
  }

  .site-nav li:hover > ul,
  .site-nav li:focus-within > ul {
    opacity: 1;
    visibility: visible;
    translate: 0;
  }

  .site-nav ul ul a {
    border-radius: 14px;
  }
}

/* Narrow screens: the menu hides behind a button and opens as a list. */
@media (max-width: 899px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    border: 2px solid rgb(255 255 255 / 0.35);
    border-radius: var(--radius-pill);
    font: inherit;
    font-weight: 700;
    color: var(--color-on-stage);
    background: none;
    cursor: pointer;
  }

  /* Three bars that turn into a cross while the menu is open. */
  .nav-toggle__icon,
  .nav-toggle__icon::before,
  .nav-toggle__icon::after {
    display: block;
    width: 1.2rem;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: rotate 0.2s, translate 0.2s;
  }

  .nav-toggle__icon {
    position: relative;
  }

  .nav-toggle__icon::before,
  .nav-toggle__icon::after {
    content: "";
    position: absolute;
  }

  .nav-toggle__icon::before { translate: 0 -6px; }
  .nav-toggle__icon::after { translate: 0 6px; }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::before { translate: 0; rotate: 45deg; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::after { translate: 0; rotate: -45deg; }

  /* Smaller logo, so logo and button fit side by side on a phone. */
  .site-brand {
    gap: 0.6rem;
  }

  .site-brand__emblem {
    height: 3.25rem;
  }

  .site-brand__name {
    font-size: 1.3rem;
  }

  .site-brand__tagline {
    font-size: 0.8rem;
  }

  .site-nav {
    display: none;
    width: 100%;
    padding-bottom: 0.5rem;
  }

  .site-nav.is-open {
    display: block;
  }

  /* The social links belong to the opened menu. */
  .site-header__social {
    display: none;
    width: 100%;
    padding: 0 0.85rem 0.75rem;
  }

  .site-nav.is-open + .site-header__social {
    display: block;
  }

  .site-nav > ul {
    flex-direction: column;
    gap: 0;
  }

  .site-nav a {
    padding: 0.65rem 0.85rem;
    font-size: 1.05rem;
  }

  .site-nav ul ul {
    margin-left: 1rem;
    border-left: 2px solid rgb(255 255 255 / 0.15);
  }

  .site-nav ul ul a {
    font-weight: 500;
    color: var(--color-on-stage-soft);
  }
}

/* ---------- 4. Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1rem 2.5rem;
  align-items: end;
  padding-top: clamp(1rem, 3vw, 2.5rem);
}

.hero__text {
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.hero__title {
  margin-bottom: 0.4em;
  font-size: clamp(2rem, 2.2vw + 1.3rem, 3.1rem);
}

.hero__lead {
  max-width: 34rem;
  font-size: var(--text-large);
  color: var(--color-on-stage-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.75rem 0 0;
}

/*
 * The puppet ensemble stands on the lower edge of the stage, above the scallops.
 * Widths are percentages of the group, so the group scales as a whole.
 * clip-path cuts only the bottom: on page load the puppets rise from behind the stage edge.
 */
.hero__ensemble {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  clip-path: inset(-100vh -100vw 0 -100vw);
}

.hero__ensemble .puppet {
  position: relative; /* lets single puppets step in front of their neighbours with z-index */
  height: auto;
  transform-origin: 50% 100%;
  margin-inline: -2.5%;
  animation: puppet-rise 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  transition: rotate 0.25s;
}

/* A puppet nods when the mouse touches it. */
.hero__ensemble .puppet:hover {
  rotate: -5deg;
}

.hero__ensemble .puppet--bear    { width: 19%; animation-delay: 0.15s; }
.hero__ensemble .puppet--giraffe { width: 26%; animation-delay: 0.45s; }
.hero__ensemble .puppet--cat     { width: 24%; animation-delay: 0.3s; z-index: 3; }
.hero__ensemble .puppet--mouse   { width: 20%; animation-delay: 0.6s; }
.hero__ensemble .puppet--dog     { width: 30%; animation-delay: 0.75s; z-index: 3; }

@keyframes puppet-rise {
  from { translate: 0 105%; }
  to   { translate: 0 0; }
}

@media (max-width: 899px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero__text {
    padding-bottom: 0.5rem;
  }

  .hero__ensemble {
    width: min(100%, 26rem);
    margin-inline: auto;
  }
}

/* ---------- 5. Stage title ---------- */

.stage-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 9rem;
  padding-top: 1rem;
}

.stage-title__text {
  padding-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.stage-title__heading {
  margin: 0;
}

.stage-title__sub {
  margin: 0.4rem 0 0;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  color: var(--color-sun);
}

.stage-title .chips {
  margin-top: 1rem;
}

.stage-title__puppet {
  flex: none;
  width: auto;
  height: auto;
  max-width: clamp(5.5rem, 16vw, 11rem);
  max-height: clamp(6.5rem, 16vw, 11rem);
}

/* ---------- 6. Sections and pastel bands ---------- */

.section {
  padding-block: var(--space-section);
}

/* Section titles sit on a yellow stroke of paint. The stroke is as wide as the title and slightly tilted. */
.section__title {
  position: relative;
  z-index: 0; /* keeps the stroke behind the letters but in front of the section background */
  width: fit-content;
  margin-bottom: 1.3em;
}

.section__title::before {
  content: "";
  position: absolute;
  inset: -0.12em -0.45em -0.2em;
  z-index: -1;
  background: url("../img/decor/brush.svg") center / 100% 100% no-repeat;
  rotate: -1deg;
}

/* A band is a section on a pastel "island" with big round corners. */
.band {
  margin-inline: clamp(0.5rem, 2vw, 2rem);
  border-radius: clamp(28px, 5vw, 56px);
}

/* Each band carries a few big shapes in its corners. */
.band--butter {
  background:
    radial-gradient(circle at 100% 0, #ffe08a 0 5.5rem, transparent calc(5.5rem + 1px)),
    radial-gradient(circle at 4% 100%, #fff7de 0 7rem, transparent calc(7rem + 1px)),
    radial-gradient(circle at 88% 96%, #ffd9c4 0 2.2rem, transparent calc(2.2rem + 1px)),
    var(--color-butter);
}

.band--peach {
  background:
    radial-gradient(circle at 0 0, #ffcdb3 0 5rem, transparent calc(5rem + 1px)),
    radial-gradient(circle at 97% 100%, #fff0e6 0 6.5rem, transparent calc(6.5rem + 1px)),
    var(--color-peach);
}

.band--sky {
  background:
    url("../img/decor/cloud.svg") 6% 14% / clamp(6rem, 13vw, 11rem) auto no-repeat,
    url("../img/decor/cloud.svg") 62% 88% / clamp(4.5rem, 9vw, 7.5rem) auto no-repeat,
    url("../img/decor/cloud.svg") 97% 10% / clamp(5rem, 10vw, 8.5rem) auto no-repeat,
    var(--color-sky);
}

.band + .band {
  margin-top: clamp(0.75rem, 2vw, 2rem);
}

/* ---------- 7. Footer ---------- */

.site-footer {
  position: relative;
  margin-top: calc(var(--space-section) + 5.5rem); /* room for the rooster */
}

/* The rooster peeks over the footer edge: only its upper part shows, the rest stays "behind" the footer. */
.site-footer__peek {
  position: absolute;
  right: max(var(--gutter), 8%);
  bottom: 100%;
  height: 9.5rem;
  clip-path: inset(-100vh -100vw 0 -100vw); /* cut only what is below the footer edge */
}

.site-footer__peek .puppet {
  display: block;
  width: 6.5rem;
  height: auto;
  transition: translate 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

/* With JavaScript the rooster stays down until the footer scrolls into view (see main.js). */
.js .site-footer__peek:not(.is-visible) .puppet {
  translate: 0 100%;
}

.site-footer__stage {
  position: relative;
  color: var(--color-on-stage-soft);
  background: var(--color-stage);
}

/* Same scallops as on the stage, pointing up. */
.site-footer__stage::before {
  content: "";
  position: absolute;
  inset: auto 0 calc(100% - 1px);
  height: var(--scallop-size);
  background:
    radial-gradient(
      circle at 50% 100%,
      var(--color-stage) calc(var(--scallop-size) - 1px),
      transparent var(--scallop-size)
    )
    50% 0 / calc(var(--scallop-size) * 2) 100% repeat-x;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
  padding-block: 2.25rem 2.5rem;
  font-size: var(--text-small);
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-on-stage);
}

.site-footer__brand img {
  width: auto;
  height: 4.5rem;
}

.site-footer__social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--color-on-stage);
}

/* Legal links and copyright share a line below the logo and the social links. */
.site-footer__legal {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.25rem;
  border-top: 2px solid rgb(255 255 255 / 0.12);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--color-on-stage);
}

.site-footer a:hover {
  color: var(--color-sun);
}

.site-footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__login {
  margin-left: 1rem;
}
