/* ==========================================================================
   Adventskalender — standalone page styles
   Tokens from design_handoff_adventskalender/README.md
   ========================================================================== */

@font-face {
  font-family: 'MontserratAlt1';
  src: url('/assets/fonts/MontserratAlt1-Regular.woff2') format('woff2'),
       url('/assets/fonts/MontserratAlt1-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

:root {
  --f-display: 'MontserratAlt1', 'Montserrat', sans-serif;
  --f-body: 'Montserrat', sans-serif;
  --radius: 18px;
}

html, body {
  margin: 0;
  padding: 0;
  background: #0a1630;
}

body.advent {
  font-family: var(--f-body);
  font-weight: 400;
  color: #dce6f5;
  -webkit-font-smoothing: antialiased;
}

body.advent.is-modal-open { overflow: hidden; }

.advent a { color: #cfe0f5; }
.advent a:hover { color: #ffffff; }

@keyframes doorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
@keyframes sparkle {
  0% { opacity: 0; transform: scale(.3) rotate(0deg); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15) rotate(40deg); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Page layers ------------------------------------------------------- */

.advent__page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #0a1630 radial-gradient(ellipse at 50% -15%, #1a2d55 0%, #10203f 45%, #0a1630 100%);
}

.advent__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.advent__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.advent__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10,22,48,.42) 0%, rgba(10,22,48,.24) 40%, rgba(10,22,48,.45) 100%);
}

.advent__snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.advent__content {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 36px 150px;
  display: flex;
  flex-direction: column;
  gap: 52px;
}

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

.advent__header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.advent__logo {
  align-self: flex-end;
  line-height: 0;
  margin-bottom: 24px;
}
.advent__logo img {
  width: 150px;
  height: auto;
  opacity: .92;
}

.advent__title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(24px, 3.6vw, 44px);
  line-height: 1.12;
  letter-spacing: -.01em;
  margin: 0;
  color: #f4f7fd;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

@media (min-width: 900px) {
  .advent__title { white-space: nowrap; }
}

.advent__subline {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  color: #a5b8d8;
  max-width: 42em;
  line-height: 1.7;
  letter-spacing: .01em;
  text-wrap: pretty;
}

/* --- Grid -------------------------------------------------------------- */

.advent__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 112px;
  grid-auto-flow: row dense;
  gap: 14px;
}

/* --- Tile -------------------------------------------------------------- */

.door--big { grid-column: span 2; grid-row: span 2; }
.door--wide { grid-column: span 2; }

.door {
  position: relative;
  perspective: 1000px;
  transition: transform .25s ease-out;
}
/* Open door swings out over its neighbours, so it must stack above them.
   Keep it on top while the close animation runs, too. */
.door.is-open,
.door.is-closing { z-index: 10; }

/* Content panel (behind the door). While the door is closed it is see-through
   so the background image shows through the glass; it fills in as the door opens. */
.door:not(.is-open):not(.is-closing) .door__panel { background: transparent; border-color: transparent; }
.door:not(.is-open):not(.is-closing) .door__text,
.door:not(.is-open):not(.is-closing) .door__sparkle { visibility: hidden; }
.door__panel {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(30,48,86,.85), rgba(18,32,62,.92));
  border: 1px solid rgba(160,190,235,.3);
  box-shadow: none;
  transition: box-shadow .8s ease, border-color .8s ease, background .5s ease;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-align: center;
  overflow: hidden;
}
.door.is-open .door__panel {
  background: linear-gradient(165deg, rgba(64,54,40,.92), rgba(38,34,32,.95));
  border-color: rgba(255,214,150,.55);
  box-shadow: inset 0 0 34px rgba(255,190,110,.28), 0 0 26px rgba(255,190,110,.3);
}

.door__sparkle {
  position: absolute;
  color: #ffe8b8;
  opacity: 0;
  pointer-events: none;
}
.door__sparkle--1 { top: 8px; right: 10px; font-size: 14px; }
.door__sparkle--2 { bottom: 12px; left: 10px; font-size: 10px; }
.door.is-open .door__sparkle--1 { animation: sparkle 1.1s ease forwards; }
.door.is-open .door__sparkle--2 { animation: sparkle 1.4s ease .25s forwards; }

.door__text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #c3d2ea;
  font-weight: 400;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.door--tall .door__text,
.door--big .door__text { -webkit-line-clamp: 5; }

/* Open panel with content is clickable as a whole */
.door.has-url.is-open .door__panel { cursor: pointer; }

