/* Primal Legion Forever – styles for index.html */
/* Color scheme derived from the guild logo (gold/cream/brown) and guild symbol (royal blue/navy) */
:root {
  /* Fonts: Cinzel (logo-like capitals) for captions/links, EB Garamond for running text */
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-text:    "EB Garamond", Georgia, "Times New Roman", serif;

  --gold-light: #fae5a0;
  --gold:       #f0c972;
  --gold-mid:   #c69547;
  --gold-dark:  #9e6926;
  --bronze:     #764a15;
  --cream:      #fdf7cd;
  --brown-dark: #1a0900;
  --royal-blue: #002355;
  --navy:       #011a41;
  --navy-deep:  #00102d;

  /* Sizes of the crest (logo + symbols) */
  --logo-w: min(56vw, 900px, 72svh);
  --symbol-w: calc(var(--logo-w) * 0.3);
  --crest-gap: clamp(1rem, 3vw, 3.5rem);
}

/* Self-hosted fonts (SIL OFL, see fonts/OFL-*.txt) – no external font services (privacy) */
@font-face {
  font-family: "Cinzel";
  src: url("fonts/cinzel-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("fonts/cinzel-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--navy-deep); /* shown while the background image loads */
  overflow-y: scroll; /* always show the vertical scrollbar, so pages don't shift when switching */
}
body {
  margin: 0;
  min-height: 100%;
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
}

/* Full-viewport background image */
.background {
  position: fixed;
  inset: 0;
  z-index: -1;
}
.background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 29% 50%; /* keep dwarf & bear in view when cropped */
  display: block;
}

main {
  position: relative;
  min-height: 100svh;
}

/* Crest: centered horizontally, vertically centered in the top third */
.crest {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 33.333svh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--crest-gap);
  padding: 0 1rem;
}
.crest img {
  display: block;
  width: 100%;
  height: auto;
  /* Medium dark glow following the image outline (alpha channel) */
  filter:
    drop-shadow(0 0 4px rgb(26 9 0 / 0.9))
    drop-shadow(0 0 14px rgb(26 9 0 / 0.65));
}
.crest-center { position: relative; width: var(--logo-w); flex: 0 0 auto; }
.crest .logo { margin: 0; }
.crest .symbol { width: var(--symbol-w); flex: 0 0 auto; }

/* Countdown + Discord link, hanging below the logo
   (absolute, so the logo keeps its position in the top third) */
.below-logo {
  --below-gap: clamp(1rem, 3vw, 2.5rem);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(1.4rem, 2.6vw, 2.6rem);
}

/* Countdown to the WoW Forever release */
.countdown {
  position: relative; /* anchor for the tooltip */
  margin-top: var(--below-gap);
  padding: 0.2em 0.4em 0.4em 0; /* top right bottom left */
  display: flex;
  gap: 0.9em;
  background: rgb(255 255 255 / 0.65);
  border-radius: 0.25em;
  color: var(--gold-dark);
  white-space: nowrap;
  cursor: default;
}
.countdown[hidden] { display: none; }
.countdown .unit { display: flex; flex-direction: column; align-items: center; min-width: 2.2em; }
.countdown .value { font-weight: bold; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown .label {
  font-size: max(0.38em, 0.7rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bronze);
}

/* Discord link (SVG recolored to --gold-dark by tools/build_images.py) */
.discord {
  position: relative; /* anchor for the tooltip */
  display: block;
  margin-top: var(--below-gap);
}
.discord img {
  display: block;
  width: 4.32em; /* relative to the countdown font size */
  height: auto;
  filter: none; /* no glow (overrides .crest img) */
  transition: transform 0.15s ease;
}
.discord:hover img,
.discord:focus-visible img { transform: scale(1.06); }

/* Tooltips: navy + gold border (shield colors), cream text, small arrow.
   Placement: countdown = left (wide screens) / top (narrow), Discord = below. */
.tooltip {
  --arrow: 8px;
  position: absolute;
  z-index: 10;
  padding: 0.45em 0.9em;
  background: rgb(0 16 45 / 0.9); /* --navy-deep 90% */
  border: 1px solid var(--gold-mid);
  border-radius: 0.25rem;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.45);
  color: var(--cream);
  font-size: 0.95rem;
  font-weight: normal;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, translate 0.15s ease, visibility 0.15s;
}
/* Arrow: rotated square with the gold border on the two outer sides */
.tooltip::before {
  content: "";
  position: absolute;
  width: var(--arrow);
  height: var(--arrow);
  background: inherit;
  border: inherit;
  border-width: 0;
}

/* Below (Discord) */
.tooltip-bottom {
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  translate: 0 6px; /* slide up toward the element */
}
.tooltip-bottom::before {
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, 50%) rotate(45deg);
  border-top-width: 1px;
  border-left-width: 1px;
}

