:root {
  --cream: #f7f0e5;
  --cream-deep: #efe3d2;
  --surface: #fffaf3;
  --surface-strong: #fffdf9;
  --plum: #51152f;
  --plum-deep: #380c20;
  --wine: #76162f;
  --ink: #321d25;
  --muted: #79666a;
  --gold: #c69a55;
  --gold-soft: #e4cfaa;
  --line: rgba(117, 72, 68, 0.16);
  --shadow: 0 18px 48px rgba(73, 35, 43, 0.09);
  --sidebar-width: clamp(248px, 22vw, 326px);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.catalog-app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  min-height: 100vh;
  background: var(--cream);
}

.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  height: 100dvh;
  padding: clamp(24px, 3vh, 38px) clamp(18px, 2vw, 30px) clamp(20px, 3vh, 34px);
  overflow: hidden;
  background: rgba(255, 251, 245, 0.95);
  border-right: 1px solid var(--gold-soft);
  box-shadow: 10px 0 32px rgba(74, 35, 40, 0.045);
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-logo {
  display: block;
  width: clamp(126px, 13vw, 178px);
  height: clamp(116px, 12vw, 160px);
  object-fit: contain;
  mix-blend-mode: multiply;
}

.brand-name {
  margin: 13px 0 15px;
  color: var(--plum-deep);
  font-family: var(--serif);
  font-size: clamp(19px, 1.65vw, 25px);
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-align: center;
}

.brand-divider {
  display: block;
  width: 72%;
  height: 1px;
  margin-bottom: clamp(22px, 3.4vh, 38px);
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.category-nav {
  display: grid;
  gap: clamp(10px, 1.5vh, 16px);
}

.category-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: clamp(68px, 9vh, 88px);
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 1.7vw, 24px);
  color: var(--plum);
  background: rgba(255, 253, 249, 0.78);
  border: 1px solid rgba(198, 154, 85, 0.42);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.category-button::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-left: 12px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.62;
}

.category-button span {
  font-family: var(--serif);
  font-size: clamp(19px, 1.65vw, 25px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
}

.category-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(74, 25, 45, 0.08);
}

.category-button[aria-current="true"] {
  color: #fff8f1;
  background: var(--plum);
  border-color: var(--plum);
  box-shadow: 0 15px 30px rgba(80, 21, 47, 0.2);
}

.category-button:focus-visible,
.cake-card:focus-visible,
.close-button:focus-visible,
.detail-image-button:focus-visible,
.zoom-close:focus-visible {
  outline: 3px solid rgba(198, 154, 85, 0.85);
  outline-offset: 3px;
}

.sidebar-note {
  margin: auto 0 0;
  padding-top: 20px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.08em;
  line-height: 1.8;
  text-align: center;
}

.content {
  min-width: 0;
  height: 100dvh;
  padding: 0 clamp(24px, 4vw, 64px) clamp(48px, 6vw, 82px);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: var(--plum) rgba(198, 154, 85, 0.12);
  scrollbar-width: thin;
}

.content::-webkit-scrollbar {
  width: 9px;
}

.content::-webkit-scrollbar-track {
  background: rgba(198, 154, 85, 0.1);
}

.content::-webkit-scrollbar-thumb {
  background: var(--plum);
  border: 2px solid var(--cream);
  border-radius: 999px;
}

.page-header {
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(34px, 5.2vh, 66px) 0 clamp(26px, 4vh, 50px);
  text-align: center;
}

.page-header h1 {
  margin: 0;
  color: var(--plum-deep);
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 56px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.22;
}

.page-header p {
  margin: 13px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(17px, 1.7vw, 24px);
  letter-spacing: 0.14em;
  line-height: 1.65;
}

.heading-rule {
  display: flex;
  width: min(520px, 74%);
  align-items: center;
  gap: 14px;
  margin: 20px auto 0;
  color: var(--gold);
}

.heading-rule::before,
.heading-rule::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.heading-rule::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.heading-rule span {
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.gallery-section {
  max-width: 1500px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gold-soft);
}

.section-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.22em;
}

.section-heading h2 {
  margin: 0;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(29px, 3vw, 46px);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.section-description {
  max-width: 440px;
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(15px, 1.3vw, 19px);
  letter-spacing: 0.07em;
  line-height: 1.8;
  text-align: right;
}

.cake-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.1vw, 30px);
}

.cake-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 8px 8px 18px;
  color: inherit;
  background: rgba(255, 251, 245, 0.72);
  border: 1px solid rgba(198, 154, 85, 0.35);
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 8px 24px rgba(73, 35, 43, 0.045);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  animation: cardIn 440ms both;
}

.cake-card:hover {
  transform: translateY(-5px);
  border-color: rgba(198, 154, 85, 0.74);
  box-shadow: var(--shadow);
}

.cake-image-wrap {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 3 / 4;
  place-items: center;
  overflow: hidden;
  background: #f2eadd;
  border-radius: 12px;
}

.cake-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 400ms ease;
}

.cake-card:hover .cake-image-wrap img {
  transform: scale(1.012);
}

.cake-card-copy {
  padding: 17px 14px 0;
  text-align: center;
}

