/* ==========================================================================
 * halloween.css - the Halloween costume (3.22.0).
 *
 * Loaded LAST and unlayered, only while the theme is on, exactly like
 * christmas.css: an unlayered declaration beats every @layer whatever the
 * specificity, so the overrides below win over app.css and over the legacy
 * Developr sheets without a single !important. Everything is scoped to
 * html.esz-halloween, which templates/esoundz/header.php sets.
 *
 * WHAT IT PAINTS
 *
 *   - the header's search row: a cobweb, two carved pumpkins and a spider on
 *     a thread that lowers and climbs (keyframes hw-spider - pure CSS, this
 *     theme ships no JavaScript);
 *   - the header's bottom strip: a purple-to-orange band with a slow drift;
 *   - the lamp under the header: turned from amber to a cold purple;
 *   - every section marker: a carved pumpkin eye;
 *   - the rule under every page title: a dripping candy bar;
 *   - every panel and product card: a drip edge and a web fragment;
 *   - the footer: a purple rule and orange links.
 *
 * NOTHING HERE CHANGES LAYOUT. No padding is added, no element grows, no
 * position:relative is introduced on a container that might have positioned
 * children. That is deliberate: Christmas had to reserve 16px for its garland
 * because the bulbs hang under the sticky header, and every one of those
 * numbers is a chance to move a page. This costume lives inside the header's
 * own box instead.
 * ========================================================================== */


/* --------------------------------------------------------------------------
 * 1. The palette
 *
 * Pumpkin orange, a deep bruise purple, and a candle gold for anything lit.
 * The section colours are left alone: the nav has to keep meaning something.
 * ----------------------------------------------------------------------- */

html.esz-halloween {
  --hw-orange:      #e2661a;
  --hw-orange-lite: #ff9a3c;
  --hw-candle:      #ffcf6b;
  --hw-purple:      #5b2a86;
  --hw-purple-deep: #2a1140;
  --hw-ink:         #15101d;
  --hw-glow:        rgb(226 102 26 / .55);
  --hw-glow-purple: rgb(91 42 134 / .55);
}


/* --------------------------------------------------------------------------
 * 2. The sign in the search row
 *
 * The form is one flex row with the field and button pinned right on a
 * desktop; the sign is its first child with margin-inline-end:auto, which is
 * what makes it own the empty left half. Same placement as the Christmas
 * crest, so the two themes cannot disagree about the header.
 * ----------------------------------------------------------------------- */

html.esz-halloween .site-search { align-items: center; }

html.esz-halloween .hw-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-inline-end: auto;
  padding-inline-end: var(--esz-space-4);
  pointer-events: none;
  user-select: none;
}

html.esz-halloween .hw-banner__web {
  inline-size: 30px;
  block-size: 30px;
  flex: 0 0 auto;
  margin-inline: -6px -2px;
  /* The web is anchored in its own top-left corner, so it has to sit flush
   * against the corner of the region it decorates or the spokes point at
   * nothing. */
  align-self: flex-start;
  margin-block-start: -8px;
}

html.esz-halloween .hw-banner__pumpkins {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
}

html.esz-halloween .hw-banner__pumpkin {
  inline-size: 25px;
  block-size: 23px;
  flex: 0 0 auto;
  filter:
    drop-shadow(0 0 5px rgb(226 102 26 / .45))
    drop-shadow(0 1px 1px rgb(0 0 0 / .6));
}

html.esz-halloween .hw-banner__pumpkins--end .hw-banner__pumpkin {
  transform: scaleX(-1) rotate(-4deg);
}

/* The words. Orange to candle-gold with a slow sheen, the same trick as the
 * Christmas sign, so the two seasonal signs feel cut from the same material. */
html.esz-halloween .hw-banner__word {
  font-family: var(--esz-font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .18em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-inline: var(--esz-space-2);
  color: var(--hw-orange-lite);
  background-image: linear-gradient(100deg,
    #b4440a 0%,
    var(--hw-orange-lite) 22%,
    var(--hw-candle) 38%,
    var(--hw-orange-lite) 54%,
    #b4440a 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 16px rgb(226 102 26 / .3);
  animation: hw-sign 11s linear infinite;
}

@keyframes hw-sign {
  0%   { background-position: 130% 50%; }
  100% { background-position: -30% 50%; }
}


/* --------------------------------------------------------------------------
 * 3. The spider
 *
 * It hangs under the sticky header on a thread, lowers about 30px, hangs
 * there for most of the cycle, then climbs back and waits out of sight. It is
 * one small SVG in a wrapper: the thread is the wrapper's ::after, the
 * movement is a transform.
 *
 * Opacity is 0 while it is up: an element translated above the banner would
 * still be painted over the header bar (the header is z-index 50), and a
 * spider crossing the logo is a bug, not a decoration.
 * ----------------------------------------------------------------------- */

html.esz-halloween .hw-banner__spider {
  position: relative;
  inline-size: 17px;
  block-size: 15px;
  flex: 0 0 auto;
  margin-inline: 1px 3px;
  transform: translateY(-26px);
  opacity: 0;
  animation: hw-spider 19s cubic-bezier(.45, .05, .55, .95) infinite;
}

html.esz-halloween .hw-banner__spider svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / .7));
}

