:root {
  --ah-ink: #142033;
  --ah-muted: #647084;
  --ah-paper: #f7f1e8;
  --ah-porcelain: #fffdf8;
  --ah-surface: rgba(255, 253, 248, 0.94);
  --ah-navy: #18375f;
  --ah-navy-soft: #2a4f7a;
  --ah-gold: #c8942d;
  --ah-gold-strong: #a87516;
  --ah-gold-soft: #f1d99c;
  --ah-copper: #9a4f2f;
  --ah-border: rgba(24, 55, 95, 0.15);
  --ah-border-strong: rgba(24, 55, 95, 0.24);
  --ah-shadow-soft: 0 16px 46px rgba(24, 55, 95, 0.11);
  --ah-shadow-lift: 0 24px 64px rgba(24, 55, 95, 0.16);
  --ah-ring: rgba(200, 148, 45, 0.5);
}

body[data-style-variant="heritage"] {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 241, 232, 0.88) 48%, rgba(255, 253, 248, 0.92)),
    var(--ah-paper) !important;
  color: var(--ah-ink);
  font-feature-settings: "tnum";
  scroll-padding-top: 132px;
  overflow-x: hidden;
}

body[data-style-variant="heritage"] *,
body[data-style-variant="heritage"] *::before,
body[data-style-variant="heritage"] *::after {
  box-sizing: border-box;
}

body[data-style-variant="heritage"] a,
body[data-style-variant="heritage"] button {
  min-height: 44px;
  touch-action: manipulation;
}

body[data-style-variant="heritage"] a:focus-visible,
body[data-style-variant="heritage"] button:focus-visible,
body[data-style-variant="heritage"] input:focus-visible,
body[data-style-variant="heritage"] select:focus-visible,
body[data-style-variant="heritage"] textarea:focus-visible {
  outline: 3px solid var(--ah-ring);
  outline-offset: 3px;
}

body[data-style-variant="heritage"] header,
body[data-style-variant="heritage"] [role="banner"] {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(24, 55, 95, 0.12) !important;
  background: rgba(255, 253, 248, 0.9) !important;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(24, 55, 95, 0.08);
}

body[data-style-variant="heritage"] h1,
body[data-style-variant="heritage"] h2,
body[data-style-variant="heritage"] h3 {
  color: var(--ah-ink) !important;
  letter-spacing: 0 !important;
}

body[data-style-variant="heritage"] h1 {
  text-wrap: balance;
}

body[data-style-variant="heritage"] main > section:first-child,
body[data-style-variant="heritage"] main > div > section:first-child {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(200, 148, 45, 0.38);
  background:
    linear-gradient(135deg, rgba(24, 55, 95, 0.96), rgba(42, 79, 122, 0.9)),
    var(--ah-navy) !important;
}

body[data-style-variant="heritage"] main > section:first-child::after,
body[data-style-variant="heritage"] main > div > section:first-child::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: linear-gradient(90deg, var(--ah-gold), rgba(255, 255, 255, 0), var(--ah-copper));
  pointer-events: none;
}

body[data-style-variant="heritage"] main > section:first-child h1,
body[data-style-variant="heritage"] main > section:first-child p,
body[data-style-variant="heritage"] main > section:first-child span,
body[data-style-variant="heritage"] main > div > section:first-child h1,
body[data-style-variant="heritage"] main > div > section:first-child p,
body[data-style-variant="heritage"] main > div > section:first-child span {
  color: #fffaf0 !important;
}

body[data-style-variant="heritage"] main > section:first-child a[class*="bg-accent"],
body[data-style-variant="heritage"] main > section:first-child button[class*="bg-accent"],
body[data-style-variant="heritage"] main > div > section:first-child a[class*="bg-accent"],
body[data-style-variant="heritage"] main > div > section:first-child button[class*="bg-accent"],
body[data-style-variant="heritage"] a[class*="bg-primary"],
body[data-style-variant="heritage"] button[class*="bg-primary"] {
  border-color: rgba(200, 148, 45, 0.4) !important;
  background: linear-gradient(135deg, #f1d99c, var(--ah-gold)) !important;
  color: #1b1b18 !important;
  box-shadow: 0 14px 30px rgba(200, 148, 45, 0.25);
}

body[data-style-variant="heritage"] main > section:first-child a:not([class*="bg-primary"]):not([class*="bg-accent"]),
body[data-style-variant="heritage"] main > section:first-child button:not([class*="bg-primary"]):not([class*="bg-accent"]),
body[data-style-variant="heritage"] main > div > section:first-child a:not([class*="bg-primary"]):not([class*="bg-accent"]),
body[data-style-variant="heritage"] main > div > section:first-child button:not([class*="bg-primary"]):not([class*="bg-accent"]) {
  border-color: rgba(255, 255, 255, 0.36) !important;
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fffaf0 !important;
  box-shadow: 0 14px 32px rgba(10, 24, 43, 0.18);
}

body[data-style-variant="heritage"] a[class*="bg-primary"]:hover,
body[data-style-variant="heritage"] button[class*="bg-primary"]:hover,
body[data-style-variant="heritage"] .heritage-card-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(200, 148, 45, 0.32);
}

