/* Ginkgo & Knot
   Kraft card, red string, cut-out ginkgo.
   Mobile first; wider layouts at 640px and 900px. */

:root {
  --rice: #f4eee3;
  --linen: #ebe2d2;
  --kraft-light: #c9a77f;
  --ink: #2b2118;
  --ink-soft: #4f4135;
  --lacquer: #2a211b;
  --cinnabar: #a3302a;
  --cinnabar-dark: #84241f;

  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --cjk: "Noto Serif TC", "Songti TC", "PMingLiU", "Noto Serif CJK TC", serif;

  --gutter: 20px;
  --max: 1120px;
  --header-h: 60px;

  /* Paper grain, tiled. Light for the page, heavier for kraft and dark panels. */
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .22 0 0 0 0 .14 0 0 0 0 .06 0 0 0 .3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--grain-light), var(--rice);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.12; }
p { margin: 0 0 1em; }
a { color: inherit; }
[lang="zh-Hant"] { font-family: var(--cjk); font-weight: 700; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--rice);
  font-family: var(--caps); font-size: .8rem; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }

.container { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

.i {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* The logo */
.mark { fill: currentColor; overflow: visible; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 50px; padding: 0 28px;
  border: 0; border-radius: 3px;
  font-family: var(--caps); font-weight: 700; font-size: .8rem;
  letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }

.btn--red {
  background: var(--cinnabar); color: var(--rice);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12), 0 2px 0 var(--cinnabar-dark);
}
.btn--red:hover { background: var(--cinnabar-dark); }

.btn--sm { min-height: 38px; padding: 0 14px; font-size: .68rem; letter-spacing: .14em; }


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

.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--header-h);
  padding: 8px var(--gutter);
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgb(244 238 227 / .94);
  border-bottom: 1px solid rgb(43 33 24 / .08);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-header {
    background: rgb(244 238 227 / .82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand__mark { width: 28px; height: 32px; }
.brand__word { width: 152px; height: 12px; fill: currentColor; }

.site-nav { display: none; }

.hide-xs { display: none; }
@media (min-width: 400px) { .hide-xs { display: inline; } }

/* ---------- Typography bits ---------- */

.eyebrow {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0 0 16px;
  font-family: var(--caps); font-weight: 700; font-size: .74rem;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--cinnabar);
}

/* Red seal stamp, 印章 */
.seal {
  display: inline-grid; place-items: center;
  min-width: 2.2em; padding: .28em .45em .3em;
  background: var(--cinnabar); color: var(--rice);
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgb(244 238 227 / .55);
  font-size: .95rem; letter-spacing: .12em; line-height: 1;
}

h2 {
  font-size: clamp(2rem, 8vw, 3.1rem);
  letter-spacing: -.005em;
  margin-bottom: 18px;
  text-wrap: balance;
}

.section { padding: 72px 0; }
.section-head { max-width: 36rem; margin: 0 auto 40px; text-align: center; }
.section-head p:last-child { color: var(--ink-soft); margin: 0; }

/* Red cord with a knot, used as an ornament above section titles */
.knot-rule {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 22px; color: var(--cinnabar);
}
.knot-rule::before, .knot-rule::after {
  content: ""; width: 56px; height: 1.5px; background: currentColor; opacity: .75;
}
.knot-rule .mark { width: 32px; height: 24px; }

/* Photo mounted on kraft board */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.frame {
  margin: 0; padding: 6px;
  background: var(--grain), var(--kraft-light);
  border-radius: 4px;
  box-shadow: 0 10px 22px -12px rgb(43 33 24 / .45);
  display: flex; flex-direction: column;
}
.frame img, .frame video {
  width: 100%; flex: 1; min-height: 0; height: auto; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 2px; background: var(--linen);
}
.frame figcaption {
  padding: 8px 2px 2px;
  font-style: italic; font-size: .92rem; line-height: 1.3; text-align: center;
  color: var(--ink);
}
.duo .frame:nth-child(2) { margin-top: 0; }

/* Stepper on the knotting-steps card: arrows + counter below the video */
.clip-cap { display: flex; flex-direction: column; gap: 6px; }
.clip-nav { display: flex; align-items: center; justify-content: center; gap: 12px; }
.clip-step {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid rgb(43 33 24 / .35); border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
  transition: background-color .2s, color .2s;
}
.clip-step:hover { background: var(--ink); color: var(--rice); }
.clip-step .i { width: 16px; height: 16px; }
.clip-count { font-style: normal; font-size: .8rem; letter-spacing: .1em; min-width: 3em; }

/* ---------- 1 · Hero ---------- */

.hero { padding-bottom: 8px; }

.hero-media {
  height: min(118vw, 56vh);
  height: min(118vw, 56svh);
  min-height: 340px;
  overflow: hidden;
  background: #6b5a3f;
}
.hero-media img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 32%;
}

