:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #242a24;
  --pine: #243d32;
  --muted: #62675d;
  --line: #dedfd5;
  --glass: #fffdf4bf;
  --glass-edge: #fffef3a6;
  --shadow: 0 16px 42px -26px #273b30a3;
  --card-radius: 21px;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 92% 350px, #dedfca74, transparent 52rem),
    radial-gradient(ellipse at 7% 830px, #eee5d681, transparent 45rem),
    var(--paper);
}
html { scroll-behavior: smooth; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, .hero:focus-visible {
  outline: 2px solid #a4773c;
  outline-offset: 4px;
}
button[hidden], a[hidden], [hidden] { display: none !important; }
img { display: block; width: 100%; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.frame { width: min(1400px, calc(100% - 96px)); margin-inline: auto; }

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1400px, calc(100% - 96px));
  min-height: 84px;
  margin-inline: auto;
}
.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--pine);
  font-family: var(--serif);
  font-size: 1.67rem;
  font-weight: 700;
  letter-spacing: .055em;
}
.brand img { flex: none; width: 41px; }
.brand-ai { margin-left: .1em; font-family: Georgia, serif; font-weight: 500; letter-spacing: -.075em; }
.nav { display: flex; justify-content: center; align-items: center; gap: clamp(24px, 4vw, 55px); }
.nav a { display: inline-flex; align-items: center; min-height: 44px; gap: .4em; color: var(--muted); font-size: .875rem; position: relative; white-space: nowrap; }
.nav a.active, .nav a:hover { color: var(--pine); }
.nav a.active::after { content: ""; position: absolute; inset: auto 0 3px; height: 1px; background: currentColor; }
#favorite-count { font-family: Georgia, serif; font-size: .875rem; }
.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.selection-button, .cart-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cdd2c6;
  border-radius: 100px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--pine);
  white-space: nowrap;
  font-size: .875rem;
}
.selection-button:hover, .cart-toggle:hover { background: #e9eee5; }
.selection-button .icon, .cart-toggle .icon { width: 18px; height: 18px; }
#cart-count {
  display: grid;
  place-items: center;
  min-width: 1.4rem;
  min-height: 1.4rem;
  padding-inline: 4px;
  border-radius: 99px;
  color: #fffcf4;
  background: var(--pine);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.hero {
  height: clamp(440px, 36vw, 565px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #3e4b3980;
  border-radius: clamp(22px, 2.6vw, 38px);
  background: #31382c;
  color: #fffdf5;
  box-shadow: 0 25px 55px -34px #213127b3;
  touch-action: pan-y pinch-zoom;
}
.slide { position: absolute; inset: 0; display: flex; align-items: center; opacity: 0; visibility: hidden; transition: opacity .65s ease, visibility .65s; }
.slide.is-active { opacity: 1; visibility: visible; z-index: 1; }
.slide img, .slide::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.slide img { object-fit: cover; object-position: center 48%; }
.slide.coast img { object-position: center 47%; }
.slide.studio img { object-position: center 45%; }
.slide::after {
  content: "";
  background:
    linear-gradient(90deg, #0c1711e8 0%, #121f17ad 32%, #1620183e 61%, #21291d14 86%),
    linear-gradient(0deg, #111a1475, transparent 33%);
}
.slide-copy { position: relative; z-index: 1; margin: -15px 0 0 clamp(38px, 6vw, 98px); max-width: calc(100% - 76px); }
.eyebrow { margin: 0; display: flex; align-items: center; gap: 11px; font-family: Georgia, serif; font-size: .79rem; letter-spacing: .24em; line-height: 1.4; }
.eyebrow span { width: 23px; height: 1px; background: currentColor; opacity: .7; }
.slide .eyebrow { color: #f4eee1; }
.slide h1, .slide h2 {
  font-family: var(--serif);
  margin: 22px 0 19px;
  font-size: clamp(3.25rem, 5.2vw, 5.3rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: .075em;
}
.slide-description { margin: 0 0 28px; color: #f0eee5; font-size: 1rem; line-height: 1.65; letter-spacing: .025em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 47px; padding: 11px 20px; border: 1px solid transparent; border-radius: 11px; font-size: .875rem; letter-spacing: .035em; transition: background .2s, color .2s; }
.button-light { color: var(--pine); background: #fff9ebe3; border-color: var(--glass-edge); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.button-light:hover { background: #fff8e7; }
.button-dark { color: #fffdf5; background: var(--pine); }
.button-dark:hover { background: #345545; }
.slide-position, .slide-actions { position: absolute; z-index: 2; display: flex; align-items: center; bottom: 27px; }
.slide-position { left: clamp(38px, 6vw, 98px); gap: 8px; }
.position-dot { display: grid; align-items: center; width: 21px; height: 44px; padding: 0; border: 0; background: transparent; transition: width .25s; }
.position-dot::after { content: ""; height: 2px; background: #fffafa70; }
.position-dot.is-active { width: 41px; }
.position-dot.is-active::after, .position-dot:hover::after { background: #fffcf1; }
.slide-actions {
  right: 27px;
  gap: 2px;
  padding: 4px;
  border: 1px solid #fff8df50;
  border-radius: 99px;
  background: #15241ba1;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}
.round { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: transparent; transition: background .2s; }
.slide-actions .round { color: #fffdf5; border-color: transparent; }
.slide-actions .round:hover { background: #fffdf534; }

.collection { padding-block: 53px 76px; scroll-margin-top: 25px; }
.collection-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.collection-eyebrow { color: #576653; }
.collection-heading h2 { margin: 11px 0 0; font-family: var(--serif); font-size: clamp(2.15rem, 3.55vw, 3.4rem); letter-spacing: .035em; font-weight: 400; line-height: 1.15; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 2px; }
.filter { border: 1px solid #d5d9cb; border-radius: 100px; min-height: 44px; background: var(--glass); padding: 7px 16px; white-space: nowrap; color: #4e564d; font-size: .875rem; }
.filter:hover { background: #eceee5; }
.filter.is-active { color: #fffdf5; border-color: var(--pine); background: var(--pine); }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 22px; }
.template-card {
  position: relative;
  min-width: 0;
  border: 1px solid #d4d9cb;
  border-radius: var(--card-radius);
  background: var(--glass);
  box-shadow: var(--shadow);
}
.card-media { position: relative; border-radius: calc(var(--card-radius) - 1px); background: #e7e7d9; }
.card-open { position: relative; display: block; width: 100%; aspect-ratio: 1.04; padding: 0; border: 0; border-radius: inherit; overflow: hidden; background: transparent; color: #fff; }
.card-open::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #14221938, transparent 34%); pointer-events: none; }
.card-open img { width: 100%; height: 100%; object-fit: cover; object-position: center top; transition: transform .45s ease; }
.card-open:hover img, .card-open:focus-visible img { transform: scale(1.035); }
.card-preview { position: absolute; z-index: 1; left: 50%; bottom: max(136px, 40%); transform: translate(-50%, 5px); display: flex; align-items: center; gap: 8px; min-width: max-content; padding: 8px 13px; border: 1px solid #fffdf54d; border-radius: 99px; background: #1c3026c9; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: .875rem; opacity: 0; transition: opacity .2s, transform .2s; }
.card-open:hover .card-preview, .card-open:focus-visible .card-preview { opacity: 1; transform: translate(-50%, 0); }
.card-preview .icon { width: 16px; height: 16px; }
.card-favorite { position: absolute; top: 13px; right: 13px; background: #fffbefdb; border-color: var(--glass-edge); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--pine); }
.card-favorite:hover { background: white; }
.card-favorite[aria-pressed="true"] .icon, .preview-favorite[aria-pressed="true"] .icon { fill: currentColor; }
.template-code { color: #4d5e50; font: 600 .8125rem/1.3 var(--sans); letter-spacing: .11em; font-variant-numeric: tabular-nums; }
.card-code { position: absolute; top: 14px; left: 14px; padding: 8px 11px; border: 1px solid var(--glass-edge); border-radius: 99px; color: #253f31; background: #fffbefdb; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; }
.selected-tag { position: absolute; top: 53px; left: 14px; display: flex; align-items: center; gap: 5px; padding: 7px 9px; border-radius: 99px; color: white; background: var(--pine); font-size: .8125rem; pointer-events: none; }
.selected-tag .icon { width: 15px; height: 15px; }
.card-copy {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  display: grid;
  gap: 15px;
  padding: 26px 17px 16px;
  border-radius: 0 0 calc(var(--card-radius) - 1px) calc(var(--card-radius) - 1px);
  background: linear-gradient(180deg, transparent, #101c15aa 24%, #101c15d1 100%);
  color: #fffdf4;
  pointer-events: none;
}
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 9px; }
.card-copy h3 { margin: 0; font: 400 1.4rem/1.2 var(--serif); letter-spacing: .035em; text-shadow: 0 1px 4px #101810b3; }
.card-subtitle { margin: 6px 0 0; font: italic .9rem/1.25 Georgia, serif; color: #f2efe2; }
.card-style { flex-shrink: 0; margin-top: 2px; padding: 5px 9px; border: 1px solid #fff8e959; border-radius: 99px; color: #fffdf4; background: #24382db3; font-size: .8125rem; }
.cart-add .icon { width: 18px; height: 18px; }
.card-add { width: 100%; min-height: 44px; padding-block: 8px; color: #fffdf4; border-color: #fff8e98f; background: #1f2e2459; pointer-events: auto; }
.card-add:hover { background: #22382bb3; }
.cart-add.is-added { border-color: #d7e7d691; background: #46624d9e; color: #fffdf4; }
.cart-add.is-added:hover { background: #46624dca; }
.empty { display: grid; place-items: center; padding: 60px 20px; border: 1px solid var(--line); border-radius: var(--card-radius); color: var(--pine); background: var(--glass); }
.empty > .icon { width: 26px; height: 26px; }
.empty p { margin: 15px 0 24px; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; min-height: 86px; }
.brand-small { font-size: 1.25rem; }
.brand-small img { width: 32px; }
.footer-inner p { color: var(--muted); font-size: .875rem; }

dialog { width: min(860px, calc(100% - 42px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--glass-edge); border-radius: 25px; background: #f9f7efed; color: var(--ink); box-shadow: 0 26px 100px #10191140; }
dialog::backdrop { background: #111e18a3; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
body:has(dialog[open]) { overflow: hidden; }
.preview-layout { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; align-items: stretch; }
.preview-close, .cart-close { color: var(--pine); background: var(--glass); border-color: #cdd5c8; }
.preview-close { position: absolute; z-index: 1; top: 13px; right: 13px; }
.preview-close:hover, .preview-favorite:hover, .cart-close:hover { background: #e9eee5; }
.preview-image-wrap { background: #e7e7d9; display: grid; align-items: center; }
.preview-image-wrap img { max-height: 72dvh; object-fit: contain; }
.preview-copy { align-self: center; padding: 66px 28px 49px; }
.preview-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; color: #50624f; font-size: .875rem; }
.preview-meta .template-code { padding-right: 10px; border-right: 1px solid #b4bdae; }
.preview-copy h2 { margin: 14px 0; font: 400 clamp(1.9rem, 4vw, 3.1rem)/1.1 var(--serif); }
#preview-description { color: var(--muted); line-height: 1.75; margin: 0 0 23px; }
.preview-actions { display: flex; gap: 10px; align-items: center; }
.preview-favorite { color: var(--pine); border-color: #c7cec3; }
.preview-secondary { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 8px; }
.text-button, .download-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--pine); font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; }
.text-button[aria-disabled="true"] { color: var(--muted); cursor: default; text-decoration: none; }

#cart {
  inset: 0 0 0 auto;
  width: min(455px, calc(100% - 24px));
  height: 100%;
  max-height: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
  border-radius: 25px 0 0 25px;
}
.cart-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) 24px;
  background: linear-gradient(145deg, #fffdf3ab, #e7ebe1a6);
}
.cart-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid #d1d9cb; }
.cart-heading h2 { margin: 0 0 8px; font: 400 2rem/1.2 var(--serif); }
.cart-heading p { margin: 0; color: var(--muted); font-size: .875rem; }
.cart-list { flex: 1; min-height: 0; margin: 0; padding: 3px; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
.cart-item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 13px 2px; border-bottom: 1px solid #d4dbd0; }
.cart-item img { width: 76px; height: 67px; object-fit: cover; border-radius: 10px; }
.cart-item p { margin: 0 0 6px; }
.cart-item h3 { margin: 0; font: 400 1.2rem/1.3 var(--serif); }
.cart-remove { min-width: 44px; justify-content: center; }
.cart-empty { flex: 1; display: grid; align-content: center; justify-items: center; padding: 20px; color: var(--muted); text-align: center; }
.cart-empty .icon { width: 30px; height: 30px; color: var(--pine); }
.cart-footer { padding-top: 17px; }
.cart-footer .button { width: 100%; }
.toast { position: fixed; z-index: 5; bottom: 25px; left: 50%; margin: 0; width: max-content; max-width: calc(100% - 32px); padding: 10px 17px; transform: translate(-50%, 10px); background: #233a30ed; border: 1px solid #ffffff30; color: white; border-radius: 99px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: .875rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 940px) {
  .frame, .header-inner { width: calc(100% - 60px); }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-heading { align-items: start; flex-direction: column; gap: 17px; }
  .collection { padding-block: 48px 58px; }
}

@media (max-width: 760px) {
  .header-inner { grid-template-columns: auto minmax(0, 1fr); padding-top: max(12px, env(safe-area-inset-top)); }
  .nav { grid-row: 2; grid-column: 1 / -1; margin-block: 3px 8px; justify-content: start; gap: clamp(18px, 7vw, 36px); }
}

@media (max-width: 600px) {
  .frame, .header-inner { width: calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))); }
  .header-inner { min-height: 0; padding-top: max(7px, env(safe-area-inset-top)); }
  .nav { margin-block: 0 4px; }
  .brand { font-size: 1.43rem; }
  .brand img { width: 32px; height: 32px; }
  .header-actions { gap: 6px; }
  .selection-button { width: 38px; min-height: 38px; padding: 0; }
  .selection-button span { display: none; }
  .cart-toggle { min-height: 38px; padding: 5px 8px; gap: 4px; }
  .selection-button .icon, .cart-toggle .icon { width: 15px; height: 15px; }
  #cart-count { min-width: 1.15rem; min-height: 1.15rem; font-size: .6875rem; }
  .hero { height: clamp(176px, 29vh, 254px); height: clamp(176px, 29svh, 254px); }
  .slide img { object-position: 68% 30%; }
  .slide.coast img { object-position: 70% 36%; }
  .slide.studio img { object-position: 68% 28%; }
  .slide::after {
    background:
      linear-gradient(90deg, #0b160fd6, #0e1a13a6 26%, #0f1b1453 47%, #0d16101a 64%, transparent 79%),
      linear-gradient(0deg, #101a134a, transparent 37%);
  }
  .slide-copy { margin: 0 0 1px 13px; max-width: 47%; }
  .slide .eyebrow, .slide-description, .collection-eyebrow { display: none; }
  .slide h1, .slide h2 {
    margin: 0 0 8px;
    font-size: clamp(1.32rem, 5.7vw, 1.95rem);
    line-height: 1.08;
  }
  .slide-copy .button { min-height: 34px; padding: 5px 7px; font-size: .8125rem; letter-spacing: 0; }
  .slide-position { top: 6px; bottom: auto; left: 13px; gap: 4px; }
  .position-dot { width: 17px; height: 25px; }
  .position-dot.is-active { width: 26px; }
  .slide-actions { right: auto; left: 8px; bottom: 5px; gap: 0; padding: 0 1px; }
  .slide-actions .round { width: 34px; height: 34px; }
  .slide-actions .icon { width: 15px; height: 15px; }
  .collection { padding-block: 16px 42px; }
  .collection-heading { gap: 5px; margin-bottom: 8px; }
  .collection-heading h2 { margin: 0; font-size: clamp(1.65rem, 6.2vw, 2.1rem); }
  .filters { gap: 4px; padding-bottom: 0; }
  .filter { min-height: 38px; padding-inline: 8px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .template-card { --card-radius: 15px; }
  .card-open {
    aspect-ratio: .94;
    min-height: 150px;
    max-height: 220px;
  }
  .card-preview { display: none; }
  .card-copy { gap: 5px; padding: 18px 8px 8px; }
  .card-copy h3 { font-size: clamp(1.05rem, 4.5vw, 1.3rem); }
  .card-subtitle, .card-style { display: none; }
  .card-code { top: 6px; left: 6px; padding: 3px 5px; font-size: .75rem; letter-spacing: .055em; }
  .card-favorite { top: 5px; right: 5px; width: 32px; height: 32px; }
  .card-favorite .icon { width: 14px; height: 14px; }
  .selected-tag { top: 32px; left: 6px; gap: 3px; padding: 4px 5px; font-size: .75rem; }
  .selected-tag .icon { width: 12px; height: 12px; }
  .card-add {
    min-height: 36px;
    gap: 4px;
    padding: 4px;
    font-size: .8125rem;
    letter-spacing: 0;
  }
  .card-add .icon { width: 13px; height: 13px; }
  dialog { width: calc(100% - 30px); max-height: calc(100dvh - 30px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .preview-layout { grid-template-columns: 1fr; }
  .preview-close { position: static; justify-self: end; margin: 4px 9px 4px 0; }
  .preview-close, .preview-favorite, .cart-close { width: 36px; height: 36px; }
  .preview-close .icon, .preview-favorite .icon, .cart-close .icon { width: 16px; height: 16px; }
  .preview-image-wrap img { max-height: 41dvh; }
  .preview-copy { padding: 16px 18px 21px; }
  .preview-actions .button, .cart-footer .button { min-height: 40px; padding-block: 7px; }
  #cart { inset: auto 0 0; width: 100%; height: min(80vh, 645px); height: min(80dvh, 645px); border-radius: 26px 26px 0 0; }
  .cart-panel { padding: 20px max(17px, env(safe-area-inset-right)) max(17px, env(safe-area-inset-bottom)) max(17px, env(safe-area-inset-left)); }
  .toast { bottom: max(25px, calc(12px + env(safe-area-inset-bottom))); }
}

@media (hover: none) {
  .card-preview { transform: translate(-50%, 0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