/* The glass door itself */
.door__face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(190,215,250,.055) 0%, rgba(150,185,235,.02) 50%, rgba(190,215,250,.04) 100%);
  -webkit-backdrop-filter: blur(3px) saturate(1.1);
  backdrop-filter: blur(3px) saturate(1.1);
  border: 1px solid rgba(200,222,250,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 30px rgba(0,8,26,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform .9s cubic-bezier(.3,.7,.25,1), border-color .3s, background .3s;
  /* deliberately NO backface-visibility: hidden — the door stays visible standing open */
}
.door__face:hover { border-color: rgba(220,235,255,.5); background: linear-gradient(160deg, rgba(190,215,250,.11) 0%, rgba(150,185,235,.045) 50%, rgba(190,215,250,.08) 100%); }
.door.is-open .door__face { transform: rotateY(-115deg); }
/* Already opened before (remembered in the browser): door stands ajar */
.door.is-visited:not(.is-open) .door__face { transform: rotateY(-14deg); }
.door.is-visited:not(.is-open):not(.is-closing) .door__panel {
  border-color: rgba(255,214,150,.3);
  box-shadow: inset 0 0 24px rgba(255,190,110,.12);
}
.door.is-locked .door__face { cursor: not-allowed; border-color: rgba(140,165,205,.22); }
.door.is-shaking .door__face { animation: doorShake .45s ease; }

.door__sheen {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.07) 42%, rgba(255,255,255,.02) 55%, transparent 65%);
  pointer-events: none;
}

.door__number {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -.02em;
  color: #f2f7ff;
  text-shadow: 0 1px 10px rgba(0,10,30,.45);
}
.door--wide .door__number,
.door--tall .door__number { font-size: 42px; }
.door--big .door__number { font-size: 64px; }
.door.is-locked .door__number { color: rgba(200,215,240,.35); }

/* --- Password gate ---------------------------------------------------- */

.advent__gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 40px auto;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.advent__gate-label {
  font-size: 14px;
  letter-spacing: .04em;
  color: #a5b8d8;
}
.advent__gate-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.advent__gate-input,
.advent__gate-button {
  font: inherit;
  font-size: 15px;
  border-radius: var(--radius);
  padding: 12px 18px;
}
.advent__gate-input {
  flex: 1;
  min-width: 0;
  color: #f4f7fd;
  background: rgba(10,22,48,.55);
  border: 1px solid rgba(207,224,245,.3);
}
.advent__gate-input:focus { outline: none; border-color: #cfe0f5; }
.advent__gate-button {
  cursor: pointer;
  font-weight: 500;
  color: #0a1630;
  background: #f4f7fd;
  border: 0;
}
.advent__gate-button:hover { background: #ffffff; }
.advent__gate-error {
  margin: 0;
  font-size: 14px;
  color: #ffb4b4;
}

/* --- Hint + footer ----------------------------------------------------- */

.advent__hint {
  min-height: 24px;
  text-align: center;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 400;
  color: #9fb6dd;
}

.advent__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.advent__footer-line {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}
.advent__footer-line--primary { letter-spacing: .2em; color: #9fb6dd; }

.advent__footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
}
.advent__footer-links a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #7d92b8;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.advent__footer-links a:hover { color: #ffffff; border-color: rgba(255,255,255,.4); }

/* --- Modal (scrollstory iframe) ---------------------------------------- */

.advent-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.advent-modal[hidden] { display: none; }

.advent-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,10,24,.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.advent-modal__window {
  position: relative;
  overflow: visible;
  width: min(1100px, 100%);
  height: min(900px, 100%);
  border-radius: var(--radius);
  background: #0a1630;
  border: 1px solid rgba(255,214,150,.45);
  box-shadow: inset 0 0 34px rgba(255,190,110,.12), 0 0 40px rgba(255,190,110,.22), 0 30px 80px rgba(0,8,26,.6);
  animation: modalIn .35s ease;
}

.advent-modal__frame {
  display: block;
  border-radius: var(--radius);
  width: 100%;
  height: 100%;
  border: 0;
  background: #0a1630;
}

.advent-modal__close {
  position: absolute;
  top: -18px;
  right: -18px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,214,150,.55);
  background: rgba(10,22,48,.85);
  color: #ffe8b8;
  font-family: var(--f-body);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.advent-modal__close:hover { background: rgba(64,54,40,.95); color: #ffffff; }

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

@media (max-width: 899px) {
  .advent__content { padding: 56px 24px 130px; }
  /* Pin the logo to the top-right corner, same distance from top and right
     as the content's side padding; the header clears it via padding-top. */
  .advent__logo { position: absolute; top: 24px; right: 24px; margin: 0; }
  .advent__logo img { width: 150px; }
  .advent__header { position: static; padding-top: 40px; }
  .advent__title { font-size: clamp(24px, 5.2vw, 40px); }
  .advent__grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 104px; }
}

@media (max-width: 559px) {
  .advent__content { padding: 44px 16px 120px; gap: 32px; }
  .advent__logo { top: 16px; right: 16px; }
  .advent__logo img { width: 110px; }
  .advent__header { padding-top: 28px; }
  .advent__title { font-size: clamp(22px, 6.4vw, 30px); }
  .advent__grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 96px; gap: 10px; }
  .door__panel { padding: 10px; gap: 6px; }
  .door__text { font-size: 11.5px; -webkit-line-clamp: 2; }
  .door--tall .door__text,
  .door--big .door__text { -webkit-line-clamp: 5; }
  .door__number { font-size: 24px; }
  .door--wide .door__number,
  .door--tall .door__number { font-size: 34px; }
  .door--big .door__number { font-size: 48px; }
  .advent-modal { padding: 0; }
  .advent-modal__window { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .advent-modal__frame { border-radius: 0; }
  .advent-modal__close { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .door__face { transition: transform .2s ease; }
  .advent-modal__window { animation: none; }
}
