﻿/*
 * [INPUT]: 使用首页的网格区域、回访欢迎卡片与门位状态。礼物包装由 gift-art.css 绘制。
 * [OUTPUT]: 定义首页分栏、礼物托盘、回访日历卡片、底部预览提示与内容版式。
 * [POS]: 首页专属样式。所有选择器限定在首页类名内。
 * [PROTOCOL]: 变更时更新此头部，然后检查 AGENTS.md
 */

.af-home {
  --af-paper: #fff9f1;
  --af-ink: #30234b;
  --af-muted: #5d5369;
  --af-red: #af254a;
  --af-green: #18675c;
  --af-title: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: var(--af-paper);
  color: var(--af-ink);
  line-height: 1.68;
}
.af-home :is(h1, h2, h3, p, figure, fieldset) { margin: 0; }
.af-home :is(a, button, input, textarea):focus-visible { outline: 3px solid #176b60; outline-offset: 4px; }
.af-home a { color: var(--af-red); }
.af-width { width: min(100% - 2rem, 47rem); margin-inline: auto; }

.af-hero {
  display: grid;
  grid-template-areas: "title" "stage" "intro";
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  max-width: 88rem;
  margin-inline: auto;
  padding: clamp(1.3rem, 4vw, 3.5rem) clamp(.75rem, 3.8vw, 3.4rem) clamp(2.8rem, 7vw, 5.6rem);
  background: radial-gradient(ellipse at 20% 6%, #ffe5ed 0, #fff1e5 40%, transparent 78%);
}
.af-title-block {
  grid-area: title;
  align-self: end;
  justify-self: center;
  text-align: center;
}
.af-home .af-kicker {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .28rem .8rem;
  border-radius: 100vw;
  background: #f9dfeb;
  color: #772652;
  font-size: .82rem;
  font-weight: 750;
}
.af-home h1 {
  margin-block: .55rem .65rem;
  color: #482468;
  font: 900 clamp(2.5rem, 9.5vw, 5.65rem)/.95 var(--af-title);
  letter-spacing: -.075em;
}
.af-home h1 em { color: #b82552; font-style: normal; white-space: nowrap; }
.af-home .af-lead {
  max-width: 31rem;
  margin-inline: auto;
  color: var(--af-muted);
  font-size: clamp(.98rem, 1.55vw, 1.18rem);
  line-height: 1.48;
  text-wrap: balance;
}

.af-hero-stage {
  grid-area: stage;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: min(100%, 43rem);
  margin-inline: auto;
  padding: clamp(.56rem, 2.15vw, 1.75rem);
  overflow: clip;
  border-radius: clamp(1.4rem, 3.4vw, 2.75rem);
  background: linear-gradient(140deg, #ffd2bb, #f8a793 60%, #e9a8be);
  box-shadow: 0 .8rem 2.5rem #a4524a22, inset 0 1px 0 #fff8;
}
.af-hero-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 66% 58%;
  opacity: .36;
}
.af-preview { width: 100%; }
.af-board {
  --af-tray: #fff3e6;
  --af-tray-rim: #d992805c;
  padding: clamp(.57rem, 1.85vw, 1.45rem);
  border-radius: clamp(1rem, 2.45vw, 1.95rem);
  background:
    radial-gradient(circle, #53294313 .55px, transparent .8px) 0 0 / 5px 5px,
    linear-gradient(130deg, #fff8f1bf, transparent 68%),
    var(--af-tray);
  color: #542d65;
  box-shadow: inset 0 2px 0 #fffc, 0 .34rem 0 var(--af-tray-rim), 0 .65rem 1.3rem #792f4224;
}
.af-board-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.65rem, 2vw, 1.25rem);
  margin-bottom: clamp(.55rem, 1.45vw, 1.15rem);
  text-align: center;
}
.af-board-heading > span[aria-hidden] { color: #a35b24; }
.af-board-heading > span:nth-child(2) {
  font: 900 clamp(1.65rem, 3.2vw, 2.65rem)/.94 var(--af-title);
  letter-spacing: -.06em;
}
.af-board-heading small {
  display: block;
  margin-top: .32rem;
  font: 800 clamp(.51rem, .9vw, .63rem)/1.25 system-ui, sans-serif;
  letter-spacing: .2em;
}
.af-doors {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(.12rem, .95vw, .85rem);
}
.af-door {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: .04rem;
  width: 100%;
  min-width: 0;
  min-height: 3.1rem;
  aspect-ratio: .97;
  padding: .12rem .1rem .2rem;
  border: 0;
  border-radius: clamp(.56rem, 1.2vw, .95rem);
  background: transparent;
  color: #51364e;
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.af-door[data-state="ready"] {
  z-index: 1;
  background: radial-gradient(ellipse at center, #fff4bc, #ffe4a1b8 74%);
  box-shadow: 0 0 0 1px #bc7a31, 0 .18rem .58rem #ba752f52;
}
@media (hover: hover) and (pointer: fine) {
  .af-door:hover { z-index: 2; background-color: #fffdf1; transform: translateY(-2px); }
}
.af-door-number {
  min-width: 1.32rem;
  padding: .12rem .22rem;
  border-radius: .28rem;
  background: #fffaf4;
  box-shadow: 0 1px 2px #56374630;
  font: 800 clamp(.68rem, 1vw, .89rem)/1.1 var(--af-title);
  font-variant-numeric: tabular-nums;
}
.af-door[data-state="ready"] .af-door-number { background: #723a4e; color: white; }
.af-hero:has([name="theme"][value="pine"]:checked) .af-board {
  --af-tray: #dff0e1;
  --af-tray-rim: #6b9d876f;
  color: #27574d;
}
.af-hero:has([name="theme"][value="snow"]:checked) .af-board {
  --af-tray: #deebfb;
  --af-tray-rim: #819cc16f;
  color: #354377;
}
.af-preview figcaption {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .12rem .32rem;
  margin-top: clamp(.45rem, 1.45vw, 1rem);
  color: #4d2b46;
  font-size: clamp(.67rem, 1vw, .85rem);
  font-weight: 750;
}
.af-preview figcaption > span {
  padding: .22rem .45rem;
  border-radius: 100vw;
  background: #fff8efed;
}
.af-preview a, .af-hero-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .38rem .74rem;
  border-radius: 100vw;
  background: #eee0ff;
  color: #57317b;
  font-weight: 750;
  text-decoration: none;
  transition: transform .16s ease, background .16s ease;
}
.af-preview a:hover, .af-hero-links a:hover { background: #e0caff; transform: translateY(-2px); }

.af-intro {
  grid-area: intro;
  align-self: start;
  width: min(100%, 34rem);
  margin-inline: auto;
  padding: clamp(.85rem, 2.35vw, 1.55rem);
  border-radius: 1.6rem;
  background: #fffefd;
  box-shadow: 0 .65rem 2rem #a6553a20, inset 0 0 0 1px #f2d9cf;
}
.af-create { display: grid; gap: .78rem; }
.af-label { display: block; margin: 0 0 .32rem; color: var(--af-ink); font-size: .88rem; font-weight: 800; }
.af-input { appearance: none; display: block; width: 100%; min-height: 2.9rem; padding: .65rem .9rem; border: 0; border-radius: 1.15rem; background: #f4ebfa; color: var(--af-ink); font: inherit; }
.af-input::placeholder { color: #776688; opacity: 1; }
textarea.af-input { resize: vertical; }
.af-themes { min-width: 0; padding: 0; border: 0; }
.af-hero-links { display: flex; flex-wrap: wrap; gap: .46rem; }
.af-theme-list {
  --af-gift-mini-size: 2.2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .48rem;
}
.af-theme { position: relative; cursor: pointer; }
.af-theme input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.af-theme > span {
  --af-gift-mini-size: 2.5rem;
  display: grid;
  grid-template-rows: 2.28rem auto;
  place-items: center;
  gap: .16rem;
  padding: .43rem .15rem .4rem;
  border-radius: .77rem;
  background: #fae3ed;
  color: #563254;
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.15;
}
.af-theme:nth-child(2) > span { background: #dcf4e7; color: #205548; }
.af-theme:nth-child(3) > span { background: #dceefd; color: #2e5375; }
.af-theme input:checked + span { box-shadow: inset 0 0 0 2px currentColor; }
.af-theme input:focus-visible + span { outline: 3px solid #176b60; outline-offset: 3px; }
.af-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 3.25rem; padding: .62rem 1.25rem; border: 0; border-radius: 100vw; background: #bd2e58; color: white; box-shadow: 0 .27rem 0 #8d234a; font: 800 1rem/1.2 var(--af-title); transition: transform .16s ease, background .16s ease; }
.af-home a.af-button { color: white; text-decoration: none; }
.af-button:hover { background: #a82758; transform: translateY(-2px); }
.af-button:disabled { cursor: wait; }
.af-home .af-status { margin: 0; color: var(--af-red); font-size: .88rem; }
.af-home .af-status:empty { display: none; }
.af-hero-links { margin-top: .9rem; font-size: .85rem; }
.af-hero-links a:first-child { background: #ffedbf; color: #684916; }
.af-hero-links a:first-child:hover { background: #ffdfa0; }

.af-welcome-back { display: grid; gap: .75rem; min-width: 0; }
.af-home .af-back-title {
  margin: 0;
  color: #482468;
  font: 900 clamp(1.3rem, 2.6vw, 1.65rem)/1.18 var(--af-title);
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.af-back-sub { color: var(--af-muted); font-size: .95rem; line-height: 1.45; }
.af-back-list { display: grid; gap: .65rem; min-width: 0; max-height: 24rem; overflow-y: auto; padding: 1px; }
.af-back-card {
  display: grid;
  gap: .55rem;
  min-width: 0;
  padding: .85rem .95rem;
  border-radius: 1.15rem;
  background: #fff7ee;
  box-shadow: inset 0 0 0 1px #f0d7ca;
}
.af-home .af-back-card-title {
  margin: 0;
  color: var(--af-ink);
  font: 800 1.02rem/1.25 var(--af-title);
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.af-back-url {
  min-width: 0;
  padding: .52rem .72rem;
  border-radius: .85rem;
  background: #fffefd;
  box-shadow: inset 0 0 0 1px #ead8ee;
  color: var(--af-muted);
  font: 600 .84rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.af-back-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.af-back-actions .af-button { flex: 1 1 10.5rem; min-height: 2.8rem; padding: .55rem 1rem; font-size: .92rem; }
.af-back-actions .button.secondary { flex: 0 1 auto; min-height: 2.8rem; padding: .55rem .95rem; font-size: .9rem; }
.af-back-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: .15rem; font-size: .9rem; }
.af-back-return { justify-self: start; font-size: .9rem; }

.af-guide, .af-faq { padding-block: clamp(2.7rem, 6vw, 5rem); }
.af-guide { background: #f6edff; }
.af-faq { background: #edf8fa; }
.af-section-head { max-width: 42rem; }
.af-home h2 { margin-bottom: .65rem; color: #46265f; font: 900 clamp(1.9rem, 5.7vw, 3.6rem)/1.04 var(--af-title); letter-spacing: -.057em; text-wrap: balance; }
.af-home h3 { color: var(--af-ink); font: 900 clamp(1.23rem, 3vw, 1.55rem)/1.25 var(--af-title); letter-spacing: -.025em; }
.af-section-head p, .af-home :is(.af-steps, .af-story-grid, .af-questions) p { color: var(--af-muted); }
.af-steps, .af-story-grid, .af-questions { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; padding: 0; margin: 1.4rem 0 0; }
.af-steps li, .af-story-grid article, .af-questions > div { border-radius: 1.45rem; padding: clamp(1rem, 3vw, 1.6rem); background: var(--tile, #fff4e1); }
.af-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .75rem; list-style: none; --tile: #fff9ef; }
.af-steps li:nth-child(2) { --tile: #ffe6ee; }
.af-steps li:nth-child(3) { --tile: #def5e8; }
.af-section-icon { display: grid; place-items: center; width: clamp(2.35rem, 6vw, 3.2rem); aspect-ratio: 1; border-radius: 50%; background: #f4dcff; font-size: clamp(1.05rem, 3vw, 1.48rem); }
.af-story-grid article:nth-child(2) { --tile: #edf9e9; }
.af-story-grid article:nth-child(3) { --tile: #e8f2ff; }
.af-story-grid article:nth-child(4) { --tile: #fbe7f0; }
.af-story-icon, .af-heading-icon { display: inline-block; margin-inline-end: .18em; }
.af-home :is(.af-steps, .af-story-grid, .af-questions) p { margin-top: .5rem; }
.af-stories, .af-comments { padding-block: clamp(3rem, 7vw, 5.8rem); }
.af-notes { margin-bottom: clamp(3rem, 7vw, 5.8rem); padding: clamp(1.15rem, 5vw, 3rem); border-radius: 2.1rem; background: #ffe9d7; }
.af-home .af-notes p + p { margin-top: .75rem; }
.af-questions > div { background: #fffdf8; }
.af-questions > div:nth-child(3n + 2) { background: #fff0f5; }
.af-questions > div:nth-child(3n) { background: #f0e9ff; }
.af-comment-form { display: grid; gap: .85rem; margin-top: 1.35rem; padding: clamp(1rem, 4vw, 1.6rem); border-radius: 1.65rem; background: #f4efff; }
.af-comment-form .af-button { justify-self: start; }
.af-comment-list:not(:empty) { margin-top: 1.3rem; }

.af-preview-tip {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(calc(100% - 1.5rem), 26.5rem);
  max-height: 70dvh;
  overflow: auto;
  padding: .95rem 1.15rem;
  border-radius: 1.15rem;
  background: linear-gradient(#fffdf8, #fff3e5);
  color: var(--af-ink);
  box-shadow: 0 .85rem 2.4rem #2d1b3347, 0 0 0 1px #ead7c6;
  font-weight: 600;
  z-index: 20;
}

@media (min-width: 55rem) {
  .af-doors { --af-gift-size: min(91%, 5.5rem); }
  .af-hero {
    grid-template-areas: "title stage" "intro stage";
    grid-template-columns: minmax(0, .72fr) minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    align-items: center;
    gap: clamp(1.2rem, 2.6vw, 2.55rem) clamp(1.9rem, 4.3vw, 4.4rem);
  }
  .af-title-block { justify-self: start; text-align: left; }
  .af-home h1 { font-size: clamp(4rem, 6.4vw, 5.65rem); }
  .af-home h1 em { display: block; }
  .af-home .af-lead { margin-inline: 0; max-width: 26rem; text-wrap: pretty; }
  .af-intro { margin-inline: 0; }
}
@media (max-width: 25rem) {
  .af-hero-stage, .af-board { padding: .43rem; }
  .af-preview a { padding-inline: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .af-home :is(.af-door, .af-preview a, .af-hero-links a, .af-button) { transition: none; }
  .af-home :is(.af-door, .af-preview a, .af-hero-links a, .af-button):hover { transform: none; }
}