body[data-style-variant="heritage"] a[class*="bg-white"][class*="border"],
body[data-style-variant="heritage"] article[class*="bg-white"],
body[data-style-variant="heritage"] form[class*="bg-white"],
body[data-style-variant="heritage"] div[class*="bg-white"][class*="border"] {
  border-color: var(--ah-border) !important;
  border-radius: 8px !important;
  background: var(--ah-surface) !important;
  box-shadow: var(--ah-shadow-soft) !important;
}

body[data-style-variant="heritage"] footer,
body[data-style-variant="heritage"] [role="contentinfo"] {
  border-top: 1px solid rgba(24, 55, 95, 0.12);
  background: rgba(255, 253, 248, 0.82) !important;
}

.theater-rail {
  display: flex;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding: 12px max(16px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(24, 55, 95, 0.12);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.theater-rail::-webkit-scrollbar {
  display: none;
}

.theater-rail a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(24, 55, 95, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ah-ink);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(24, 55, 95, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.theater-rail a:hover,
.theater-rail a[aria-current="page"] {
  border-color: rgba(24, 55, 95, 0.32);
  background: var(--ah-navy);
  color: #fffaf0;
  box-shadow: 0 12px 28px rgba(24, 55, 95, 0.13);
}

.theater-promo {
  width: min(1120px, calc(100% - 32px));
  margin: 18px auto 0;
  display: grid;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(200, 148, 45, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(247, 241, 232, 0.92)),
    var(--ah-surface);
  box-shadow: var(--ah-shadow-soft);
}

.theater-promo small {
  display: block;
  margin-bottom: 4px;
  color: var(--ah-gold-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theater-promo strong {
  display: block;
  color: var(--ah-ink);
  font-size: clamp(1.12rem, 2vw, 1.5rem);
  line-height: 1.3;
}

.theater-promo p {
  margin: 6px 0 0;
  max-width: 680px;
  color: var(--ah-muted);
  line-height: 1.6;
}

.theater-promo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theater-promo__actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(24, 55, 95, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ah-navy);
  font-weight: 800;
  text-decoration: none;
}

.theater-promo__actions a:first-child {
  border-color: rgba(200, 148, 45, 0.46);
  background: linear-gradient(135deg, #f1d99c, var(--ah-gold));
  color: #1b1b18;
}

body[data-style-variant="heritage"] .heritage-show-card {
  position: relative;
  overflow: hidden;
  border-color: var(--ah-border-strong) !important;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

body[data-style-variant="heritage"] .heritage-show-card:hover {
  transform: translateY(-4px);
  border-color: rgba(200, 148, 45, 0.46) !important;
  box-shadow: var(--ah-shadow-lift) !important;
}

.heritage-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(24, 55, 95, 0.88);
  color: #fffaf0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px rgba(20, 32, 51, 0.18);
}

.heritage-card-cta {
  display: flex;
  width: calc(100% - 32px);
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0 16px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f1d99c, var(--ah-gold));
  color: #1b1b18;
  font-size: 0.88rem;
  font-weight: 900;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

body[data-style-variant="heritage"] .heritage-error-state {
  width: min(420px, calc(100% - 32px));
  padding: 24px !important;
  border-color: rgba(154, 79, 47, 0.22) !important;
  background: rgba(255, 253, 248, 0.96) !important;
  box-shadow: var(--ah-shadow-soft) !important;
}

.heritage-error-help {
  margin: 12px 0 0;
  color: var(--ah-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.heritage-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.heritage-error-actions a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(24, 55, 95, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ah-navy);
  font-weight: 800;
  text-decoration: none;
}

body[data-style-variant="heritage"] .variant-poster-fallback {
  position: relative;
  min-height: 220px !important;
  background:
    linear-gradient(145deg, rgba(24, 55, 95, 0.08), rgba(200, 148, 45, 0.18)),
    #f4ead6 !important;
}

body[data-style-variant="heritage"] .variant-poster-fallback::after {
  content: "AcademyHaus";
  position: absolute;
  inset: auto 18px 18px;
  color: rgba(24, 55, 95, 0.72);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body[data-style-variant="heritage"] .variant-poster-fallback span {
  filter: saturate(0.8);
  opacity: 0.76;
}

.theater-bottom-nav {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(10px, env(safe-area-inset-left));
  z-index: 1000;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(24, 55, 95, 0.14);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.95);
  box-shadow: 0 18px 42px rgba(24, 55, 95, 0.22);
  backdrop-filter: blur(18px);
}

.theater-bottom-nav a {
  display: inline-flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--ah-ink);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.theater-bottom-nav a[aria-current="page"] {
  background: rgba(24, 55, 95, 0.08);
}

.theater-bottom-nav a:nth-child(3) {
  min-height: 54px;
  margin-top: -18px;
  border-radius: 999px;
  background: radial-gradient(circle at 40% 25%, #f1d99c, var(--ah-gold));
  color: #1b1b18;
  box-shadow: 0 14px 30px rgba(200, 148, 45, 0.34);
}

body[data-style-variant="heritage"] .variant-badge {
  display: none !important;
}

@media (min-width: 760px) {
  .theater-promo {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 760px) {
  html {
    overflow-x: hidden;
  }

  body[data-style-variant="heritage"] {
    width: 100%;
    max-width: 100vw;
    padding-bottom: 94px;
  }

  body[data-style-variant="heritage"],
  body[data-style-variant="heritage"] #root,
  body[data-style-variant="heritage"] main,
  body[data-style-variant="heritage"] main > *,
  body[data-style-variant="heritage"] main section,
  body[data-style-variant="heritage"] .theater-promo,
  body[data-style-variant="heritage"] .theater-rail,
  body[data-style-variant="heritage"] .theater-bottom-nav {
    max-width: 100vw !important;
    min-width: 0 !important;
  }

  body[data-style-variant="heritage"] #root,
  body[data-style-variant="heritage"] main {
    overflow-x: clip;
  }

  body[data-style-variant="heritage"] main *,
  body[data-style-variant="heritage"] header *,
  body[data-style-variant="heritage"] [role="banner"] * {
    min-width: 0;
  }

  body[data-style-variant="heritage"] header,
  body[data-style-variant="heritage"] [role="banner"] {
    overflow: hidden;
  }

  body[data-style-variant="heritage"] header > *,
  body[data-style-variant="heritage"] [role="banner"] > * {
    max-width: 100%;
    min-width: 0;
    padding-inline: 16px !important;
  }

  body[data-style-variant="heritage"] header nav,
  body[data-style-variant="heritage"] [role="banner"] nav,
  body[data-style-variant="heritage"] header a[href="/login"],
  body[data-style-variant="heritage"] header a[href="/register"] {
    display: none !important;
  }

  body[data-style-variant="heritage"] header img,
  body[data-style-variant="heritage"] [role="banner"] img {
    max-width: 116px;
    height: auto;
  }

  .theater-rail {
    width: 100%;
    gap: 6px;
    padding-inline: 10px;
  }

  .theater-rail a {
    min-height: 44px;
    padding-inline: 10px;
    font-size: 0.84rem;
  }

  .theater-promo {
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 15px;
  }

  .theater-promo strong,
  .theater-promo p {
    overflow-wrap: anywhere;
  }

  .theater-promo__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .theater-promo__actions a {
    width: 100%;
  }

  body[data-style-variant="heritage"] main > section:first-child,
  body[data-style-variant="heritage"] main > div > section:first-child {
    padding-inline: 16px !important;
  }

  body[data-style-variant="heritage"] main > section:first-child a,
  body[data-style-variant="heritage"] main > section:first-child button,
  body[data-style-variant="heritage"] main > div > section:first-child a,
  body[data-style-variant="heritage"] main > div > section:first-child button {
    width: min(100%, 320px);
  }

  body[data-style-variant="heritage"] main > section:first-child h1,
  body[data-style-variant="heritage"] main > section:first-child p,
  body[data-style-variant="heritage"] main > div > section:first-child h1,
  body[data-style-variant="heritage"] main > div > section:first-child p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .theater-bottom-nav {
    display: grid;
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    padding: 6px;
  }

  .theater-bottom-nav a {
    padding-inline: 2px;
    font-size: clamp(0.64rem, 2.7vw, 0.74rem);
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-style-variant="heritage"] *,
  body[data-style-variant="heritage"] *::before,
  body[data-style-variant="heritage"] *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
