/* Fall theme. It loads after styles.css and only re-colors the store in reds, oranges and golds
   and adds maple leaves (falling behind the page and inside the banners, now and then one blowing
   past), so the normal Shore theme is untouched underneath. The MAPLE rank's cards glow so they
   stand out. To switch back, remove the fall.css <link> line in index.html. */

/* Light mode is a warm cream page with white cards; the sidebar and banners are deep red-brown. */
:root {
  --navy: #2a0f0a;
  --navy-2: #4a1a10;
  --sea: #c2410c;
  --aqua: #ffb347;
  --sand: #fbf1e4;
  --sand-2: #f3e1cb;
  --paper: #fffaf3;
  --ink: #2b160d;
  --muted: #7a5a48;
  --line: #ecd6bd;
  --coral: #ff8a2b;
  --coral-deep: #c2410c;
  --coral-ink: #2b0d00;
  --shadow: 0 10px 30px rgba(90, 40, 10, 0.1);
  --strong: #9a2a12;
  --tile-hi: #ffffff;
  --field: #ffffff;
  --toast-bg: #3a160c;
  --showcase-end: #ffe7d1;
  --notice-bg: #fff1dc;
  --notice-line: #f5cf94;
  --legal-text: #4a2d20;
  --key-bg: #fff1e6;
  --key-line: #ffc9a3;
  --theme-color: #2a0f0a;
}

:root[data-theme="dark"] {
  --sea: #ff9a3d;
  --sand: #160b07;
  --sand-2: #2b1710;
  --paper: #21120c;
  --ink: #f7eadf;
  --muted: #c4a690;
  --line: #3f2518;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --strong: #b23a1a;
  --tile-hi: #42261a;
  --field: #1a0d08;
  --toast-bg: #5a2412;
  --showcase-end: #3a1d10;
  --notice-bg: #3a2512;
  --notice-line: #6b4520;
  --legal-text: #e3d0c2;
  --key-bg: #3a2014;
  --key-line: #7a3d1f;
  --theme-color: #160b07;
}

:root {
  /* One maple leaf (icons and decorations), and a 600px tile of scattered leaves that falls behind
     the page and inside the banners. */
  --leaf: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='%23ffc23a'/><stop offset='.5' stop-color='%23ec5a1c'/><stop offset='1' stop-color='%23a51f0e'/></linearGradient></defs><path d='M32 3L37 13L42 11L40 24L50 16L51 21L60 20L55 29L58 31L46 40L47 45L35 42L34 48L33 48L33 61L31 61L31 48L30 48L29 42L17 45L18 40L6 31L9 29L4 20L13 21L14 16L24 24L22 11L27 13Z' fill='url(%23g)' stroke='%237a1a0c' stroke-width='1.6' stroke-linejoin='round'/><path d='M32 46V12M32 40L52 22M32 40L12 22M32 44L45 42M32 44L19 42' fill='none' stroke='%23ffe0a8' stroke-opacity='.6' stroke-width='1.2' stroke-linecap='round'/></svg>");
  --leaves: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'><defs><path id='l' d='M32 3L37 13L42 11L40 24L50 16L51 21L60 20L55 29L58 31L46 40L47 45L35 42L34 48L33 48L33 61L31 61L31 48L30 48L29 42L17 45L18 40L6 31L9 29L4 20L13 21L14 16L24 24L22 11L27 13Z' stroke-linejoin='round'/></defs><use href='%23l' fill='%23d4351c' transform='translate(30 40) rotate(-20 32 32) scale(.55)'/><use href='%23l' fill='%23f2a321' transform='translate(250 110) rotate(35 32 32) scale(.42)'/><use href='%23l' fill='%23e8701c' transform='translate(470 30) rotate(160 32 32) scale(.6)'/><use href='%23l' fill='%23b8401a' transform='translate(140 300) rotate(80 32 32) scale(.45)'/><use href='%23l' fill='%23d4351c' transform='translate(380 260) rotate(-60 32 32) scale(.62)'/><use href='%23l' fill='%23f2a321' transform='translate(540 420) rotate(15 32 32) scale(.42)'/><use href='%23l' fill='%23e8701c' transform='translate(60 490) rotate(120 32 32) scale(.5)'/><use href='%23l' fill='%239c4a1a' transform='translate(300 480) rotate(-120 32 32) scale(.4)'/></svg>");
}

