/*
 * Layout: a single column that is the full screen width on phones and capped
 * at 450px (centred) on larger screens. 1rem = 1/10 of the column width, so
 * everything scales together. Sections flow normally; spacing comes from the
 * tokens below.
 */

:root {
  --bg: #473529;
  --card: rgb(59, 40, 34);
  --text: rgb(206, 189, 181);
  --accent: rgb(252, 224, 203);
  --muted: rgb(149, 120, 112);
  --tan: rgb(147, 113, 86);
  --tag: rgb(225, 192, 161);
  --label-bg: rgb(122, 81, 56);
  --label-fg: rgb(230, 188, 163);
  --line: rgb(80, 58, 50);

  --pad: 0.6rem;          /* left/right page padding */
  --gap: 0.8rem;          /* space between items inside a section */
  --section: 2rem;        /* space between sections */
  --radius: 0.16rem;      /* photo / card corners */
  --text-scale: 1;        /* multiplies all body/small text sizes */
}

/* Phones: the column is narrower than on desktop, so bump the text up a bit */
@media (max-width: 600px) {
  :root { --text-scale: 1.12; }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: min(10vw, 45px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  overflow-x: hidden;
}

ul { list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---- Page & shared pieces ---------------------------------------------------- */

.page {
  position: relative;
  width: 10rem;
  margin: 0 auto;
  overflow: hidden;
  padding-bottom: 1.2rem;
}

.section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: var(--section);
  padding: 0 var(--pad);
}

.photo {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Three little squares used as a divider */
.dots { display: flex; justify-content: center; gap: 0.16rem; }
.dots i { width: 0.24rem; height: 0.24rem; }
.dots i:nth-child(1) { background: rgb(113, 95, 82); }
.dots i:nth-child(2) { background: rgb(122, 81, 56); }
.dots i:nth-child(3) { background: rgb(31, 16, 11); }

.quote {
  font-size: calc(0.48rem * var(--text-scale));
  font-weight: bold;
  line-height: 2;
  letter-spacing: 0.03rem;
  text-align: center;
  text-wrap: balance;
}

.quote-accent { color: var(--accent); }

.story {
  font-size: calc(0.4rem * var(--text-scale));
  font-weight: bold;
  line-height: 1.9;
  letter-spacing: 0.02rem;
  padding: 0 0.1rem;
}

.story-date {
  display: block;
  margin-bottom: 0.25rem;
  font-size: calc(0.38rem * var(--text-scale));
  color: var(--accent);
  letter-spacing: 0.04rem;
}

.squiggle {
  width: 4.4rem;
  margin: 0 auto;
}

/* Brown pill heading with the little yellow sparkle, e.g. 婚禮時間 */
.label {
  position: relative;
  align-self: center;
  padding: 0.14rem 0.4rem;
  background: var(--label-bg);
  color: var(--label-fg);
  font-size: calc(0.44rem * var(--text-scale));
  font-weight: normal;
  letter-spacing: 0.08rem;
  line-height: 1.2;
}

.label::after {
  content: "";
  position: absolute;
  top: -0.42rem;
  right: -0.4rem;
  width: 0.5rem;
  height: 0.66rem;
  background: url(../assets/images/26.png) center / contain no-repeat;
}

/* Fade-in as sections scroll into view (only when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---- Hero -------------------------------------------------------------------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 3.6rem var(--pad) 0;
}

.hero + .section { margin-top: 1rem; }

.hero .dots {
  position: absolute;
  top: 1.8rem;
  right: var(--pad);
}

.hero-text {
  font-size: calc(0.4rem * var(--text-scale));
  font-weight: bold;
  line-height: 2.1;
  letter-spacing: 0.05rem;
  text-align: right;
}

.hero-date {
  margin-top: 0.4rem;
  color: #fff;
  font-size: calc(0.5rem * var(--text-scale));
  font-weight: bold;
  font-style: oblique;
  letter-spacing: 0.12rem;
}

/* The mountain sits right under the date.
   margin-top = gap to the date, width = size (height follows),
   brightness() = how light the lines are (1 = original). */
.hero-mountain {
  align-self: center;
  width: 10.6rem;
  max-width: none;
  margin-top: 0.3rem;
  filter: brightness(1.8);
}

/* ---- Movie card ------------------------------------------------------------- */

.movie { gap: 0.45rem; color: #fff; }

.movie-top {
  display: flex;
  gap: 0.4rem;
}

.movie-poster {
  flex: none;
  width: 3.2rem;
  height: 5.6rem;
  object-fit: cover;
  border-radius: var(--radius);
}

.movie-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.movie-title {
  font-size: 0.6rem;
  font-weight: bold;
  line-height: 1.15;
  letter-spacing: 0.04rem;
}

.movie-title-en {
  margin-top: 0.04rem;
  font-size: 0.46rem;
  line-height: 1.2;
  white-space: nowrap;
}

.movie-year {
  margin-top: 0.08rem;
  font-size: calc(0.3rem * var(--text-scale));
  color: var(--text);
}

.movie-badge {
  margin-top: 0.22rem;
  padding: 0.07rem 0.2rem;
  border-radius: 0.06rem;
  background: rgb(250, 208, 148);
  color: rgb(145, 97, 31);
  font-size: calc(0.26rem * var(--text-scale));
  font-weight: bold;
  letter-spacing: 0.03rem;
}

.movie-meta {
  margin-top: 0.22rem;
  font-size: calc(0.26rem * var(--text-scale));
  line-height: 1.75;
  color: var(--text);
}

.movie-buttons {
  margin-top: auto;
  display: flex;
  gap: 0.24rem;
  align-self: stretch;
}

.movie-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  height: 0.8rem;
  border-radius: 0.13rem;
  background: #fff;
  color: #000;
  font-size: calc(0.32rem * var(--text-scale));
  font-weight: bold;
}

.movie-btn img { width: 0.4rem; height: 0.4rem; }

.rating {
  position: relative;
  padding: 0.4rem 0.45rem 0.3rem;
  border-radius: var(--radius);
  background: var(--card);
}

.rating-more {
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  font-size: calc(0.45rem * var(--text-scale));
  line-height: 1;
  color: var(--text);
}

.rating-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.rating-score {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
}

.rating-number {
  font-size: 1.15rem;
  font-weight: bold;
  line-height: 1;
}

.rating-score img { width: 1.6rem; }

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.rating-bars img { width: 100%; }

.rating-count {
  font-size: calc(0.24rem * var(--text-scale));
  color: var(--text);
}

.rating-footer {
  margin-top: 0.3rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--line);
  font-size: calc(0.26rem * var(--text-scale));
  color: var(--text);
}

.rating-footer .dot { margin: 0 0.15rem; }

/* "Stay with me" card: tapping it toggles the music */
.song {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0.3rem 0.3rem 0.3rem 0.4rem;
  border: 0;
  border-radius: var(--radius);
  background: rgb(239, 236, 233);
  text-align: left;
  cursor: pointer;
}

.song-text { flex: 1; display: flex; flex-direction: column; gap: 0.16rem; }
.song-title { color: rgb(59, 40, 34); font-size: calc(0.45rem * var(--text-scale)); font-weight: bold; }
.song-status { color: rgb(160, 160, 160); font-size: calc(0.28rem * var(--text-scale)); }
.song-bars { width: 0.5rem; align-self: flex-end; margin-bottom: 0.1rem; }
.song-cover { width: 1.6rem; height: 1.6rem; object-fit: cover; border-radius: 0.1rem; }

/* ---- Intro: couple ---------------------------------------------------------------- */

.couple {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.2rem 0.3rem;
}

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.person-photo {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  object-fit: cover;
}

.person-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.person-flip .person-name { align-items: flex-end; }

.person-role {
  color: var(--muted);
  font-size: calc(0.5rem * var(--text-scale));
  font-weight: bold;
  letter-spacing: 0.07rem;
}

.person-tag {
  padding: 0.18rem 0.45rem;
  background: var(--tag);
  color: var(--tan);
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.1rem;
  line-height: 1.2;
}

/* ---- Chapters -------------------------------------------------------------------- */

.chapter-head {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: -0.1rem;
}

.chapter-title {
  color: #fff;
  font-size: 0.7rem;
  font-weight: bold;
  line-height: 1;
}

/* small tan tag with a diagonal stroke through its corner */
.chapter-tag {
  position: relative;
  padding: 0.08rem 0.3rem;
  background: var(--tag);
  color: var(--tan);
  font-size: calc(0.36rem * var(--text-scale));
  font-weight: bold;
  letter-spacing: 0.08rem;
  line-height: 1.2;
}

.chapter-tag::before {
  content: "";
  position: absolute;
  left: -0.35rem;
  top: 0.25rem;
  width: 1rem;
  height: 1px;
  background: var(--muted);
  transform: rotate(-45deg);
}

/* Two photos side by side; the column with the caption is the shorter photo */
.pair {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.3rem;
  align-items: start;
}

.pair-flip { grid-template-columns: 1.2fr 1fr; }

.pair-col { display: flex; flex-direction: column; gap: 0.35rem; }
.pair-flip .pair-col { margin-top: 0.6rem; }

.motto {
  padding-top: 0.25rem;
  border-top: 1px solid var(--tag);
  color: var(--muted);
  font-size: calc(0.28rem * var(--text-scale));
  line-height: 1.5;
  letter-spacing: 0.02rem;
  text-wrap: balance;
}

.pair-flip .motto { text-align: right; }

/* ---- Invitation ------------------------------------------------------------------ */

.invite { padding-top: 0.4rem; }

.invite-lily {
  position: absolute;
  right: -0.8rem;
  top: -0.6rem;
  width: 6rem;
  max-width: none;
  opacity: 0.45;
  pointer-events: none;
}

.invite .story { position: relative; }

.invite-from {
  position: relative;
  align-self: flex-end;
  font-size: calc(0.42rem * var(--text-scale));
  font-weight: bold;
  letter-spacing: 0.03rem;
}

/* ---- Date, schedule, venue --------------------------------------------------------- */

.info { align-items: stretch; }

.info-text {
  font-size: calc(0.4rem * var(--text-scale));
  font-weight: bold;
  line-height: 1.9;
  text-align: center;
}

.schedule {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.schedule li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  color: var(--accent);
  font-weight: bold;
}

.schedule img { height: 1.75rem; width: auto; margin-bottom: 0.1rem; }
.schedule span { font-size: calc(0.38rem * var(--text-scale)); }
.schedule b { font-size: calc(0.34rem * var(--text-scale)); }

/* ---- Notes & closing ----------------------------------------------------------------- */

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: calc(0.38rem * var(--text-scale));
  font-weight: bold;
  line-height: 1.7;
}

