/* nanohouz holiday decorations (docs/HOLIDAYS.md). The edge adds this file, holiday.js and
   <html data-holiday="<key>">. Decoration only: pseudo-elements or aria-hidden nodes, pointer-events: none,
   never over text, never in print; particles stop under prefers-reduced-motion. */

/* Each theme's art, in one place: the strip tile (and its height), the corner piece on the dark hero. */
html[data-holiday="new-year"] { --nh-strip: url(strip-new-year.svg); --nh-corner: url(corner-new-year.svg); }
html[data-holiday="valentines"] { --nh-strip: url(strip-valentines.svg); --nh-corner: url(corner-valentines.svg); }
html[data-holiday="st-patricks"] { --nh-strip: url(strip-st-patricks.svg); --nh-corner: url(corner-st-patricks.svg); }
html[data-holiday="easter"] { --nh-strip: url(strip-easter.svg); --nh-corner: url(corner-easter.svg); }
html[data-holiday="mothers-day"] { --nh-strip: url(strip-mothers-day.svg); --nh-corner: url(corner-mothers-day.svg); }
html[data-holiday="fathers-day"] { --nh-strip: url(strip-fathers-day.svg); --nh-strip-h: 6px; --nh-corner: url(corner-fathers-day.svg); }
html[data-holiday="independence-day"] { --nh-strip: url(strip-independence-day.svg); --nh-strip-h: 18px; --nh-corner: url(corner-independence-day.svg); }
html[data-holiday="labor-day"] { --nh-strip: url(strip-labor-day.svg); --nh-strip-h: 10px; --nh-corner: url(corner-labor-day.svg); }
html[data-holiday="thanksgiving"] { --nh-strip: url(strip-thanksgiving.svg); --nh-strip-h: 18px; --nh-corner: url(corner-thanksgiving.svg); }
html[data-holiday="christmas"] { --nh-strip: url(strip-christmas.svg); --nh-strip-h: 18px; --nh-corner: url(corner-christmas.svg); }
/* Respectful days: a ribbon and its centre mark, nothing else (no corner piece, no particles). Memorial Day wears a
   remembrance poppy on a quiet navy-and-red ribbon; Veterans Day five gold stars on the ribbon with its cream line. */
html[data-holiday="memorial-day"] { --nh-strip-layers: url(emblem-memorial-day.svg) center top no-repeat, url(strip-memorial-day.svg) left top repeat-x; --nh-strip-h: 20px; }
html[data-holiday="veterans-day"] { --nh-strip-layers: url(emblem-veterans-day.svg) center top no-repeat, url(strip-veterans-day.svg) left top repeat-x; --nh-strip-h: 20px; }

/* ── (a) The strip: along the top edge of the fixed site header (body > #nav), in its top padding. While a theme is on
   the header's top padding is 28px (20px + 8px), also once .scrolled, so the tallest art (20px) stays clear of the
   logo, the links and the Contact Us button. <html data-holiday> is in the server-rendered HTML: no layout shift.
   Pages without that header (client guide, 404) get no strip. Tiles are drawn at their pixel size, so they stay
   crisp. ── */
html[data-holiday] body > #nav,
html[data-holiday] body > #nav.scrolled { padding-top: calc(1.25rem + 8px); }

html[data-holiday] body > #nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nh-strip-h, 16px);
  background: var(--nh-strip-layers, var(--nh-strip) left top repeat-x);
  pointer-events: none;
}

/* ── The banner (content, server-rendered): a thin note under the header, on the header's own colour ── */
.nh-holiday-banner,
.nh-holiday-spacer::before {
  display: block;
  padding: 0.4rem clamp(1rem, 4vw, 3rem);
  font-family: var(--font-body, Montserrat, system-ui, sans-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.03em;
  text-align: center;
  text-wrap: balance;
  color: #f2da9b;
  background: #231f19;
  border-top: 1px solid rgba(201, 164, 92, 0.35);
  border-bottom: 1px solid rgba(201, 164, 92, 0.35);
}

/* nanohouz.com's header is fixed. The note sits just under the bar in page coordinates, so it scrolls away with the
   page (under the bar and its mobile menu) instead of riding along over the content. Its top is the bar's height
   (nav.css: a 37px row, or the 42px menu button up to 768px, with 28px above while a theme is on and 20px below,
   12px below once .scrolled), and follows the bar when it changes. */
#nav + .nh-holiday-banner {
  position: absolute;
  top: 85px;
  left: 0;
  right: 0;
  z-index: 99; /* under the .nav (100) */
  transition: top 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* the bar's own */
}
#nav.scrolled + .nh-holiday-banner { top: 77px; }

@media (max-width: 768px) {
  #nav + .nh-holiday-banner { top: 90px; }
  #nav.scrolled + .nh-holiday-banner { top: 82px; }
}

/* The spacer after the note lays out the same text in the same box, invisibly, so the page starts that much lower
   and the note covers nothing. Where the first section is dark and patterned, a band here would be a seam behind the
   see-through header, so the room moves into that section instead. */