/* ───────── every page ───────── */

/* Leaves fall slowly behind everything, so they show between the cards and never cover text. */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: -600px;
  left: -40px;
  width: calc(100% + 80px);
  height: calc(100vh + 600px);
  background: var(--leaves) 0 0 / 600px 600px repeat;
  opacity: 0.45;
  pointer-events: none;
  animation: leaves-fall 32s linear infinite;
}

:root[data-theme="dark"] body::before {
  opacity: 0.3;
}

/* One tile of drift per loop, so the pattern repeats without a jump. */
@keyframes leaves-fall {
  50% {
    transform: translate(28px, 300px);
  }

  to {
    transform: translate(0, 600px);
  }
}

/* Now and then a single leaf tumbles across the screen in front of the page. It stays under the
   menu, cart and dialogs, never takes clicks, and stays hidden when reduced motion is on. */
body::after {
  content: "";
  position: fixed;
  z-index: 40;
  top: 12vh;
  left: 0;
  width: 46px;
  height: 46px;
  background: var(--leaf) center / contain no-repeat;
  filter: drop-shadow(0 6px 6px rgba(60, 20, 5, 0.3));
  opacity: 0;
  pointer-events: none;
  animation: leaf-gust 38s linear 5s infinite;
}

@keyframes leaf-gust {
  0% {
    opacity: 1;
    transform: translate(-8vw, 0) rotate(0deg) scaleX(1);
  }

  5% {
    transform: translate(28vw, 14vh) rotate(170deg) scaleX(0.4);
  }

  10% {
    transform: translate(62vw, 22vh) rotate(330deg) scaleX(1);
  }

  15% {
    opacity: 1;
    transform: translate(108vw, 40vh) rotate(520deg) scaleX(0.5);
  }

  15.01%,
  100% {
    opacity: 0;
    transform: translate(108vw, 40vh);
  }
}

/* ───────── sidebar ───────── */

