/*
 * Shared components — header, nav, footer, badges, wax seal.
 * Regalo Natale / "Il Formulario"
 */

/* ---------- Utility bar ---------- */

.rn-utility-bar {
  background-color: var(--rn-green-800);
  background-image: var(--rn-grain-on-dark);
  color: var(--rn-on-green);
}

.rn-utility-bar__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rn-space-md);
  min-height: 2.6rem;
  font-family: var(--rn-font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rn-utility-bar__divider {
  width: 1px;
  height: 0.9em;
  background: var(--rn-gold-500);
  opacity: 0.7;
}

/* ---------- Header ---------- */

.rn-header {
  background-color: var(--rn-cream);
  background-image: var(--rn-grain-on-light);
  position: sticky;
  /*
   * WordPress's admin bar is position:fixed at the top of the viewport
   * for logged-in users, so a sticky header at top:0 slid underneath it
   * and the wordmark collided with the admin bar's own links. WordPress
   * exposes its height as a custom property; the fallback keeps
   * top:0 for logged-out visitors, who have no admin bar.
   */
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 10;
  box-shadow: 0 8px 18px -10px rgba(22, 36, 27, 0.35);
}

.rn-header__row {
  /*
   * Grid (not flex) so the wordmark sits on the row's true centre.
   * A flex:1 brand-wrap next to a fixed-width sleigh icon centres the
   * logo only within the leftover space, shifting it visibly left of
   * centre — worse on narrow screens where the offset is a bigger
   * share of the total width. A 3-column grid with an empty spacer
   * column matching the sleigh's width keeps the middle column
   * genuinely centred regardless of icon width.
   */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-block: var(--rn-space-md);
  gap: var(--rn-space-md);
}

.rn-header__row .rn-header__sleigh {
  grid-column: 3;
  justify-self: end;
}

.rn-header__wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-family: var(--rn-font-display);
  font-weight: 600;
  font-size: 1.9rem;
  letter-spacing: 0.06em;
  color: var(--rn-green-900);
  text-transform: uppercase;
}

.rn-header__flourish {
  /* Authored SVG rule-and-seal ornament, replacing a unicode glyph
     (❦) that rendered in whatever serif the OS happened to supply. */
  display: block;
  width: 62px;
  height: 10px;
  fill: none;
  stroke: var(--rn-gold-500);
  stroke-width: 1;
  stroke-linecap: round;
}

.rn-header__logo img {
  max-height: 64px;
  width: auto;
}

.rn-header__brand-wrap {
  grid-column: 2;
  display: flex;
  justify-content: center;
}

/* ---------- Sleigh cart icon ---------- */

.rn-header__sleigh {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  width: 60px;
  height: 46px;
  padding-top: 14px;
}

.rn-sleigh {
  width: 60px;
  height: 36px;
  overflow: visible;
}

.rn-sleigh__body,
.rn-sleigh__curl {
  fill: none;
  stroke: var(--rn-bordeaux-700);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rn-sleigh__body {
  fill: var(--rn-bordeaux-600);
}

.rn-sleigh__runner,
.rn-sleigh__runner-tick {
  stroke: var(--rn-gold-500);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.rn-header__sleigh:hover .rn-sleigh,
.rn-header__sleigh:focus-visible .rn-sleigh {
  transform: translateY(-1px);
}

.rn-sleigh__cargo {
  /*
   * Sits just above the sleigh's cargo basket (the body path spans
   * roughly y:14-33 in the 72x44 viewBox, i.e. the top ~14px of the
   * 46px-tall icon box), so gift boxes read as piled ON the sleigh,
   * not sunk inside/behind its silhouette. bottom:32px (vs. the old
   * 15px, which sat mid-body) clears the basket's rim.
   */
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  z-index: 1;
}

.rn-sleigh__package {
  width: 12px;
  height: 11px;
  transform-origin: bottom center;
  animation: rn-package-drop 0.32s ease-out;
}

.rn-sleigh__package svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes rn-package-drop {
  0% {
    transform: translateY(-10px) scale(0.6);
    opacity: 0;
  }
  60% {
    transform: translateY(1px) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.rn-header__sleigh.is-sealing .rn-sleigh {
  animation: rn-sleigh-jolt 0.32s ease;
}

@keyframes rn-sleigh-jolt {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  40% {
    transform: translateY(-2px) rotate(-2deg);
  }
  70% {
    transform: translateY(1px) rotate(1deg);
  }
}

.rn-header__seal-count {
  /*
   * Sits OUTSIDE the icon's own box (top/right negative), not inside
   * it. It used to sit at top:6px/right:2px, inside the same 60x46
   * box the cargo packages fill left-to-right — with 3+ items in the
   * cart the badge landed directly on top of the newest package,
   * covering half of it. Moving it outside the box (standard cart
   * badge placement) keeps it clear of the cargo row at any count.
   */
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--rn-gold-400);
  color: var(--rn-green-900);
  font-family: var(--rn-font-label);
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.rn-header__rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rn-gold-400) 15%, var(--rn-gold-400) 85%, transparent);
}

/* ---------- Nav ---------- */

.rn-nav {
  background: var(--rn-cream);
  border-bottom: 1px solid var(--rn-paper-line);
}

.rn-nav__list {
  display: flex;
  justify-content: center;
  gap: var(--rn-space-lg);
  list-style: none;
  margin: 0;
  padding: 0.85rem 0;
  flex-wrap: wrap;
}

.rn-nav__list a {
  font-family: var(--rn-font-label);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--rn-green-800);
}

