* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: "Inter", sans-serif;
  background: #E1C485;
  color: #fff;
}

/* CONTAINER */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ================= HEADER ================= */
.site-header {
  background: #E1C485;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.logo img {
  height: 40px;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 20px;
  font-weight: 600;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #ffffff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.main-nav a:hover {
  transform: translateY(-1px);
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

.main-nav a:active {
  opacity: 0.7;
}

/* ================= FOOTER ================= */
.site-footer {
  border-top: 1px solid rgba(0,0,0,0.25);
  padding: 24px 0;
}

.footer-inner {
  text-align: center;
}

/* ================= MAIN & STAGE ================= */
.envelope-page {
  display: flex;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 30px;
}

.envelope-wrap {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
}

/* Scena na desktopu - povećana visina da stane ceo papir iznad koverte */
.envelope-stage {
  position: relative;
  width: min(1100px, 96vw);
  height: calc(100vh - 75px);
  min-height: 680px;
  max-height: 900px;
  overflow: hidden;
  perspective: 1400px;
}

/* ================= KOVERTA (SLOJEVI) ================= */
.env-layer {
  position: absolute;
  left: 50%;
  bottom: 2%;
  transform: translateX(-50%);
  width: min(500px, 88vw); /* Usklađena širina sa mobilnim prikazom */
  aspect-ratio: 4 / 5;
  pointer-events: none;
  transition: 
    bottom 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.45s,
    transform 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.45s,
    filter 0.8s ease;
}

.env-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 1. Zadnja strana koverte */
.env-back {
  z-index: 1;
  clip-path: polygon(3.5% 18.5%, 96.5% 18.5%, 96.5% 69%, 3.5% 69%);
  filter: brightness(0.88) contrast(1.05);
}

/* 3. Prednji džep koverte (sa pečatom) */
.env-pocket {
  z-index: 3;
  clip-path: polygon(3.5% 18.5%, 50% 49%, 96.5% 18.5%, 96.5% 69.5%, 3.5% 69.5%);
  filter: drop-shadow(0 -8px 18px rgba(0,0,0,0.15));
}

/* 4. Gornji poklopac koji se otvara */
.env-flap {
  z-index: 4;
  clip-path: polygon(3.5% 18.5%, 96.5% 18.5%, 50% 50.5%);
  transform-origin: 50% 18.5%;
  transition: 
    transform 1.1s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.45s,
    opacity 0.4s ease 0.5s,
    z-index 0s 0.5s;
}

/* KADA SE OTVORI NA DESKTOPU: Koverta se spušta malo niže (-30%) 
   kako njen gornji deo i pečat ne bi prekrivali dno papira */
.envelope-stage.is-open .env-back,
.envelope-stage.is-open .env-pocket {
  bottom: -30%;
}

.envelope-stage.is-open .env-flap {
  bottom: -30%;
  transform: translateX(-50%) rotateX(180deg);
  z-index: 1;
  opacity: 0;
}

/* ================= PAPIR (PISMO) ================= */
.paper {
  position: absolute;
  left: 50%;
  width: min(440px, 78vw);
  
  /* Na desktopu: kreće od samog vrha scene (top: 8px) i završava se 
     na bottom: 28%, tako da cela skrol zona bude čisto iznad džepa koverte */
  top: 8px;
  bottom: 28%;

  transform: translate(-50%, 65%);
  opacity: 0;

  background: #ffffff;
  color: #111;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 22px 40px rgba(0,0,0,0.22);
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  transition: 
    transform 1.3s cubic-bezier(0.22, 1, 0.36, 1) 0.55s,
    opacity 0.4s ease 0.5s;
}

/* STANJE: PAPIR IZAŠAO NAGORE */
.envelope-stage.is-open .paper {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.paper-topline {
  width: 100%;
  height: 10px;
  background: rgba(0,0,0,0.06);
  flex-shrink: 0;
}

/* ================= PAPER CONTENT & SCROLLBAR ================= */
.paper-inner {
  flex: 1;
  /* Veći donji padding (90px) na desktopu omogućava da se tekst i CTA dugme
     pri skrolovanju podignu visoko iznad ivice koverte */
  padding: 20px 24px 90px;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  position: relative;
  scroll-behavior: smooth;

  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #c5a668 #f1ece1;
}

/* Chrome / Edge / Safari scrollbar */
.paper-inner::-webkit-scrollbar {
  width: 10px;
}
.paper-inner::-webkit-scrollbar-track {
  background: #f1ece1;
  border-left: 1px solid rgba(0,0,0,0.06);
}
.paper-inner::-webkit-scrollbar-thumb {
  background: #c5a668;
  border-radius: 999px;
  border: 2px solid #f1ece1;
}
.paper-inner::-webkit-scrollbar-thumb:hover {
  background: #ad8d4f;
}

.paper-title {
  font-size: 23px;
  font-weight: 700;
  margin: 6px 0 6px;
  color: #111;
}

.paper-subtitle {
  font-size: 14.5px;
  font-weight: 600;
  color: #8c6d32;
  margin-bottom: 16px;
}

.paper-content {
  font-size: 15px;
  line-height: 1.65;
  color: #222;
}

.paper-content p {
  margin-bottom: 14px;
}

.paper-content h2 {
  font-size: 17px;
  font-weight: 700;
  color: #111;
  margin: 22px 0 10px;
}

.crown-list {
  list-style: none;
  margin-bottom: 18px;
}

.crown-list li {
  margin-bottom: 10px;
  line-height: 1.55;
}

.closing-box {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.closing-highlight {
  font-weight: 700;
  font-size: 16px;
  color: #111;
}

/* ================= CTA NA KRAJU TEKSTA ================= */
.cta-wrap {
  margin-top: 20px;
  padding-bottom: 10px;
  text-align: center;
}

.cta-text {
  font-weight: 700;
  margin-bottom: 12px;
  color: #111;
}

.cta-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.20);
  background: #E1C485;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.cta-btn:hover {
  transform: translateY(-1px);
}

.cta-btn:active {
  opacity: 0.75;
}

/* ================= MOBILE (OSTALO IDENTIČNO JER JE IDEALNO) ================= */
@media (max-width: 900px) {
  .envelope-page {
    padding-top: 4px;
    padding-bottom: 10px;
  }

  .envelope-stage {
    height: calc(100vh - 75px);
    min-height: 520px;
  }

  .env-layer {
    width: min(440px, 96vw);
    bottom: 6%;
  }

  .envelope-stage.is-open .env-back,
  .envelope-stage.is-open .env-pocket,
  .envelope-stage.is-open .env-flap {
    bottom: -16%;
  }

  .paper {
    width: min(380px, 84vw);
    top: 10px;
    bottom: 22%;
  }

  .paper-inner {
    padding: 16px 16px 28px;
  }

  .paper-title {
    font-size: 21px;
  }

  .paper-content {
    font-size: 14.5px;
  }
}