.sidebar {
  isolation: isolate;
  background: linear-gradient(180deg, #2a0f0a, #1c0906);
  color: #f3e2d6;
}

/* A few leaves resting in the top corner, and one swaying from the top edge. */
.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.sidebar::before {
  z-index: -1;
  top: 0;
  left: 0;
  width: 150px;
  height: 150px;
  opacity: 0.22;
  background: var(--leaves) -20px -30px / 300px 300px no-repeat;
}

.sidebar::after {
  top: 8px;
  right: 22px;
  width: 26px;
  height: 26px;
  background: var(--leaf) center / contain no-repeat;
  transform-origin: 50% 0;
  animation: leaf-sway 5s ease-in-out infinite;
}

@keyframes leaf-sway {
  50% {
    transform: translateY(6px) rotate(18deg);
  }
}

/* A maple leaf beside the island logo. */
.brand {
  position: relative;
}

.brand::after {
  content: "";
  position: absolute;
  left: calc(50% - 54px);
  bottom: 8px;
  width: 32px;
  height: 32px;
  background: var(--leaf) center / contain no-repeat;
  transform: rotate(-24deg);
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.nav-link,
.theme-toggle {
  color: #f0dccd;
}

.nav-link.active,
.nav-sub-link.active {
  background: rgba(255, 138, 43, 0.2);
}

.nav-sub-link {
  color: #dcc0ad;
}

.support-link,
.featured-card .price s,
.profile-text small,
.profile-actions {
  color: #c2a08a;
}

.profile-actions button {
  color: #ffc48a;
}

.profile-card.signed {
  border-color: rgba(255, 154, 61, 0.34);
  background: linear-gradient(135deg, rgba(255, 138, 43, 0.18), rgba(255, 255, 255, 0.05));
}

.profile-avatar:hover .avatar-img {
  filter: drop-shadow(0 0 8px rgba(255, 154, 61, 0.55)) brightness(1.06);
}

.platform-tag {
  background: rgba(255, 154, 61, 0.24);
}

.scrim {
  background: rgba(28, 9, 6, 0.6);
}

.modal::backdrop {
  background: rgba(28, 9, 6, 0.72);
}

/* ───────── home: autumn sunset hero ───────── */

.hero {
  --sun: radial-gradient(circle at 80% 30%, #fff3c4 0, #ffd36a 58px, rgba(255, 190, 80, 0.5) 62px, rgba(255, 150, 40, 0.16) 130px, transparent 220px);
  isolation: isolate;
  background:
    var(--sun),
    radial-gradient(120% 70% at 50% 125%, rgba(255, 150, 30, 0.45), transparent 70%),
    linear-gradient(125deg, #3d0c08 0%, #8a2412 55%, #d0601c 100%);
}

/* Leaves falling through the hero, and a row of autumn trees along the bottom. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.hero::before {
  top: -300px;
  left: 0;
  right: 0;
  height: calc(100% + 300px);
  background: var(--leaves) 0 0 / 300px 300px repeat;
  opacity: 0.7;
  animation: hero-leaves 18s linear infinite;
}

@keyframes hero-leaves {
  50% {
    transform: translate(18px, 150px);
  }

  to {
    transform: translate(0, 300px);
  }
}

.hero::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 70px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 70'><g fill='%232a0806'><path d='M0 56Q150 42 300 56T600 56V70H0Z'/><rect x='96' y='34' width='5' height='22'/><circle cx='98' cy='28' r='14'/><circle cx='88' cy='36' r='9'/><circle cx='109' cy='35' r='10'/><rect x='402' y='38' width='4' height='20'/><circle cx='404' cy='32' r='11'/><circle cx='396' cy='38' r='7'/><circle cx='413' cy='38' r='8'/><ellipse cx='240' cy='56' rx='26' ry='7'/><ellipse cx='520' cy='57' rx='18' ry='6'/></g></svg>") 0 100% / 600px 70px repeat-x;
  opacity: 0.8;
}

/* The title is re-colored in two halves: "SHORE" in maple orange (the image itself) and "SMP"
   in gold (a copy of the same image laid exactly over it). One filter can't do both, because the
   two halves start as different blues. */
#hero-title {
  position: relative;
}

.hero-logo {
  filter: sepia(1) saturate(4.5) hue-rotate(-32deg) brightness(0.95);
  clip-path: inset(0 38.5% 0 0);
}

#hero-title::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 440px;
  height: 100%;
  background: url("/assets/shore-title.webp") 50% 52% / 100% auto no-repeat;
  clip-path: inset(0 0 0 61.5%);
  filter: sepia(1) saturate(3) hue-rotate(-8deg) brightness(1.08);
}

.hero-text {
  color: #f6e0cf;
}

/* A little pile of leaves on the island mascot's beach. The picture bobs (instead of the image)
   so the leaves move with it. */
.hero-art picture {
  position: relative;
  display: block;
  max-width: 250px;
  margin-left: auto;
  animation: bob 5s ease-in-out infinite;
}

.hero-art img {
  animation: none;
}

.hero-art picture::before,
.hero-art picture::after {
  content: "";
  position: absolute;
  bottom: 9%;
  aspect-ratio: 1;
  background: var(--leaf) center / contain no-repeat;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35));
}

.hero-art picture::before {
  left: 6%;
  width: 22%;
  transform: rotate(-30deg);
}

.hero-art picture::after {
  left: 19%;
  width: 17%;
  transform: rotate(40deg);
  filter: hue-rotate(25deg) drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35));
}

/* ───────── home: banners and cards ───────── */

.section-title::before {
  content: "";
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 8px;
  vertical-align: -0.18em;
  background: var(--leaf) center / contain no-repeat;
}