.notes-list li {
  position: relative;
  padding-left: 1.6em;
}

.notes-list li::before {
  content: "🫧";
  position: absolute;
  left: 0;
  top: 0;
}

.closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--section);
  padding: 0 var(--pad);
}

.closing .quote { font-size: calc(0.42rem * var(--text-scale)); }
/* Same treatment as the title mountain: full width, lines lifted to match */
.closing-mountain {
  width: 10rem;
  max-width: none;
  margin: 0.2rem calc(-1 * var(--pad)) 0;
  filter: brightness(1.15);
}

/* ---- Top bar (tabs, back to top, music) ---------------------------------- */

html { scroll-behavior: smooth; }
#date, #venue, #notes { scroll-margin-top: 1.5rem; }

.topbar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.16rem;
  width: 10rem;
  margin: 0 auto;
  padding: 0.18rem 0.2rem;
  background: rgba(59, 40, 34, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(225, 192, 161, 0.15);
  pointer-events: auto;
}

/* Language picker (top-left) */
.lang { position: relative; flex: none; }

.lang-btn {
  min-width: 0.72rem;
  height: 0.72rem;
  padding: 0 0.14rem;
  border: 1px solid rgba(225, 192, 161, 0.4);
  border-radius: 0.36rem;
  background: none;
  color: var(--text);
  font-size: calc(0.28rem * var(--text-scale));
  font-weight: bold;
  cursor: pointer;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.16rem);
  left: 0;
  min-width: 2.6rem;
  padding: 0.1rem;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 0.1rem 0.4rem rgba(0, 0, 0, 0.35);
}