/* Its 8px of top padding is the header's extra 8px while a theme is on, so light pages keep their own gap. */
.nh-holiday-spacer { padding-top: 8px; background: #1a1714; } /* the ink: browsers without :has() */
.nh-holiday-spacer::before {
  content: attr(data-text);
  visibility: hidden;
}

@supports selector(:has(+ *)) {
  /* Light pages (articles, legal) have a solid header: the room is simply the page. */
  .nh-holiday-spacer { background: none; }
  /* Floor plans start on flat ink: ink, one surface with the header. */
  .nh-holiday-spacer:has(+ .fp-header) { background: #1a1714; }
  /* The home-style hero and a plan's hero run up behind the header as usual; the hero's text moves down instead
     (a plan's text sits at the bottom of its hero already). */
  .nh-holiday-spacer:has(+ :is(.hero, .model-hero)) { display: none; }
  .nh-holiday-spacer + .hero > .hero-content { padding-top: calc(10rem + 12px); }
}

@media (max-width: 768px) {
  @supports selector(:has(+ *)) {
    .nh-holiday-spacer + .hero > .hero-content { padding-top: calc(11rem + 8px); }
  }
}

/* ── The corner piece: a still accent at the top right of the dark hero, 24px under the header (or under the note,
   whatever its height), in the room the hero's text leaves. Every theme but Memorial and Veterans Day, at every
   width, with or without motion. ── */
html[data-holiday]:not([data-holiday="memorial-day"], [data-holiday="veterans-day"]) :is(.hero > .hero-pattern, .nh-holiday-banner:has(+ .nh-holiday-spacer + .hero))::after {
  content: '';
  position: absolute;
  right: clamp(1.5rem, 4vw, 3rem);
  width: 72px;
  height: 56px;
  background: var(--nh-corner) right top / contain no-repeat;
  pointer-events: none;
}
html[data-holiday] .hero > .hero-pattern::after { top: 109px; }
html[data-holiday] .nh-holiday-banner ~ .hero > .hero-pattern::after { top: 142px; } /* browsers without :has() */
/* With a note, the piece hangs from the note itself, so a note of two or three lines never covers it. */
html[data-holiday] .nh-holiday-banner:has(+ .nh-holiday-spacer + .hero)::after { top: calc(100% + 24px); }
@supports selector(:has(+ *)) {
  html[data-holiday] .nh-holiday-banner ~ .hero > .hero-pattern::after { display: none; }
}

@media (max-width: 768px) {
  html[data-holiday] .hero > .hero-pattern::after { top: 114px; right: 16px; }
  html[data-holiday] .nh-holiday-banner:has(+ .nh-holiday-spacer + .hero)::after { right: 16px; }
}

/* ── (b) Particles (holiday.js): wide screens only, inside the dark hero's empty right side: under the header and
   the note, left of the corner piece and the consultation tab, above the hero's stats. Under 1200px, and with
   reduced motion, the corner piece alone. ── */
.nh-holiday-fx {
  position: absolute;
  top: 109px;
  right: calc(clamp(1.5rem, 4vw, 3rem) + 96px); /* the corner piece (72px) and 24px of air */
  bottom: 160px;
  left: 56%;
  z-index: 1; /* over .hero-bg, under .hero-content / .model-hero-content (2) */
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 90%, transparent);
}
.nh-holiday-banner ~ .hero > .nh-holiday-fx { top: 142px; }

.nh-p {
  position: absolute;
  top: calc(-1 * var(--s));
  left: var(--x);
  width: calc(var(--s) * var(--k, 1));
  height: var(--s);
  opacity: 0;
  animation: nh-fall var(--d) linear var(--delay) infinite;
  will-change: transform, opacity;
}

.nh-p::before {
  content: '';
  position: absolute;
  inset: 0;
  background: center / contain no-repeat;
  animation: nh-sway var(--sd) ease-in-out var(--delay) infinite alternate;
}

/* Twinkles in place (sparkles, fireworks bursts). */
.nh-p--tw {
  top: var(--y);
  animation-name: nh-twinkle;
  animation-timing-function: ease-in-out;
}
.nh-p--tw::before { animation: none; }

.nh-holiday-fx.is-paused .nh-p,
.nh-holiday-fx.is-paused .nh-p::before {
  animation-play-state: paused;
}

@keyframes nh-fall {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  12%, 82% { opacity: var(--o); }
  100% { transform: translate3d(0, var(--fall), 0); opacity: 0; }
}

@keyframes nh-sway {
  from { transform: translateX(calc(-1 * var(--sway))) rotate(calc(-1 * var(--spin, 0deg))); }
  to { transform: translateX(var(--sway)) rotate(var(--spin, 0deg)); }
}

@keyframes nh-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.6); }
  50% { opacity: var(--o); transform: scale(1); }
}