/* Left (countdown on wide screens) */
.tooltip-side {
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  translate: -6px 0; /* slide right toward the element */
}
.tooltip-side::before {
  left: 100%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  border-top-width: 1px;
  border-right-width: 1px;
}

/* Top (countdown on narrow screens) */
@media (max-width: 900px) {
  .tooltip-side {
    right: auto;
    top: auto;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    translate: 0 -6px; /* slide down toward the element */
  }
  .tooltip-side::before {
    left: 50%;
    top: 100%;
    transform: translate(-50%, -50%) rotate(45deg);
    border-top-width: 0;
    border-right-width: 1px;
    border-bottom-width: 1px;
  }
}

/* Show: hover (mouse, after a short delay), keyboard focus or tap on touch devices
   (.show-tip, set by script) immediately. Hiding is always immediate. */
@media (hover: hover) {
  .countdown:hover .tooltip,
  .discord:hover .tooltip {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition-delay: 400ms;
  }
}
.countdown:focus-visible .tooltip,
.discord:focus-visible .tooltip,
.countdown.show-tip .tooltip { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
  .tooltip { transition-duration: 0s; } /* no animation, but keep the hover delay */
}

/* Phones / narrow screens: one symbol above the logo */
@media (max-width: 700px) {
  :root {
    --logo-w: min(90vw, 560px);
    --symbol-w: min(26vw, 160px);
    --crest-gap: 0.5rem;
  }
  .crest {
    flex-direction: column;
    height: auto;
    min-height: 33.333svh;
    padding-top: 1.5rem;
  }
  .crest .symbol-right { display: none; }
}

/* ---------- Footer link (index.html) and back link (impressum.html) ---------- */
.site-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem clamp(1rem, 2vw, 1.75rem);
  text-align: right;
}
.page-link {
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-shadow: 0 0 3px rgb(26 9 0 / 0.95), 0 0 8px rgb(26 9 0 / 0.7);
}
.page-link:hover,
.page-link:focus-visible { color: var(--gold-light); text-decoration: underline; }

/* ---------- Impressum page ---------- */
.page-impressum .crest { position: relative; } /* in flow, so the boxes follow below */
.crest .logo-link { display: block; }

/* Visually hidden, but read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Two boxes side by side, same look as the countdown box */
.info-boxes {
  display: flex;
  align-items: flex-start; /* each box as high as its content */
  gap: clamp(1rem, 2.5vw, 2rem);
  max-width: 1200px;
  margin: clamp(1rem, 3vw, 2.5rem) auto 0;
  padding: 0 1rem;
}
.info-box {
  flex: 1 1 0;
  min-width: 0;
  padding: 1.1rem 1.5rem 1.4rem;
  background: rgb(255 255 255 / 0.8);
  border-radius: 0.6rem;
  color: var(--brown-dark);
  font-family: var(--font-text);
  font-size: 1.1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.info-box h2,
.info-box h3 { font-family: var(--font-display); font-weight: 700; }
.info-box h2 {
  margin: 0 0 0.8rem;
  color: var(--gold-dark);
  font-size: 1.35rem;
  line-height: 1.25;
}
.info-box h3 {
  margin: 1.2rem 0 0.3rem;
  color: var(--gold-dark);
  font-size: 1.05rem;
}
.info-box p { margin: 0 0 0.8rem; }
.info-box p:last-child { margin-bottom: 0; }
.info-box ul { margin: 0.3rem 0 0.8rem; padding-left: 1.3rem; }
.info-box a { color: var(--gold-dark); }
.info-box a:hover,
.info-box a:focus-visible { color: var(--bronze); }

.back-link {
  padding: clamp(1.25rem, 3vw, 2rem) 1rem 2rem;
  text-align: center;
}

/* Phones: boxes stacked vertically */
@media (max-width: 700px) {
  .info-boxes { flex-direction: column; }
  .info-box { padding: 1rem 1.1rem 1.2rem; }
}

/* ---------- "Unsere Geschichte" video slider (index.html, behavior in slider.js) ---------- */
.origins {
  --visible: 1;                 /* videos shown at once: 1 on phones up to 5 on wide screens */
  --origins-gap: 0.75rem;
  --origins-edge: 4.1rem;       /* distance from the box edge to the first thumbnail: padding + button + gap */
  position: relative;
  width: min(94vw, 1280px);
  margin-top: var(--below-gap);
  padding: 0.8rem 1rem 1.1rem;
  font-size: 1rem;              /* .below-logo has a large font-size for the countdown */
  /* No frame: semi-transparent navy (--navy-deep). It fades out to the left and right and is
     almost fully transparent at the outer edge of the thumbnails (--origins-edge) */
  background: linear-gradient(to right,
    rgb(0 16 45 / 0) 0,
    rgb(0 16 45 / 0.04) var(--origins-edge),
    rgb(0 16 45 / 0.65) 30%,
    rgb(0 16 45 / 0.65) 70%,
    rgb(0 16 45 / 0.04) calc(100% - var(--origins-edge)),
    rgb(0 16 45 / 0) 100%);
  color: var(--cream);
}
@media (min-width: 560px)  { .origins { --visible: 2; } }
@media (min-width: 850px)  { .origins { --visible: 3; } }
@media (min-width: 1150px) { .origins { --visible: 4; } }
@media (min-width: 1500px) { .origins { --visible: 5; } }

.origins-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.8);
}
/* Gold lines fading out to both sides of the title */
.origins-title::before,
.origins-title::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-mid));
}
.origins-title::after { background: linear-gradient(to left, transparent, var(--gold-mid)); }