.lang-menu button {
  display: block;
  width: 100%;
  padding: 0.16rem 0.2rem;
  border: 0;
  border-radius: 0.1rem;
  background: none;
  color: var(--text);
  font-size: calc(0.32rem * var(--text-scale));
  text-align: left;
  cursor: pointer;
}

.lang-menu button[aria-current="true"] {
  background: var(--label-bg);
  color: var(--label-fg);
}

.tabs {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 0.12rem;
  min-width: 0;
}

.tab {
  padding: 0.12rem 0.22rem;
  border-radius: 1rem;
  color: var(--text);
  font-size: calc(0.3rem * var(--text-scale));
  font-weight: bold;
  letter-spacing: 0.03rem;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

.tab.active {
  background: var(--label-bg);
  color: var(--label-fg);
}

.to-top {
  flex: none;
  display: grid;
  place-items: center;
  width: 0.72rem;
  height: 0.72rem;
  border: 1px solid rgba(225, 192, 161, 0.4);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.to-top svg {
  width: 0.4rem;
  height: 0.4rem;
  fill: none;
  stroke: var(--text);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Music button ---------------------------------------------------------- */

.music {
  position: relative;
  flex: none;
  width: 0.72rem;
  height: 0.72rem;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(75, 41, 16, 0.54);
  cursor: pointer;
}

.music img {
  display: block;
  width: 100%;
  height: 100%;
}

.music.playing img { animation: spin 5s linear infinite; }

/* Diagonal strike-through while paused */
.music:not(.playing)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0.05333rem;
  margin-top: -0.02667rem;
  background: #fff;
  transform: rotate(45deg);
}

@keyframes spin { to { transform: rotate(1turn); } }

/* ---- Countdown ------------------------------------------------------------ */

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.24rem;
}

.cd-box {
  padding: 0.16rem 0 0.14rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
}

.cd-digits {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.cd-digit {
  position: relative;
  width: 0.36rem;
  height: 0.72rem;
  overflow: hidden;
  font-size: 0.56rem;
  font-weight: bold;
  line-height: 0.72rem;
  text-align: center;
}

.cd-digit span {
  position: absolute;
  inset: 0 0 auto;
  text-align: inherit;
}

.cd-digit .next { transform: translateY(-100%); }

.cd-digit.flip span {
  transition: transform 0.4s ease-in-out, opacity 0.3s ease-in-out;
}
.cd-digit.flip .next { transform: translateY(0); }
.cd-digit.flip .curr { transform: translateY(100%); opacity: 0.6; }

.cd-label {
  font-size: calc(0.28rem * var(--text-scale));
  text-align: center;
  white-space: nowrap;
  opacity: 0.8;
}

/* ---- Calendar ------------------------------------------------------------- */

.calendar {
  --theme: rgb(248, 182, 135);
  --heart: rgb(199, 31, 49);
  padding: 0.2rem 0 0.4rem;
  border-radius: var(--radius);
  background: #fff;
}

.cal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0.3rem 0.6rem 0.2rem;
  line-height: 1;
  font-size: 0.8rem;
  color: var(--theme);
}

.cal-top small { font-size: calc(0.36rem * var(--text-scale)); }
.cal-top .cal-year { font-size: calc(0.44rem * var(--text-scale)); }

.cal-week {
  display: flex;
  height: 0.9rem;
  line-height: 0.9rem;
  margin: 0 0.5rem;
  border-bottom: 1px solid var(--theme);
}

.cal-week span {
  width: calc(100% / 7);
  text-align: center;
  font-size: calc(0.3rem * var(--text-scale));
  font-weight: 600;
  color: var(--theme);
}

.cal-days {
  display: flex;
  flex-wrap: wrap;
  padding: 0.1rem 0.5rem 0;
}

.cal-days li {
  position: relative;
  width: calc(100% / 7);
  height: 0.62rem;
  margin-top: 0.14rem;
}

.cal-days li:first-child { margin-left: calc(var(--offset) * 100% / 7); }

.cal-days span {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  font-size: calc(0.32rem * var(--text-scale));
  color: var(--theme);
  transform: translate(-50%, -50%);
}

.cal-days li.active span {
  color: var(--heart);
  font-size: calc(0.28rem * var(--text-scale));
  font-weight: bold;
}

.cal-days .heart {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.66rem;
  height: 0.62rem;
  margin: -0.31rem 0 0 -0.33rem;
  /* heart.svg is used as a mask so it takes the heart colour */
  background: var(--heart);
  -webkit-mask: url(../assets/icons/heart.svg) center / contain no-repeat;
  mask: url(../assets/icons/heart.svg) center / contain no-repeat;
  animation: heartbeat 0.8s ease infinite alternate;
}

@keyframes heartbeat { to { transform: scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
  .music.playing img,
  .cal-days .heart { animation: none; }
  .cd-digit.flip span { transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
