@font-face {
  font-family: "Bodoni Moda";
  src: url("./assets/fonts/bodoni-moda.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* The 18pt optical cut keeps hairlines readable at every screen size. */
@font-face {
  font-family: "Bodoni Moda";
  src: url("./assets/fonts/bodoni-moda-mobile-semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Inspiration";
  src: url("./assets/fonts/inspiration.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Arima";
  src: url("./assets/fonts/arima.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8f7f3;
  --ink: #282925;
  --ivory: #fffdf7;
  --frame-x: clamp(28px, 5vw, 100px);
  --frame-y: clamp(28px, 6vh, 64px);
  --corner: 10px;
  --serif: "Bodoni Moda", "Bodoni MT", "Didot", Georgia, serif;
  --caption: "Arima", Georgia, serif;
}

* { box-sizing: border-box; }
html { min-width: 280px; min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  padding: var(--frame-y) var(--frame-x);
  min-height: 100vh;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: #a8b39b; color: #1e231c; }
p, h1 { margin: 0; }

.invitation {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: "hero" minmax(640px, 1fr) / minmax(0, 1fr);
  width: 100%;
  max-width: 1920px;
  height: calc(100vh - var(--frame-y) * 2);
  height: calc(100svh - var(--frame-y) * 2);
  min-height: 640px;
  margin-inline: auto;
  color: var(--ivory);
}

.photograph, .veil {
  grid-area: hero;
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: var(--corner);
  overflow: hidden;
}
.photograph { z-index: -3; background: #4a4b46; pointer-events: none; }
.photo-slide {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus-desktop, 50% 65%);
  filter: grayscale(1);
  opacity: 0;
  z-index: 0;
  transition: opacity 3000ms cubic-bezier(0.4, 0, 0.2, 1);
}
.photo-slide.is-visible { opacity: 1; z-index: 1; }
/* Keep the outgoing frame opaque until the incoming photo covers it. */
.photo-slide.is-entering { opacity: 1; z-index: 2; }
.veil {
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(21 23 22 / 36%) 0%, rgb(21 23 22 / 26%) 30%, rgb(21 23 22 / 9%) 49%, transparent 65%),
    linear-gradient(180deg, rgb(18 20 19 / 10%), transparent 22%);
}

.monogram {
  grid-area: hero;
  align-self: start;
  justify-self: center;
  margin-top: 28px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.035em;
  white-space: nowrap;
  text-shadow: 0 1px 12px rgb(0 0 0 / 15%);
}
.monogram-ampersand { font-size: 0.75em; margin-inline: 0.08em; }

.composition {
  grid-area: hero;
  align-self: center;
  justify-self: start;
  width: 53%;
  padding: 35px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(-38px);
}
.introduction { width: 100%; }
.save-the-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(80px, min(7.1vw, 11.5vh), 136px);
  font-weight: 600;
  font-optical-sizing: auto;
  line-height: 0.97;
  text-shadow: 0 1px 18px rgb(0 0 0 / 8%);
}
.title-word {
  display: block;
  padding-left: 0.19em;
  letter-spacing: 0.19em;
}
.title-script {
  position: relative;
  display: block;
  width: 2.6em;
  height: 0.77em;
  margin-top: 0.05em;
  margin-bottom: 0.02em;
  font-family: "Inspiration", cursive;
  font-size: 0.69em;
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: 0;
  text-align: left;
}
.title-script > span { position: relative; z-index: 1; }
.swash {
  position: absolute;
  left: 1.1em;
  top: 0.04em;
  width: 2.25em;
  height: 0.6em;
  opacity: 0.85;
}
.date {
  margin-top: 32px;
  padding-left: 0.32em;
  font-family: var(--serif);
  font-size: clamp(23px, 2.2vw, 34px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.32em;
  white-space: nowrap;
}

.countdown {
  width: min(100%, 360px);
  margin-top: 25px;
  font-weight: 400;
}
.countdown-rule {
  height: 1px;
  width: 76px;
  background: currentColor;
  opacity: 0.58;
  margin: 0 auto 20px;
}
.days { display: flex; flex-direction: column; align-items: center; }
.days-value {
  font-family: var(--serif);
  font-size: clamp(60px, 4.8vw, 82px);
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
  letter-spacing: -0.04em;
}
.days-label {
  margin-top: 3px;
  font-family: var(--caption);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.045em;
}
.time-units { display: flex; justify-content: center; margin-top: 20px; }
.time-unit { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; }
.time-unit + .time-unit { border-left: 1px solid rgb(255 253 247 / 45%); }
.time-value {
  font-family: var(--serif);
  font-size: clamp(27px, 2.5vw, 38px);
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: lining-nums tabular-nums;
}
.time-label {
  font-family: var(--caption);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.no-script { font-family: var(--caption); font-size: 14px; margin-top: 12px; }

@media (min-width: 900px) and (max-height: 800px) {
  :root { --frame-y: 28px; }
  .composition { padding-block: 22px; transform: translateY(-12px); }
  .save-the-date { font-size: clamp(76px, 8.8vh, 88px); }
  .date { margin-top: 20px; font-size: 24px; }
  .countdown { margin-top: 19px; max-width: 310px; }
  .countdown-rule { margin-bottom: 13px; }
  .days-value { font-size: 62px; }
  .time-units { margin-top: 15px; }
  .time-value { font-size: 30px; }
}

/* A distinct portrait composition; the same counter moves below the photo. */
@media (max-width: 899px), (orientation: portrait) and (max-width: 1100px) {
  :root { --frame-x: 16px; --frame-y: 16px; }
  body { padding-top: max(var(--frame-y), env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .invitation {
    grid-template: "hero" clamp(550px, 74svh, 820px) "counter" auto / minmax(0, 1fr);
    height: auto;
    min-height: 0;
    max-width: 680px;
    color: var(--ivory);
  }
  .photo-slide { object-position: var(--focus-mobile, 58% 50%); }
  .veil {
    background: linear-gradient(180deg, rgb(19 22 21 / 36%) 0%, rgb(19 22 21 / 28%) 25%, rgb(19 22 21 / 12%) 44%, transparent 64%);
  }
  .monogram { font-size: 28px; margin-top: 24px; }
  .composition { display: contents; }
  .introduction {
    grid-area: hero;
    align-self: start;
    justify-self: center;
    margin-top: clamp(82px, 11svh, 120px);
    text-align: center;
    padding-inline: 12px;
  }
  .save-the-date { font-size: clamp(62px, 17vw, 96px); line-height: 0.98; }
  .title-word { letter-spacing: 0.17em; padding-left: 0.17em; }
  .title-script { height: 0.75em; margin-top: 0.07em; }
  .date { font-size: clamp(21px, 5.5vw, 28px); margin-top: 24px; letter-spacing: 0.24em; padding-left: 0.24em; }
  .countdown {
    grid-area: counter;
    justify-self: center;
    color: var(--ink);
    width: min(100%, 380px);
    margin-top: 28px;
    padding-inline: 12px;
    text-align: center;
  }
  .countdown-rule { display: none; }
  .days-value { font-size: 88px; }
  .days-label { font-size: 15px; margin-top: 2px; letter-spacing: 0.07em; }
  .time-units { border-top: 1px solid rgb(40 41 37 / 28%); padding-top: 17px; margin-top: 18px; }
  .time-unit + .time-unit { border-color: rgb(40 41 37 / 26%); }
  .time-value { font-size: 35px; }
  .time-label { font-size: 12px; }
}

@media (max-width: 359px) {
  :root { --frame-x: 12px; --frame-y: 12px; }
  .save-the-date { font-size: 57px; }
  .date { font-size: 19px; }
  .time-value { font-size: 31px; }
  .time-label { font-size: 11px; letter-spacing: 0.02em; }
}

@media (prefers-reduced-motion: no-preference) {
  .introduction, .monogram { animation: arrive 850ms ease-out both; }
  .countdown { animation: arrive 1000ms ease-out both; }
  @keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  .photo-slide { transition: none; }
}