.rn-nav__list a:hover,
.rn-nav__list a:focus {
  color: var(--rn-bordeaux-600);
}

.rn-nav__list li.current-menu-item > a {
  color: var(--rn-bordeaux-600);
  border-bottom: 1px solid var(--rn-bordeaux-600);
  padding-bottom: 0.2rem;
}

/* ---------- Ledger number tag ---------- */

.rn-ledger-tag {
  /*
   * Small brass-plate feel: a light bevel (bright top edge, darker
   * bottom edge) plus a soft drop shadow so the tag reads as a
   * stamped metal plate sitting slightly above the card, not a flat
   * colour chip.
   */
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  font-family: var(--rn-font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--rn-green-900);
  background: linear-gradient(180deg, var(--rn-gold-300), var(--rn-gold-500));
  border: 1px solid var(--rn-gold-600);
  border-radius: 3px;
  padding: 0.2em 0.55em;
  box-shadow:
    0 2px 4px rgba(10, 20, 12, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 2px rgba(0, 0, 0, 0.12);
}

.rn-ledger-tag__label {
  font-style: italic;
  opacity: 0.75;
}

/* ---------- Wax seal button (primary CTA) ---------- */

.rn-seal-button {
  --rn-seal-size: 130px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rn-seal-size);
  height: var(--rn-seal-size);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 32% 28%, var(--rn-bordeaux-600) 0%, var(--rn-bordeaux-700) 55%, var(--rn-bordeaux-900) 100%);
  color: var(--rn-on-bordeaux);
  font-family: var(--rn-font-label);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  box-shadow:
    0 6px 14px rgba(22, 12, 8, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.18),
    inset 0 -6px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rn-seal-button::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 10px;
  height: 14px;
  background: var(--rn-bordeaux-800, var(--rn-bordeaux-900));
  border-radius: 0 0 6px 6px;
  transform: translateX(-50%);
  opacity: 0.9;
}

.rn-seal-button:hover,
.rn-seal-button:focus-visible {
  transform: scale(1.045) rotate(-1deg);
  box-shadow:
    0 9px 18px rgba(22, 12, 8, 0.4),
    inset 0 2px 3px rgba(255, 255, 255, 0.2),
    inset 0 -6px 10px rgba(0, 0, 0, 0.28);
}

.rn-seal-button:active {
  transform: scale(0.97);
}

.rn-seal-button.is-sealing,
.rn-header__seal-disc.is-sealing {
  transform: scale(0.88);
  transition: transform 0.15s ease;
}

.rn-seal-button--small {
  --rn-seal-size: 84px;
  font-size: 0.68rem;
}

/* ---------- Brass badges ---------- */

/*
 * Trust row. Was three bordered, shadowed, gradient-filled cards —
 * the generic icon+heading+text card triplet. Now one row of three
 * claims separated by hairlines: no box, no shadow, no fill, so it
 * reads as a quiet statement of fact rather than three ads.
 */