.origins-stage {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
/* Without JavaScript the list can simply be scrolled; with it the buttons take over */
.origins-viewport {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
}
.origins.is-enhanced .origins-viewport { overflow: hidden; }

.origins-track {
  display: flex;
  gap: var(--origins-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  will-change: transform;
}
.origins-item {
  flex: 0 0 calc((100% - (var(--visible) - 1) * var(--origins-gap)) / var(--visible));
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--gold-mid);
  border-radius: 0.3rem;
  background: var(--navy-deep);
}
.origins-item a {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  outline-offset: -3px;
}
.origins-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none;                 /* no glow (overrides .crest img) */
  transition: transform 0.3s ease;
}
.origins-item a:hover img,
.origins-item a:focus-visible img { transform: scale(1.06); }

/* Video title: caption bar slides up from the bottom of the thumbnail */
.origins-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.45rem 0.6rem;
  background: rgb(0 16 45 / 0.92);
  border-top: 1px solid var(--gold-mid);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  transform: translateY(101%);
  transition: transform 0.2s ease;
}
.origins-item a:hover .origins-caption,
.origins-item a:focus-visible .origins-caption { transform: translateY(0); }
/* Touch devices have no hover: always show the title */
@media (hover: none) {
  .origins-caption { transform: translateY(0); }
}

.origins-btn {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: rgb(0 16 45 / 0.9);
  border: 2px solid var(--gold-mid);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  /* Same dark glow as the logos */
  box-shadow:
    0 0 4px rgb(26 9 0 / 0.9),
    0 0 14px rgb(26 9 0 / 0.65);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.origins.is-enhanced .origins-btn { display: inline-flex; }
.origins-btn:hover { background: var(--gold-dark); color: var(--cream); }
.origins-btn:active { transform: scale(0.92); }
.origins-btn:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.origins-btn svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 700px) {
  .origins { --origins-edge: 3.35rem; padding: 0.7rem 0.75rem 0.9rem; }
  .origins-stage { gap: 0.4rem; }
  .origins-btn { width: 2.2rem; height: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .origins-item img,
  .origins-caption { transition: none; }
}

/* ===== Faction banners (Horde / PvE) next to the countdown ===== */
  .faction-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(0.8rem, 2vw, 1.6rem);
    margin-top: var(--below-gap);
  }
  .faction-row .countdown { margin-top: 0; }
  .row-break { display: none; }

  /* negative margin: the top of the cloth (under the band) lines up with the top edge of the countdown box;
     the svg starts 8 units above the band (viewBox 114 wide), the cloth starts ~26 units below the svg top */
  .faction { --fw: clamp(4.6rem, 6.9vw, 7.8rem); position: relative; flex: 0 0 auto; width: var(--fw); margin-top: calc(var(--fw) * -0.228); }
  .faction svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    /* same dark glow as the logos */
    filter: drop-shadow(0 0 4px rgb(26 9 0 / 0.9)) drop-shadow(0 0 14px rgb(26 9 0 / 0.65));
  }
  .pve-text {
    font-family: var(--font-display); font-weight: 700; font-size: 27px; letter-spacing: 0.02em;
    fill: url(#gold-text); stroke: #061633; stroke-width: 2.4px; paint-order: stroke; stroke-linejoin: round;
  }

  /* Tooltips for the banners (same look as the countdown/Discord tooltips) */
  @media (hover: hover) {
    .faction:hover .tooltip { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 400ms; }
  }

  /* Phones: countdown on top, the two banners next to each other, centered below it */
  @media (max-width: 700px) {
    .faction-row { flex-wrap: wrap; row-gap: 0; }
    .faction-row .countdown { order: 0; }
    .row-break { display: block; order: 1; flex: 0 0 100%; height: 0; }
    .faction-row .faction { order: 2; margin-top: 0.9rem; width: 5rem; }
  }