.cake-card h3 {
  margin: 0;
  color: var(--plum-deep);
  font-family: var(--serif);
  font-size: clamp(19px, 1.65vw, 25px);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

.cake-card p {
  display: -webkit-box;
  min-height: 3.1em;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(14px, 1.05vw, 17px);
  letter-spacing: 0.035em;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.modal-backdrop,
.zoom-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  padding: clamp(20px, 3vw, 48px);
  place-items: center;
  visibility: hidden;
  background: rgba(39, 21, 28, 0.58);
  opacity: 0;
  backdrop-filter: blur(7px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.modal-backdrop.is-open,
.zoom-backdrop.is-open {
  visibility: visible;
  opacity: 1;
}

.detail-modal {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  width: min(1100px, 92vw);
  max-height: min(850px, 90dvh);
  overflow: auto;
  background: var(--surface-strong);
  border: 1px solid var(--gold-soft);
  border-radius: 22px;
  box-shadow: 0 32px 90px rgba(40, 16, 29, 0.32);
  transform: translateY(16px) scale(0.985);
  transition: transform 210ms ease;
}

.modal-backdrop.is-open .detail-modal {
  transform: translateY(0) scale(1);
}

.detail-media {
  display: flex;
  min-height: min(76dvh, 760px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 2.4vw, 32px);
  background: #f4ebde;
  border-radius: 21px 0 0 21px;
}

.detail-image-button {
  display: grid;
  width: 100%;
  min-height: 0;
  flex: 1;
  padding: 0;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: zoom-in;
}

.detail-image-button img {
  display: block;
  width: 100%;
  height: min(66dvh, 675px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 38px rgba(65, 35, 35, 0.13);
}

.image-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.12em;
}

.detail-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(30px, 4vw, 58px);
}

.detail-category {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.2em;
}

.detail-copy h2 {
  margin: 0;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
}

.detail-price {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.detail-section {
  margin-top: clamp(28px, 4vh, 46px);
  padding-top: 24px;
  border-top: 1px solid var(--gold-soft);
}

.detail-section h3 {
  margin: 0 0 13px;
  color: var(--plum-deep);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.14em;
}

.detail-section p {
  margin: 0;
  color: #554348;
  font-family: var(--serif);
  font-size: clamp(17px, 1.4vw, 20px);
  letter-spacing: 0.04em;
  line-height: 1.85;
}

.recommendation p {
  color: var(--plum);
}

.close-button {
  width: 100%;
  min-height: 58px;
  margin-top: auto;
  padding: 14px 24px;
  color: #fff8f2;
  background: var(--plum);
  border: 1px solid var(--plum);
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.18em;
  transition: background 160ms ease, transform 160ms ease;
}

.close-button:hover {
  background: var(--wine);
  transform: translateY(-1px);
}

.zoom-backdrop {
  z-index: 50;
  background: rgba(24, 12, 18, 0.88);
  cursor: zoom-out;
}

.zoom-backdrop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.4));
}

.zoom-close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
  min-width: 112px;
  min-height: 48px;
  padding: 10px 18px;
  color: #fff;
  background: rgba(77, 19, 45, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  letter-spacing: 0.08em;
}

body.modal-open {
  touch-action: none;
}

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

@media (max-width: 1180px) {
  .cake-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-description {
    max-width: 340px;
  }
}

@media (max-width: 920px) {
  :root {
    --sidebar-width: 226px;
  }

  .sidebar {
    padding-inline: 14px;
  }

  .category-button {
    padding-inline: 16px;
  }

  .category-button span {
    font-size: 18px;
  }

  .detail-modal {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .detail-copy {
    padding: 30px 26px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .catalog-app {
    display: block;
    height: auto;
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: block;
    width: 100%;
    height: auto;
    padding: 10px 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--gold-soft);
  }

  .brand-block {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 10px;
    justify-items: start;
  }

  .brand-logo {
    width: 56px;
    height: 52px;
    grid-row: 1;
  }

  .brand-name {
    align-self: center;
    margin: 0;
    font-size: 18px;
    text-align: left;
  }

  .brand-divider,
  .sidebar-note {
    display: none;
  }

  .category-nav {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .category-nav::-webkit-scrollbar {
    display: none;
  }

  .category-button {
    width: auto;
    min-width: max-content;
    min-height: 48px;
    padding: 10px 16px;
    border-radius: 12px;
  }

  .category-button::after {
    display: none;
  }

  .category-button span {
    font-size: 16px;
  }

  .content {
    height: auto;
    padding: 0 14px 52px;
    overflow: visible;
  }

  .page-header {
    padding: 28px 0 24px;
  }

  .page-header h1 {
    font-size: 28px;
    letter-spacing: 0.06em;
  }

  .page-header p {
    font-size: 15px;
    letter-spacing: 0.06em;
  }

  .section-heading {
    display: block;
  }

  .section-description {
    margin-top: 12px;
    text-align: left;
  }

  .cake-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .cake-card {
    padding: 6px 6px 14px;
    border-radius: 14px;
  }

  .cake-card-copy {
    padding: 13px 6px 0;
  }

  .cake-card h3 {
    font-size: 17px;
  }

  .cake-card p {
    font-size: 13px;
  }

  .detail-modal {
    display: block;
    width: min(94vw, 640px);
    max-height: 92dvh;
  }

  .detail-media {
    min-height: 48dvh;
    border-radius: 21px 21px 0 0;
  }

  .detail-image-button img {
    height: 43dvh;
  }

  .detail-copy {
    gap: 0;
  }

  .close-button {
    margin-top: 30px;
  }
}

@media (max-width: 460px) {
  .cake-grid {
    grid-template-columns: 1fr;
  }
}

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

.offline-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid rgba(117, 84, 58, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  color: #6d5949;
  font-size: 13px;
}

.offline-panel div,
.offline-panel span {
  display: block;
}

.offline-panel strong {
  color: #4f3c30;
  font-size: 14px;
}

.offline-panel button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid rgba(117, 84, 58, 0.28);
  border-radius: 10px;
  background: #fffaf3;
  color: #604737;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 540px) {
  .offline-panel {
    align-items: flex-start;
  }
}