.hero-copy { padding: 28px var(--gutter) 0; text-align: center; }
.hero-copy__mark { width: 48px; height: 55px; margin: 0 auto; color: var(--ink); }
.hero-copy__word { margin: 14px 0; line-height: 0; }
.hero-copy__word svg { width: min(100%, 290px); aspect-ratio: 40.3 / 3.2; height: auto; fill: var(--ink); }
.hero-copy .knot-rule { display: none; }
.hero-copy .tagline { margin-bottom: 16px; }
.hero-copy__sub { margin: 0 auto 20px; max-width: 22rem; font-size: 1.06rem; line-height: 1.5; color: var(--ink-soft); text-wrap: balance; }
.hero-copy__foot { margin: 16px 0 0; font-size: .85rem; letter-spacing: .04em; color: var(--ink-soft); }

.tagline-zh { font-weight: 400; font-size: .98rem; letter-spacing: .14em; margin: 0 0 2px; color: var(--ink-soft); }
.tagline {
  font-style: italic; font-size: 1.3rem; line-height: 1.3;
  margin: 0;
}

/* ---------- 2 · Story ---------- */

.story-grid { display: grid; gap: 44px; }
.story-intro { max-width: 36rem; margin: 0 auto; text-align: center; }
.story-intro p:not(.eyebrow) { color: var(--ink-soft); }

.story-name { display: grid; gap: 26px; max-width: 34rem; margin: 0 auto; }
.name-item { display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start; }
.name-item__icon { width: 52px; height: 39px; color: var(--ink); margin-top: 2px; }
.name-item__icon--knot { width: 46px; height: 34px; margin: 4px 0 0 3px; }
.name-item h3 { font-size: 1.4rem; margin-bottom: 6px; }
.name-item h3 span { color: var(--cinnabar); font-size: .9em; margin-right: 4px; }
.name-item p { margin: 0; font-size: 1.02rem; color: var(--ink-soft); }

/* A blessing card (rendered from the card designs). The logo and holes are
   cut through, so whatever is behind the card shows through them. */
.card-art { display: block; position: relative; aspect-ratio: 2 / 3; }
.card-art img { width: 100%; height: 100%; }

/* ---------- 3 · Twelve Blessings ---------- */

.section--dark {
  background: var(--grain), var(--lacquer);
  color: var(--rice);
}
.section--dark .eyebrow { color: rgb(244 238 227 / .75); }
.section--dark .section-head p:last-child { color: rgb(244 238 227 / .78); }

.blessing-wall {
  --gap: 12px;
  list-style: none; margin: 56px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap); row-gap: 46px;
}

.blessing { position: relative; }