.sale-banner {
  background: linear-gradient(100deg, #8a1c10 0%, #d2410f 58%, #ffa21f 100%);
  box-shadow: 0 16px 36px rgba(210, 65, 15, 0.35), inset 0 -5px 0 rgba(0, 0, 0, 0.16);
}

.sale-burst {
  background: #ffd23f;
  color: #7a1a0c;
}

.sale-banner .sale-btn {
  color: #7a1a0c;
}

/* Deep cranberry, so Events stays apart from the orange hero. */
.event-banner {
  background: radial-gradient(60% 180% at 0% 50%, rgba(255, 196, 64, 0.32), transparent 62%),
    linear-gradient(120deg, #3b0a1a, #7a1630 65%, #a3263a);
  box-shadow: 0 14px 30px rgba(122, 22, 48, 0.3);
}

.event-banner:hover {
  box-shadow: 0 20px 38px rgba(122, 22, 48, 0.4);
}

.event-copy p {
  color: #f5d6dc;
}

.mode-card:hover,
.cat-tile:hover,
.card:hover,
.showcase-card:hover {
  box-shadow: 0 14px 34px rgba(220, 90, 20, 0.2);
}

/* A leaf on the coupon code in the cart. */
.promo span::before {
  content: "";
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin-right: 6px;
  vertical-align: -0.25em;
  background: var(--leaf) center / contain no-repeat;
}

/* The 404 death screen happens at an autumn dusk. */
.death {
  --sky-top: #c2502a;
  --sky-bottom: #ffc27a;
}

/* ───────── the MAPLE rank stands out ───────── */

/* Its card on the home page is maple red with a glow, and its big card on the Ranks pages gets a
   stronger red wash. Matched by the package title in the card's label, so a renamed package needs
   this selector changed too. */
.showcase-card:has(.showcase-open[aria-label*="maple" i]) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: #f08a24;
  background: radial-gradient(120% 160% at 100% 0%, rgba(255, 196, 64, 0.45), transparent 55%),
    linear-gradient(120deg, #6e120c, #b8301a 55%, #e8641c);
  color: #fff;
  animation: maple-glow 3.2s ease-in-out infinite;
}

.showcase-card:has(.showcase-open[aria-label*="maple" i])::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -18px;
  right: 34%;
  width: 96px;
  height: 96px;
  background: var(--leaf) center / contain no-repeat;
  opacity: 0.22;
  transform: rotate(18deg);
  pointer-events: none;
}

.showcase-card:has(.showcase-open[aria-label*="maple" i]) .showcase-info small,
.showcase-card:has(.showcase-open[aria-label*="maple" i]) .price s {
  color: #ffd9b8;
}

.showcase-card:has(.showcase-open[aria-label*="maple" i]) .showcase-art {
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
}

@keyframes maple-glow {
  0%,
  100% {
    box-shadow: 0 10px 26px rgba(196, 54, 31, 0.32);
  }

  50% {
    box-shadow: 0 12px 34px rgba(240, 120, 30, 0.62);
  }
}

.spotlight[aria-label*="maple" i] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--spot) 26%, var(--paper)), var(--paper) 70%);
  box-shadow: 0 14px 34px rgba(196, 54, 31, 0.25);
}

.spotlight[aria-label*="maple" i]::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -20px;
  right: -16px;
  width: 140px;
  height: 140px;
  background: var(--leaf) center / contain no-repeat;
  opacity: 0.16;
  transform: rotate(20deg);
  pointer-events: none;
}

/* ───────── category pages ───────── */

.page-banner {
  position: relative;
  isolation: isolate;
  background: radial-gradient(90% 160% at 100% 0%, rgba(255, 170, 50, 0.45), transparent 60%),
    linear-gradient(120deg, #4a1008, #b8401a);
}

.page-banner::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -300px;
  left: 0;
  right: 0;
  height: calc(100% + 300px);
  background: var(--leaves) 0 0 / 300px 300px repeat;
  opacity: 0.5;
  pointer-events: none;
  animation: hero-leaves 18s linear infinite;
}

.page-banner p {
  color: #f6e0cf;
}

/* ───────── large screens ───────── */

@media (min-width: 1500px) {
  #hero-title::after {
    max-width: 540px;
  }

  .hero-art picture {
    max-width: 330px;
  }
}

/* ───────── responsive ───────── */

@media (max-width: 900px) {
  /* The mascot is hidden here, so the sun moves up into the corner, clear of the text. */
  .hero {
    --sun: radial-gradient(circle at calc(100% - 44px) 44px, #fff3c4 0, #ffd36a 30px, rgba(255, 190, 80, 0.5) 33px, rgba(255, 150, 40, 0.12) 66px, transparent 104px);
  }

  /* On phones the leaf blowing past would cross the product cards. */
  body::after {
    display: none;
  }
}