.rn-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding-block: var(--rn-space-md);
  margin: 0;
  list-style: none;
}

.rn-badge {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.2rem var(--rn-space-md);
  color: inherit;
}

.rn-badge + .rn-badge {
  border-left: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.rn-badge__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rn-badge__icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.rn-badge__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.rn-badge__title {
  font-family: var(--rn-font-label);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: inherit;
}

.rn-badge__note {
  font-family: var(--rn-font-display);
  font-size: 0.9rem;
  font-style: italic;
  color: inherit;
  opacity: 0.62;
}

/* ---------- Footer ---------- */

.rn-footer {
  background-color: var(--rn-green-900);
  background-image: var(--rn-grain-on-dark);
  color: var(--rn-on-green);
  margin-top: var(--rn-space-2xl);
}

.rn-footer__badges {
  background: var(--rn-green-800);
}

.rn-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--rn-space-lg);
  padding-block: var(--rn-space-xl);
}

.rn-footer__wordmark {
  font-family: var(--rn-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rn-footer__tagline {
  margin-top: var(--rn-space-sm);
  max-width: 34ch;
  color: var(--rn-gold-300);
  font-size: 0.95rem;
}

.rn-footer__col-title {
  font-family: var(--rn-font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rn-gold-400);
  margin-bottom: var(--rn-space-sm);
}

.rn-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rn-footer__col a {
  color: var(--rn-on-green);
  font-size: 0.92rem;
}

.rn-footer__col a:hover,
.rn-footer__col a:focus {
  color: var(--rn-gold-300);
}

.rn-footer__legal {
  border-top: 1px solid rgba(246, 237, 224, 0.15);
  padding-block: var(--rn-space-sm);
  font-family: var(--rn-font-label);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: rgba(246, 237, 224, 0.65);
}

/* ---------- Cross-category strip ---------- */

.rn-cross-strip {
  background: var(--rn-cream-deep);
  border-top: var(--rn-border-hairline);
  padding-block: var(--rn-space-xl);
  margin-top: var(--rn-space-lg);
}

.rn-cross-strip__title {
  margin-bottom: var(--rn-space-md);
}

.rn-cross-strip__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rn-space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
}

.rn-cross-strip__tab {
  display: inline-block;
  background: var(--rn-cream);
  border: 1px solid var(--rn-gold-400);
  border-radius: 3px;
  padding: 0.6rem 1.1rem;
  font-family: var(--rn-font-label);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--rn-green-800);
  transition: background 0.2s ease, color 0.2s ease;
}

.rn-cross-strip__tab:hover,
.rn-cross-strip__tab:focus {
  background: var(--rn-green-800);
  color: var(--rn-on-green);
}

/* ---------- Christmas mood music toggle ---------- */

/*
 * The panel is always laid out at full width and parked off-screen on
 * a transform, then slid in on hover/focus. Animating transform (not
 * width/padding) keeps the whole thing off the layout path — the
 * earlier width transition re-laid out the fixed panel on every frame.
 * The icon stays visible because it's translated back by the same
 * amount the panel is pushed out.
 */
.rn-mood-toggle {
  position: fixed;
  right: 0;
  top: 62%;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--rn-gold-500);
  border-right: none;
  border-radius: 4px 0 0 4px;
  background: var(--rn-green-800);
  color: var(--rn-on-green);
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  width: 17.5rem;
  max-width: 90vw;
  text-align: left;
  transform: translateX(calc(100% - 3rem));
  box-shadow: -4px 6px 18px -6px rgba(10, 20, 12, 0.55);
  transition:
    transform var(--rn-dur) var(--rn-ease),
    background-color var(--rn-dur-fast) var(--rn-ease);
}

.rn-mood-toggle:hover,
.rn-mood-toggle:focus-visible {
  transform: translateX(0);
  background: var(--rn-green-700);
}

.rn-mood-toggle__icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rn-gold-400);
  color: var(--rn-green-900);
}