/* The thread runs from the top of the spider up into the header, so wherever
 * the spider is it always reads as attached to something. */
html.esz-halloween .hw-banner__spider::after {
  content: "";
  position: absolute;
  inset-block-end: 100%;
  inset-inline-start: 50%;
  inline-size: 1px;
  block-size: 44px;
  background: linear-gradient(180deg,
    rgb(226 232 240 / 0) 0%,
    rgb(226 232 240 / .35) 22%,
    rgb(226 232 240 / .55) 100%);
}

@keyframes hw-spider {
  0%, 6%    { transform: translateY(-26px); opacity: 0; }
  11%       { opacity: 1; }
  22%, 62%  { transform: translateY(9px);  opacity: 1; }
  74%       { transform: translateY(-6px); opacity: 1; }
  84%, 100% { transform: translateY(-26px); opacity: 0; }
}


/* --------------------------------------------------------------------------
 * 4. The header's bottom strip and lamp
 *
 * The mint "backlit" strip becomes a slow purple-to-orange band, and the warm
 * amber lamp beneath the header goes cold violet - the shop at dusk.
 * ----------------------------------------------------------------------- */

html.esz-halloween .site-header::after {
  block-size: 3px;
  background: linear-gradient(90deg,
    var(--hw-purple-deep) 0%,
    var(--hw-purple) 18%,
    var(--hw-orange) 50%,
    var(--hw-purple) 82%,
    var(--hw-purple-deep) 100%);
  background-size: 200% 100%;
  box-shadow:
    0 0 10px var(--hw-glow),
    0 0 24px rgb(91 42 134 / .45);
  animation: hw-strip 12s ease-in-out infinite;
}

@keyframes hw-strip {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

html.esz-halloween .site-header::before {
  background-image:
    linear-gradient(180deg,
      rgb(91 42 134 / .22) 0%,
      rgb(226 102 26 / .10) 8%,
      rgb(91 42 134 / .04) 18%,
      transparent 34%),
    radial-gradient(60% 120% at 50% 0%,
      rgb(91 42 134 / .24) 0%,
      rgb(226 102 26 / .06) 45%,
      transparent 75%);
}


/* --------------------------------------------------------------------------
 * 5. The section marker - a carved eye
 *
 * The 8px LED before a section label becomes a lit pumpkin eye: a candle
 * core, an orange rim, and the dark cut around it. Scaled rather than
 * resized, so the label does not move.
 * ----------------------------------------------------------------------- */

html.esz-halloween .section-head__label::before {
  background:
    radial-gradient(circle at 50% 55%, var(--hw-candle) 0 34%, var(--hw-orange) 62%, #7a2f06 100%);
  transform: scale(1.6) rotate(45deg);
  border-radius: 40% 60% 45% 60%;
  box-shadow:
    0 0 0 1px rgb(21 16 29 / .9),
    0 0 12px 3px var(--hw-glow),
    inset 0 -1px 2px rgb(0 0 0 / .4);
}


/* --------------------------------------------------------------------------
 * 6. The rule under the page title - a dripping candy bar
 *
 * A 7px bar (the base rule is 3px) with round drips hanging off its bottom:
 * a repeating radial layer whose circles sit half outside the bar, so they
 * read as drips rather than as a dotted line.
 * ----------------------------------------------------------------------- */

html.esz-halloween .page-head h1::after {
  inline-size: 7rem;
  block-size: 8px;
  border-radius: 2px 2px 4px 4px;
  background-image:
    /* the drips: circles sitting on the bar's bottom edge, one every 20px,
     * alternating long and short so the edge does not read as a scallop */
    radial-gradient(circle 3.6px at 8px 6px, var(--hw-orange) 94%, transparent 100%),
    radial-gradient(circle 2.4px at 18px 5px, var(--hw-orange-lite) 94%, transparent 100%),
    linear-gradient(90deg, var(--hw-purple) 0%, var(--hw-orange) 55%, var(--hw-purple) 100%);
  background-size: 20px 14px, 20px 14px, 100% 100%;
  background-position: 0 0, 0 0, 0 0;
  background-repeat: repeat-x, repeat-x, no-repeat;
  box-shadow:
    0 0 10px 0 var(--hw-glow),
    0 0 20px -2px var(--hw-glow-purple);
}

@media (max-width: 47.99rem) {
  html.esz-halloween .page-head h1::after { inline-size: 5.5rem; }
}


/* --------------------------------------------------------------------------
 * 7. Panels - a drip along the top edge
 *
 * background-image, not a pseudo-element: .panel is not a positioning
 * context, and making it one could move children that are already
 * positioned. The picture is clipped by the panel's own radius.
 * ----------------------------------------------------------------------- */

html.esz-halloween .panel:not(.panel--flush) {
  background-image:
    /* drips, smaller than the bar's: a 5px blob on a 3px rule read as piping,
     * not as something running down the card */
    radial-gradient(circle 3.6px at 10px 3px, var(--hw-purple) 94%, transparent 100%),
    radial-gradient(circle 2.2px at 22px 2px, var(--hw-purple) 94%, transparent 100%),
    linear-gradient(90deg,
      var(--hw-purple) 0%,
      var(--hw-orange) 42%,
      var(--hw-orange) 58%,
      var(--hw-purple) 100%);
  background-repeat: repeat-x, repeat-x, no-repeat;
  background-size: 26px 10px, 26px 10px, 100% 2px;
  background-position: 0 0, 0 0, top left;
}

html.esz-halloween .panel--flush {
  /* The edge-to-edge variant: a picture well or the masthead stage. A drip
   * painted over its artwork would read as a defect. */
  background-image: none;
}


/* --------------------------------------------------------------------------
 * 8. Product cards - a web fragment in the corner
 *
 * Two crossing line patterns masked to a quarter circle in the top-right
 * corner: at card size that reads as a web caught on the frame. The card
 * already clips its contents, so the mask is only there to shape it.
 * ----------------------------------------------------------------------- */

html.esz-halloween .product-card::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  inline-size: 38px;
  block-size: 38px;
  z-index: 3;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg,
      transparent 0 6px, rgb(255 255 255 / .78) 6px 7px),
    repeating-linear-gradient(-45deg,
      transparent 0 7px, rgb(255 255 255 / .6) 7px 8px),
    repeating-radial-gradient(circle at 100% 0,
      transparent 0 9px, rgb(255 255 255 / .55) 9px 10px);
  -webkit-mask-image: radial-gradient(circle 38px at 100% 0, #000 0 96%, transparent 100%);
  mask-image: radial-gradient(circle 38px at 100% 0, #000 0 96%, transparent 100%);
  opacity: .75;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / .35));
}