/* the red string the cards hang from */
.blessing::before {
  content: ""; position: absolute; z-index: 3;
  left: calc(var(--gap) / -2); right: calc(var(--gap) / -2); top: -20px; height: 2px;
  background: linear-gradient(90deg, #8e2822, #c4473d 50%, #8e2822);
  box-shadow: 0 1px 2px rgb(0 0 0 / .5);
}

.blessing__card {
  display: block; text-decoration: none; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.blessing__card .card-art {
  transform-origin: 50% -20px;
  transition: transform .6s cubic-bezier(.3, .7, .2, 1);
}
/* two short threads down into the punched holes (8mm from top and sides) */
.blessing__card .card-art::after {
  content: ""; position: absolute; z-index: 3; pointer-events: none;
  left: 10%; right: 10%; top: -20px; height: calc(20px + 6.667%);
  border-inline: 1.5px solid #b8352e;
}
.blessing__card:hover .card-art,
.blessing__card:focus-visible .card-art { transform: rotate(-2deg); }
.blessing__card:focus-visible { outline: none; }
.blessing__card:focus-visible .blessing__label { outline: 2px solid var(--rice); outline-offset: 3px; }

.blessing__label {
  display: block; margin-top: 10px; text-align: center;
  font-family: var(--caps); font-weight: 700; font-size: .6rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgb(244 238 227 / .86);
}
.blessing__label [lang] {
  font-size: 1rem; letter-spacing: 0; color: var(--rice);
  margin-right: 3px; vertical-align: -1px;
}

.keepsake {
  max-width: 34rem; margin: 64px auto 0; text-align: center;
}
.keepsake__mark { width: 64px; height: 48px; margin: 0 auto 14px; color: var(--rice); }
.keepsake h3 { font-size: 1.7rem; margin-bottom: 12px; }
.keepsake p { color: rgb(244 238 227 / .78); margin: 0; }

/* ---------- 4 · Ready to give ---------- */

.gift-grid { display: grid; gap: 44px; }
.gift-copy { max-width: 34rem; margin: 0 auto; text-align: center; }

.steps {
  list-style: none; margin: 8px 0 32px; padding: 0;
  display: grid; gap: 22px; text-align: left;
}
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.steps__num {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cinnabar); color: var(--rice);
  box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgb(244 238 227 / .55);
  font-size: 1.1rem;
}
.steps h3 { font-size: 1.3rem; margin: 4px 0 4px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 1.02rem; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 64px 0 calc(40px + env(safe-area-inset-bottom));
  background: var(--grain), var(--lacquer);
  color: var(--rice);
  text-align: center;
}
.site-footer__mark { width: 62px; height: 72px; margin: 0 auto 18px; color: var(--rice); }
.site-footer__word { margin: 0 0 12px; line-height: 0; }
.site-footer__word svg { width: 230px; aspect-ratio: 40.3 / 3.2; height: auto; fill: var(--rice); }
.site-footer .tagline { color: rgb(244 238 227 / .75); margin-bottom: 30px; }

.contact-links {
  list-style: none; margin: 30px 0 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.contact-links a {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 8px;
  text-decoration: none; color: var(--rice);
  font-size: 1.05rem;
}
.contact-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.contact-links .i { width: 20px; height: 20px; color: rgb(244 238 227 / .75); }

.site-footer__fine {
  margin: 36px 0 0; padding-top: 22px;
  border-top: 1px solid rgb(244 238 227 / .14);
  font-size: .88rem; color: rgb(244 238 227 / .6);
}

/* ---------- Card viewer ---------- */

html:has(.viewer[open]) { overflow: hidden; }

.viewer {
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--rice);
}
.viewer::backdrop { background: rgb(26 20 16 / .9); }
.viewer form { display: contents; }
.viewer[open] {
  display: grid; place-items: center; align-content: center; gap: 22px;
  padding: max(64px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.viewer__art {
  width: min(72vw, 38vh, 380px);
  width: min(72vw, 38svh, 380px);
  filter: drop-shadow(0 18px 30px rgb(0 0 0 / .45));
}
.viewer__close {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: rgb(244 238 227 / .12); color: var(--rice);
  cursor: pointer;
}
.viewer__close .i { width: 22px; height: 22px; }
.viewer__text { max-width: 24rem; text-align: center; }
.viewer h3 { display: flex; align-items: baseline; justify-content: center; gap: 12px; font-size: 1rem; }
.viewer__char { font-size: 2rem; }
.viewer__name { font-family: var(--caps); font-weight: 700; font-size: 1.05rem; letter-spacing: .16em; text-transform: uppercase; }
.viewer__greeting { font-weight: 400; font-size: 1.1rem; letter-spacing: .1em; color: rgb(244 238 227 / .82); margin: 10px 0 8px; }
.viewer__wishes { font-style: italic; font-size: 1.2rem; line-height: 1.45; margin: 0 0 18px; }
.viewer__nav { display: flex; align-items: center; justify-content: center; gap: 20px; }
.viewer__step {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgb(244 238 227 / .3); border-radius: 50%;
  background: none; color: var(--rice); cursor: pointer;
}
.viewer__step:hover { border-color: var(--rice); }
.viewer__count { font-family: var(--caps); font-size: .78rem; letter-spacing: .16em; color: rgb(244 238 227 / .7); min-width: 4.5em; }
@media (prefers-reduced-motion: no-preference) {
  .viewer[open] .viewer__art { animation: card-in .45s cubic-bezier(.2, .7, .2, 1); }
  @keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
}

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  :root { --gutter: 32px; }
  .section { padding: 96px 0; }
  .duo { gap: 18px; }
  .blessing-wall { --gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 54px; }
  .blessing__label { font-size: .68rem; }
  .story-name { grid-template-columns: 1fr 1fr; max-width: none; }
  .contact-links { flex-direction: row; justify-content: center; gap: 18px; }
}

@media (min-width: 900px) {
  :root { --header-h: 68px; }

  .site-header { padding-inline: max(32px, (100% - var(--max)) / 2); }
  .brand__mark { width: 31px; height: 36px; }
  .brand__word { width: 170px; height: 14px; }
  .site-nav { display: flex; gap: 30px; margin-left: auto; margin-right: 18px; }
  .site-nav a {
    font-family: var(--caps); font-weight: 500; font-size: .76rem; letter-spacing: .16em;
    text-transform: uppercase; text-decoration: none; color: var(--ink-soft);
    padding: 6px 0; border-bottom: 1px solid transparent;
  }
  .site-nav a:hover { color: var(--ink); border-bottom-color: var(--cinnabar); }

  .hero {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    width: min(100% - 64px, var(--max)); margin: 0 auto;
    padding: 48px 0 24px;
  }
  .hero-media {
    height: auto; min-height: 0;
    aspect-ratio: 3 / 4; max-height: calc(100vh - var(--header-h) - 96px);
    border-radius: 6px;
    box-shadow: 0 24px 50px -24px rgb(43 33 24 / .6);
  }
  .hero-copy { padding: 0 0 0 48px; }
  .hero-copy .knot-rule { display: flex; margin: 22px 0 18px; }
  .hero-copy .tagline { margin-bottom: 0; }
  .hero-copy__mark { width: 84px; height: 96px; }
  .hero-copy__word { margin: 20px 0 18px; }
  .hero-copy__word svg { width: 360px; }
  .hero-copy .tagline { font-size: 1.5rem; }

  .story-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "intro media" "name media";
    column-gap: 72px; row-gap: 40px; align-items: start;
  }
  .story-intro { grid-area: intro; text-align: left; margin: 0; }
  .story-intro .eyebrow, .gift-copy .eyebrow { justify-content: flex-start; }
  .story-intro .knot-rule, .gift-copy .knot-rule { justify-content: flex-start; }
  .story-intro .knot-rule::before, .gift-copy .knot-rule::before { display: none; }
  .story-media { grid-area: media; align-self: center; }
  .story-name { grid-area: name; margin: 0; grid-template-columns: 1fr; }

  .blessing-wall { --gap: 22px; grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 60px; }

  .gift-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 72px; align-items: center; }
  .gift-copy { text-align: left; margin: 0; }

  .viewer[open] { grid-template-columns: auto auto; column-gap: 64px; }
  .viewer__art { width: min(30vw, 54vh, 400px); width: min(30vw, 54svh, 400px); }
  .viewer__text { text-align: left; }
  .viewer h3, .viewer__nav { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
