:root {
  --bg: #f3f0e8;
  --paper: #e9e2d5;
  --ink: #292720;
  --muted: #797266;
  --line: rgba(41, 39, 32, .2);
  --accent: #75523b;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% 42%, rgba(117, 82, 59, .055), transparent 30%),
    var(--bg);
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 300;
  line-height: 1.8;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .16;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

.site-header,
footer {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  height: 88px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: "Noto Serif TC", serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .14em;
}

.back-link {
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .12em;
  transition: color .25s ease;
}

.back-link:hover { color: var(--ink); }

.edition,
.eyebrow,
.card-footer,
.hint,
footer {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .17em;
}

.generator {
  width: min(calc(100% - 48px), var(--max));
  min-height: calc(100vh - 176px);
  margin: 0 auto;
  padding: clamp(54px, 7vw, 92px) 0 clamp(72px, 9vw, 120px);
}

.intro { margin: 0 auto 46px; text-align: center; }

.eyebrow { margin: 0 0 30px; font-weight: 500; }

h1 {
  margin: 0 0 24px;
  font-family: "Noto Serif TC", serif;
  font-size: clamp(2.8rem, 6vw, 5.3rem);
  font-weight: 500;
  letter-spacing: -.05em;
  line-height: 1.22;
}

.description {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: .04em;
}

.quote-stage { width: min(100%, 430px); margin: 0 auto; }

.quote-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid rgba(117, 82, 59, .18);
  background: #5d554a;
  box-shadow: 0 28px 70px rgba(54, 45, 34, .08);
}

.quote-copy::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -130px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
}

.quote-visual {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  background: #d8d0c2;
}

.quote-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(24, 22, 18, .76) 0%, rgba(24, 22, 18, .58) 52%, rgba(24, 22, 18, .12) 100%),
    linear-gradient(0deg, rgba(24, 22, 18, .4) 0%, transparent 48%);
}

.quote-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: opacity .35s ease, transform .8s ease;
}

.quote-card:hover .quote-visual img { transform: scale(1.018); }

.quote-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 100%;
  padding: 76px clamp(26px, 6vw, 40px) 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #f7f3ea;
}

.card-mark {
  position: absolute;
  top: 18px;
  left: 28px;
  color: rgba(255, 255, 255, .34);
  font-family: Georgia, serif;
  font-size: 5.5rem;
  line-height: 1;
}

.quote {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Noto Serif TC", serif;
  max-width: 520px;
  font-size: clamp(.78rem, 3.6vw, 1.375rem);
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.75;
}

.quote span {
  display: block;
  white-space: nowrap;
}

.quote.is-long {
  font-size: clamp(.78rem, 3.6vw, 1.25rem);
}

.quote.is-changing { animation: reveal .48s ease both; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-footer {
  position: absolute;
  z-index: 1;
  right: clamp(26px, 6vw, 40px);
  bottom: 34px;
  left: clamp(26px, 6vw, 40px);
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, .68);
}

.generate-button {
  width: 100%;
  margin-top: 18px;
  padding: 17px 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--bg);
  border: 1px solid var(--ink);
  background: var(--ink);
  font: 400 .88rem/1.2 "Noto Sans TC", sans-serif;
  letter-spacing: .12em;
  cursor: pointer;
  transition: color .25s ease, background .25s ease;
}

.generate-button:hover { color: var(--ink); background: transparent; }
.generate-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.button-icon { font-size: 1.1rem; transition: transform .4s ease; }
.generate-button:hover .button-icon { transform: rotate(120deg); }
.hint { margin: 12px 0 0; text-align: center; letter-spacing: .08em; }

footer {
  min-height: 88px;
  border-top: 1px solid var(--line);
  letter-spacing: .08em;
}

@media (max-width: 760px) {
  .site-header, footer, .generator { width: min(calc(100% - 32px), var(--max)); }
  .site-header { height: 72px; }
  .edition { display: none; }
  .generator { min-height: auto; padding: 48px 0 72px; }
  .intro { padding-top: 0; }
  h1 { margin-bottom: 26px; }
  .intro { margin-bottom: 36px; }
  .quote-copy { padding: 68px 28px 72px; }
  .quote-visual::after {
    background:
      linear-gradient(90deg, rgba(24, 22, 18, .7), rgba(24, 22, 18, .3)),
      linear-gradient(0deg, rgba(24, 22, 18, .52), transparent 65%);
  }
  .card-footer { right: 28px; left: 28px; }
  footer { padding: 24px 0; align-items: flex-start; flex-direction: column; gap: 5px; }
}

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