/* --------------------------------------------------------------------------
 * 9. The footer
 * ----------------------------------------------------------------------- */

html.esz-halloween .site-footer {
  border-block-start: 2px solid transparent;
  border-image: linear-gradient(90deg,
      var(--hw-purple) 0%,
      var(--hw-orange) 50%,
      var(--hw-purple) 100%) 1;
}

html.esz-halloween .site-footer a { color: var(--hw-orange-lite); }
html.esz-halloween .site-footer a:hover { color: var(--hw-candle); }


/* --------------------------------------------------------------------------
 * 10. The legacy shell
 *
 * Old pages load the Developr sheets and have no .site-header. header.php
 * prints the same sign inside .esz-legacy-season there; this turns it into a
 * centred band across the top of the document.
 * ----------------------------------------------------------------------- */

html.esz-halloween .esz-legacy-season--halloween {
  display: flex;
  justify-content: center;
  padding-block: 8px;
  background-image: linear-gradient(180deg, var(--hw-purple-deep), transparent);
}

html.esz-halloween .esz-legacy-season--halloween .hw-banner {
  margin-inline: 0;
  padding-inline: 0;
}


/* --------------------------------------------------------------------------
 * 11. Small screens and reduced motion
 *
 * Phone: the words and the far pumpkin go; one pumpkin, the web and the
 * spider stay - the same trim the Christmas sign takes.
 * ----------------------------------------------------------------------- */

@media (max-width: 63.99rem) {
  html.esz-halloween .hw-banner__word { display: none; }
  html.esz-halloween .hw-banner__pumpkins--end { display: none; }
  html.esz-halloween .hw-banner {
    padding-inline-end: var(--esz-space-2);
    gap: 2px;
  }
  html.esz-halloween .hw-banner__pumpkin { inline-size: 21px; block-size: 19px; }
  html.esz-halloween .hw-banner__web { inline-size: 24px; block-size: 24px; }
}

@media (max-width: 20rem) {
  html.esz-halloween .hw-banner__web { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  /* The decorations stay - it is still Halloween - but nothing moves. The
   * spider is parked half-way down its thread so it is visible without
   * animating. */
  html.esz-halloween .hw-banner__word,
  html.esz-halloween .site-header::after { animation: none; }
  html.esz-halloween .hw-banner__word { background-position: 38% 50%; }
  html.esz-halloween .hw-banner__spider {
    animation: none;
    opacity: 1;
    transform: translateY(6px);
  }
}
