:root {
  --ink: #191613;
  --muted-ink: #625b53;
  --paper: #fff9ef;
  --paper-deep: #f1e7d6;
  --lacquer: #241410;
  --azuki: #5a1420;
  --azuki-light: #8c2d38;
  --matcha: #607a46;
  --gold: #b98538;
  --line: rgba(25, 22, 19, 0.14);
  --shadow: 0 24px 70px rgba(36, 20, 16, 0.16);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.scroll-progress {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 249, 239, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.site-nav a,
.ghost-button {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--muted-ink);
  text-decoration: none;
}

.site-nav a:hover,
.ghost-button:hover {
  color: var(--ink);
  background: rgba(185, 133, 56, 0.12);
}

.account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#account-name {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  min-height: calc(100vh - 70px);
  padding: clamp(42px, 7vw, 92px) clamp(18px, 6vw, 86px) 64px;
  background:
    linear-gradient(120deg, rgba(255, 249, 239, 0.96), rgba(255, 249, 239, 0.7)),
    radial-gradient(circle at 12% 18%, rgba(185, 133, 56, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(96, 122, 70, 0.14), transparent 46%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 680px;
  margin: 24px 0;
  color: var(--muted-ink);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #fffaf3;
  background: var(--azuki);
  box-shadow: 0 12px 34px rgba(90, 20, 32, 0.24);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.secondary-button {
  color: var(--lacquer);
  background: rgba(255, 249, 239, 0.72);
  border-color: var(--line);
}

.hero-media {
  margin: 0;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-media figcaption {
  margin-top: 10px;
  color: var(--muted-ink);
  font-size: 0.86rem;
}

.content-band {
  padding: clamp(54px, 8vw, 108px) clamp(18px, 6vw, 86px);
}

.muted-band {
  background: var(--paper-deep);
}

.section-heading {
  max-width: 920px;
  margin-bottom: clamp(24px, 4vw, 42px);
}

.definition-grid,
.ingredient-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.definition-grid article,
.ingredient-card,
.type-panel,
.source-list article,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 249, 239, 0.82);
  box-shadow: 0 18px 44px rgba(36, 20, 16, 0.08);
}

.definition-grid article,
.ingredient-card {
  padding: 22px;
}

.definition-grid p,
.ingredient-card p,
.type-panel p,
.culture-layout p {
  margin: 0;
  color: var(--muted-ink);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.timeline-item {
  position: relative;
  min-height: 230px;
  padding: 24px;
  border-left: 4px solid var(--azuki);
  background: rgba(255, 249, 239, 0.78);
}

.timeline-item span {
  display: block;
  margin-bottom: 12px;
  color: var(--azuki);
  font-weight: 800;
}

.timeline-item p {
  margin: 0;
  color: var(--muted-ink);
}

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-ink);
  background: rgba(255, 249, 239, 0.72);
  cursor: pointer;
}

.tab-button.is-active {
  color: #fffaf3;
  background: var(--lacquer);
}

.type-panel {
  max-width: 920px;
  min-height: 176px;
  padding: 26px;
}

.culture-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 1060px;
}

.source-band {
  background: var(--lacquer);
  color: #fffaf3;
}

.source-band .eyebrow,
.source-band h2 {
  color: #fffaf3;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.source-list article {
  padding: 22px;
  color: var(--ink);
}

.source-list ul {
  margin: 0;
  padding-left: 20px;
}

.source-list a {
  color: var(--azuki);
}

.site-footer {
  padding: 24px clamp(18px, 6vw, 86px);
  color: var(--muted-ink);
  background: #fffdf8;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #fffaf3;
  background: var(--azuki);
  box-shadow: 0 16px 36px rgba(36, 20, 16, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  transform: translateY(10px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(36, 20, 16, 0.38), rgba(36, 20, 16, 0.48)),
    url("/assets/yokan-hero.png") center / cover no-repeat;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 460px);
  padding: clamp(24px, 5vw, 40px);
  background: rgba(255, 249, 239, 0.94);
  backdrop-filter: blur(18px);
}

.login-panel h1 {
  font-size: clamp(2.35rem, 7vw, 3.35rem);
  line-height: 1.05;
}

.login-copy {
  margin: 16px 0 24px;
  color: var(--muted-ink);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.login-form input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(185, 133, 56, 0.42);
  outline-offset: 3px;
}

.form-message {
  min-height: 26px;
  margin: 4px 0;
  color: var(--azuki-light);
  font-weight: 700;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .site-nav {
    justify-content: start;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-media {
    order: -1;
  }

  .definition-grid,
  .ingredient-layout,
  .timeline,
  .source-list,
  .culture-layout {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .site-header {
    gap: 12px;
  }

  .site-nav a,
  .ghost-button {
    padding: 6px 9px;
  }

  .account-box {
    width: 100%;
    justify-content: space-between;
  }

  .hero-actions,
  .type-tabs {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .tab-button {
    width: 100%;
  }

  .hero-media img {
    aspect-ratio: 4 / 3;
  }
}
