/* ==========================================================================
   October / Halloween additions — loaded after styles.css, inert outside October.
   The date gate lives in JS (halloween.js sets body[data-halloween-month="1"]);
   every rule here is scoped to that attribute so the rest of the year is
   untouched.

   1. Dreyfus Art "Halloween Calendar 2026" behind the login card
   2. One corner glyph per main-tab box, alternating sides (pumpkin / ghost /
      vampire)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Login background
   -------------------------------------------------------------------------- */

body[data-halloween-month="1"] #login-screen {
  position: relative;
  isolation: isolate;
  background: var(--bg);
  overflow: hidden;
}

body[data-halloween-month="1"] #login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* JPEG first so browsers without image-set() still get the artwork below. */
  background:
    linear-gradient(180deg, rgba(18, 6, 26, 0.5) 0%, rgba(10, 4, 16, 0.76) 100%),
    radial-gradient(ellipse 78% 52% at 50% 50%, rgba(9, 4, 14, 0.62), rgba(9, 4, 14, 0) 72%),
    url('/images/login-halloween-2026.jpg') center 55% / cover no-repeat;
  background-image:
    linear-gradient(180deg, rgba(18, 6, 26, 0.5) 0%, rgba(10, 4, 16, 0.76) 100%),
    radial-gradient(ellipse 78% 52% at 50% 50%, rgba(9, 4, 14, 0.62), rgba(9, 4, 14, 0) 72%),
    image-set(
      url('/images/login-halloween-2026.webp') type('image/webp'),
      url('/images/login-halloween-2026.jpg') type('image/jpeg')
    );
  background-size: auto, auto, cover;
  background-position: center, center, center 55%;
  background-repeat: no-repeat, no-repeat, no-repeat;
  filter: saturate(1.04) brightness(0.94) contrast(1.02);
}

/* Wide screens crop a tall poster hard — aim at the "OCTOBER" arch instead of
   the middle of the artwork. */
@media (min-aspect-ratio: 1/1) {
  body[data-halloween-month="1"] #login-screen::before {
    background-position: center, center, center 22%;
  }
}

/* Keep the sign-in card readable against a much busier background. */
body[data-halloween-month="1"] .login-card {
  background: linear-gradient(180deg, rgba(30, 15, 40, 0.94), rgba(15, 7, 22, 0.97));
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 214, 150, 0.06);
}

body[data-halloween-month="1"] .login-festive-accent {
  height: 8px;
  background: linear-gradient(90deg, #7c2d12 0%, #f97316 28%, #a855f7 62%, #22c55e 88%, #facc15 100%);
}

body[data-halloween-month="1"] .login-card h1 {
  text-shadow: 0 2px 18px rgba(249, 115, 22, 0.28);
}

/* --------------------------------------------------------------------------
   2. One corner glyph per main-tab box, alternating sides
   -------------------------------------------------------------------------- */

/* All three cards get anchors. The location + calendar cards never take the
   980px `position: static` rule that the mood card does, but the gated
   attribute keeps specificity safe everywhere. */
body[data-halloween-month="1"] .social-battery-section,
body[data-halloween-month="1"] .location-section,
body[data-halloween-month="1"] .location-section-body,
body[data-halloween-month="1"] .calendar-section {
  position: relative;
}

/* Nested in the card's top-left corner, overhanging both edges by roughly a
   quarter to a third of the glyph so it reads as tucked behind the rounded
   border. Sized to fit the gap between the header and the "SOCIAL BATTERY"
   label — a bigger glyph would either sit on the header's bottom edge or touch
   the label's first letter. */
.halloween-pumpkin-corner {
  position: absolute;
  top: -0.48em;               /* ≈ -11.5px at 24px */
  left: -0.42em;              /* ≈ -10px at 24px */
  font-size: 24px;
  line-height: 1;
  z-index: 2;
  pointer-events: none;       /* decoration only — never intercepts a tap */
  transform-origin: 58% 62%;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  animation: halloween-pumpkin-bob 7s ease-in-out infinite;
  will-change: transform;
}

/* Ghost: same budget, mirrored to the top-right corner of Live Location. */
.halloween-ghost-corner {
  position: absolute;
  top: -0.48em;
  right: -0.42em;
  font-size: 24px;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
  transform-origin: 42% 62%;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  animation: halloween-pumpkin-bob 7s ease-in-out infinite;
  will-change: transform;
}

/* Vampire: bottom-left corner of the day/week calendar. It hangs on <main>
   (positioned below), NOT as a card child — .calendar-section clips overflow
   for its rounded day grid and would cut an overhanging child to a sliver.
   Coordinates are set inline by ensureVampire(); this only styles it. */
body[data-halloween-month="1"] main {
  position: relative;
}

.halloween-vampire-corner {
  position: absolute;
  font-size: 24px;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  animation: halloween-pumpkin-bob 7s ease-in-out infinite;
  will-change: transform;
}

/* Phones: the cards run nearly edge to edge, so smaller glyphs keep the whole
   overhang on screen. */
@media (max-width: 500px) {
  .halloween-pumpkin-corner,
  .halloween-ghost-corner,
  .halloween-vampire-corner {
    font-size: 20px;
  }
  .halloween-pumpkin-corner,
  .halloween-ghost-corner {
    top: -0.40em;
  }
  .halloween-pumpkin-corner {
    left: -0.45em;
  }
  .halloween-ghost-corner {
    right: -0.45em;
  }
}

/* Kept deliberately small: the vertical gap above the card is tight, and this
   animation is part of the verified clearance budget. */
@keyframes halloween-pumpkin-bob {
  0%,
  100% { transform: translateY(0) rotate(-13deg); }
  50%  { transform: translateY(-2px) rotate(-7deg); }
}

@media (prefers-reduced-motion: reduce) {
  .halloween-pumpkin-corner,
  .halloween-ghost-corner,
  .halloween-vampire-corner {
    animation: none !important;
    transform: rotate(-13deg);
  }
}