.nh-p--snow::before { background-image: url(p-snow.svg); }
.nh-p--snow { --spin: 40deg; }
.nh-p--snowdot { width: calc(var(--s) * 0.38); height: calc(var(--s) * 0.38); }
.nh-p--snowdot::before { background: radial-gradient(circle, #f3efe8 0 45%, rgba(243, 239, 232, 0) 72%); }
.nh-p--sparkle::before { background-image: url(p-sparkle.svg); }
/* Confetti: champagne and gold slips, 3 x 8px, turning slowly. */
.nh-p[class*="nh-p--confetti"] { --spin: 120deg; width: 3px; height: 8px; }
.nh-p[class*="nh-p--confetti"]::before { border-radius: 1px; }
.nh-p--confetti-champagne::before { background: #f3e3b8; }
.nh-p--confetti-gold::before { background: #e6c77a; }
.nh-p--confetti-deep::before { background: #c9a45c; }
.nh-p--heart-red,
.nh-p--heart-blush { --spin: 12deg; }
.nh-p--heart-red::before { background-image: url(p-heart-red.svg); }
.nh-p--heart-blush::before { background-image: url(p-heart-blush.svg); }
.nh-p--shamrock { --spin: 30deg; }
.nh-p--shamrock::before { background-image: url(p-shamrock.svg); }
.nh-p[class*="nh-p--blossom"] { --spin: 60deg; }
.nh-p--blossom-blush::before { background-image: url(p-blossom-blush.svg); }
.nh-p--blossom-butter::before { background-image: url(p-blossom-butter.svg); }
.nh-p--blossom-sage::before { background-image: url(p-blossom-sage.svg); }
.nh-p--burst-gold::before { background-image: url(p-burst-gold.svg); }
.nh-p--burst-cream::before { background-image: url(p-burst-cream.svg); }
.nh-p--burst-red::before { background-image: url(p-burst-red.svg); }
.nh-p[class*="nh-p--maple"],
.nh-p--leaf-gold { --spin: 45deg; }
.nh-p--maple-amber::before { background-image: url(p-maple-amber.svg); }
.nh-p--maple-rust::before { background-image: url(p-maple-rust.svg); }
.nh-p--leaf-gold::before { background-image: url(p-leaf-gold.svg); }

@media (max-width: 1199px) {
  .nh-holiday-fx { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nh-holiday-fx { display: none; }
}

/* ── The visitor's switch (holiday.js): "Hide decorations", bottom left. A labelled pill while the dark hero fills
   the screen; elsewhere a 40px disc (44px on touch) that shows its label on hover and focus, so it never sits over
   text. It slides away while the page scrolls down and comes back on the way up. ── */
.nh-holiday-toggle {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 997; /* under the scroll-to-top button and the consultation tab */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-width: 36px;
  padding: 0 14px 0 12px;
  font-family: var(--font-body, Montserrat, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  color: #f3ecdf;
  background: rgba(28, 25, 21, 0.92);
  border: 1px solid rgba(201, 164, 92, 0.6);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background-color 0.2s;
}
.nh-holiday-toggle svg { width: 12px; height: 12px; flex: none; display: block; color: #f2da9b; }
.nh-holiday-toggle:hover { border-color: #d4ad5e; }
.nh-holiday-toggle:focus-visible { outline: 2px solid #c9a45c; outline-offset: 2px; border-color: #d4ad5e; }
/* Compact: the disc; the label comes back on hover and focus (and stays readable to screen readers). */
.nh-holiday-toggle.is-compact:not(:hover, :focus-visible) {
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
}
.nh-holiday-toggle.is-compact:not(:hover, :focus-visible) svg { width: 14px; height: 14px; }
.nh-holiday-toggle.is-compact:not(:hover, :focus-visible) .nh-holiday-toggle__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.nh-holiday-toggle.is-away:not(:focus-visible) { transform: translateY(calc(100% + 32px)); }
@media (pointer: coarse) {
  .nh-holiday-toggle,
  .nh-holiday-toggle.is-compact:not(:hover, :focus-visible) { height: 44px; min-width: 44px; }
  .nh-holiday-toggle.is-compact:not(:hover, :focus-visible) { width: 44px; }
}
/* Pressed: decorations are hidden; the gold button offers them back. */
.nh-holiday-toggle[aria-pressed="true"] { color: #1a1714; background: #d4ad5e; border-color: #d4ad5e; }
.nh-holiday-toggle[aria-pressed="true"] svg { color: #1a1714; }
@media (prefers-reduced-motion: reduce) {
  .nh-holiday-toggle { transition: none; }
}

html.nh-holiday-off #nav::before,
html.nh-holiday-off .hero > .hero-pattern::after,
html.nh-holiday-off .nh-holiday-banner::after,
html.nh-holiday-off .nh-holiday-fx { display: none; }

@media print {
  html[data-holiday] #nav::before,
  html[data-holiday] .hero > .hero-pattern::after,
  html[data-holiday] .nh-holiday-banner::after,
  .nh-holiday-fx,
  .nh-holiday-toggle,
  .nh-holiday-banner,
  .nh-holiday-spacer { display: none !important; }
}