.rn-mood-toggle__note {
  display: block;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/*
 * Playing state pulses the note rather than spinning it: a rotating
 * icon reads as "loading", which is the wrong signal for audio.
 */
.rn-mood-toggle.is-playing .rn-mood-toggle__note {
  animation: rn-note-pulse 1.6s var(--rn-ease) infinite;
}

@keyframes rn-note-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.86);
    opacity: 0.7;
  }
}

.rn-mood-toggle__label {
  font-family: var(--rn-font-display);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--rn-on-green);
  white-space: normal;
  opacity: 0;
  transition: opacity var(--rn-dur) var(--rn-ease);
}

.rn-mood-toggle:hover .rn-mood-toggle__label,
.rn-mood-toggle:focus-visible .rn-mood-toggle__label {
  opacity: 1;
}

.rn-mood-toggle.is-playing {
  border-color: var(--rn-bordeaux-500);
}

.rn-mood-toggle.is-playing .rn-mood-toggle__icon {
  background: var(--rn-bordeaux-600);
  color: var(--rn-on-bordeaux);
}

@media (prefers-reduced-motion: reduce) {
  .rn-mood-toggle.is-playing .rn-mood-toggle__note {
    animation: none;
  }
}

@media (max-width: 780px) {
  /* On touch there is no hover to reveal the panel, so it collapses to
     a round icon-only control that toggles playback on tap. */
  .rn-mood-toggle {
    top: auto;
    bottom: 1.1rem;
    right: 1.1rem;
    width: auto;
    border-radius: 50%;
    border-right: 1px solid var(--rn-gold-500);
    padding: 0.7rem;
    transform: none;
  }
  .rn-mood-toggle:hover,
  .rn-mood-toggle:focus-visible {
    transform: none;
  }
  .rn-mood-toggle__label {
    display: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  /*
   * Site-wide side margin was --rn-space-md (28px) everywhere,
   * fine on tablets but visually tight against the edge on phones —
   * the user's own screenshots showed non-boxed content (breadcrumb,
   * product title, description text) sitting almost flush with the
   * screen edge. Nudge the base container padding up a bit on true
   * phone widths only; tablets keep the original 28px.
   */
  .rn-container {
    padding-inline: 1.9rem;
  }
}

@media (max-width: 780px) {
  .rn-utility-bar__row {
    gap: 0.5rem;
    padding-block: 0.4rem;
    min-height: auto;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }
  .rn-header__row {
    padding-block: var(--rn-space-sm);
  }
  .rn-header__wordmark {
    font-size: 1.15rem;
    letter-spacing: 0.03em;
  }
  .rn-header__flourish {
    font-size: 0.7rem;
  }
  .rn-header__logo img {
    max-height: 40px;
  }
  .rn-nav {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .rn-nav::-webkit-scrollbar {
    display: none;
  }
  .rn-nav::after {
    /* Fade hint on the right edge signalling more nav items are
       scrollable — without it, the last item just looks cut off. */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(90deg, transparent, var(--rn-cream));
    pointer-events: none;
  }
  .rn-nav .rn-container {
    padding-inline: var(--rn-space-sm);
  }
  .rn-nav__list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: var(--rn-space-md);
    padding-block: 0.65rem;
    width: max-content;
  }
  .rn-nav__list a {
    white-space: nowrap;
  }
  .rn-badges {
    grid-template-columns: 1fr;
  }
  /* Stacked on narrow screens: separator flips from vertical to
     horizontal so it stays a divider and never reads as a coloured
     left border on each row. */
  .rn-badge {
    padding-block: 0.55rem;
  }
  .rn-badge + .rn-badge {
    border-left: 0;
    border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  }
  .rn-footer__grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Authored entrance ---------- */

/*
 * One authored moment, not an effect per section: catalogue items and
 * category tiles settle in with a short staggered rise the first time
 * they reach the viewport. The default state is already visible (no
 * opacity:0 baked into CSS) so the page is fully readable if JS never
 * runs or fails — the class is only added by JS once it has decided to
 * animate, and removed after it plays.
 */
.rn-reveal {
  opacity: 0;
  transform: translateY(14px);
}

.rn-reveal.is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--rn-dur-slow) var(--rn-ease),
    transform var(--rn-dur-slow) var(--rn-ease);
  transition-delay: var(--rn-reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .rn-reveal,
  .rn-reveal.is-revealed {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
