@font-face {
  font-family: "Caramel Sauce";
  src: url("../fonts/CaramelSauce-Regular.woff") format("woff"),
       url("../fonts/CaramelSauce-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --text: #492a1b;
  --bg: #ffeedd;
  --accent: #e26527;
  --accent-ink: #b84c16;           /* accent darkened for small text on --bg */
  --surface: #fff7ef;
  --surface-2: #fbe2c9;
  --line: rgba(73, 42, 27, 0.14);
  --muted: rgba(73, 42, 27, 0.72);
  --shadow: 0 1px 2px rgba(73, 42, 27, 0.06), 0 8px 24px -12px rgba(73, 42, 27, 0.22);
  --radius: 18px;
  --radius-sm: 10px;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: "Caramel Sauce", "Lexend", cursive;
  --gutter: 16px;
  --max: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--accent-ink); }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--font-title); font-weight: 400; line-height: 1.1; margin: 0; letter-spacing: .01em; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; color: var(--bg); }

.icon { width: 1em; height: 1em; flex: none; }

.eyebrow {
  margin: 0 0 6px;
  font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink);
}

.main { flex: 1; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 32px; height: 32px; color: var(--accent); }
.brand__name { font-family: var(--font-title); font-size: 1.55rem; line-height: 1; padding-top: 2px; }

.site-nav__link {
  font-size: .9rem; font-weight: 500; text-decoration: none;
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
}
.site-nav__link:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Hero / Home ---------- */

.hero { padding: 32px 0 8px; }
.hero__title { font-size: clamp(2.6rem, 11vw, 4.6rem); }
.hero__lead { margin: 10px 0 22px; max-width: 34ch; font-size: 1.05rem; color: var(--muted); }

.search { position: relative; max-width: 520px; }
.search__icon { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%; height: 52px; padding: 0 18px 0 46px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
}
.search__input::placeholder { color: var(--muted); }
.search__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(226, 101, 39, .18); }

.catalog__count { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.catalog { padding-top: 18px; padding-bottom: 56px; scroll-margin-top: 80px; }
.catalog__empty { padding: 40px 0; text-align: center; color: var(--muted); }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; } }

.card__link {
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card__link:hover { transform: translateY(-3px); color: inherit; box-shadow: 0 2px 4px rgba(73,42,27,.06), 0 18px 36px -16px rgba(73,42,27,.35); }
.card__link:hover .card__title { color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { .card__link, .card__link:hover { transition: none; transform: none; } }

.card__media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card__link:hover .card__media img { transform: scale(1.04); }
.card__placeholder { display: grid; place-items: center; width: 100%; height: 100%; }
.card__placeholder-mark { width: 40%; height: auto; color: rgba(226, 101, 39, .45); }

.card__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.card__title { font-family: var(--font-title); font-size: 1.5rem; line-height: 1.05; transition: color .15s; }
.card__meta { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.card__meta .icon { color: var(--accent); }

.card[hidden] { display: none; }

/* ---------- Detail ---------- */

.detail { padding-top: 16px; padding-bottom: 56px; }

.breadcrumb ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  font-size: .82rem; color: var(--muted);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.breadcrumb li + li::before {
  content: ""; width: 6px; height: 6px; flex: none;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .6; margin-right: 2px;
}
.breadcrumb a { text-decoration: none; padding: 6px 0; }
.breadcrumb a:hover { color: var(--accent-ink); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail__title { margin: 8px 0 18px; font-size: clamp(2.6rem, 12vw, 4.8rem); overflow-wrap: anywhere; }

.detail__layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.detail__media, .detail__content { min-width: 0; }
.detail__content { display: grid; gap: 20px; align-content: start; }
@media (min-width: 960px) {
  .detail__layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
  .detail__media { position: sticky; top: 84px; }
}

/* Figure */
.figure { margin: 0; }
.figure__frame {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.figure__frame img { width: 100%; height: 100%; object-fit: cover; }
.figure__credit { margin-top: 8px; font-size: .75rem; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.figure__credit a { text-decoration-thickness: 1px; }

/* Carousel */
.carousel { position: relative; }
.carousel__track {
  list-style: none; margin: 0; padding: 0;
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: var(--radius);
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__track:focus-visible { outline-offset: 4px; }
.carousel__slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; min-width: 0; }
.carousel__controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.carousel__btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.carousel__btn svg { width: 22px; height: 22px; }
.carousel__btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.carousel__btn:disabled { opacity: .35; cursor: default; }
.carousel__dots { display: flex; gap: 4px; }
.carousel__dot {
  width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.carousel__dot::before {
  content: ""; width: 9px; height: 9px; border-radius: 999px; background: var(--text); opacity: .22;
  transition: width .2s, opacity .2s, background .2s;
}
.carousel__dot[aria-current="true"]::before { width: 22px; opacity: 1; background: var(--accent); }

/* Panels */
.panel {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
@media (min-width: 640px) { .panel { padding: 24px; } }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.panel__title { font-size: 2.1rem; }
.panel > .panel__title { margin-bottom: 14px; }

/* Sounds */
.sounds { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.sound__title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 500; }
.sound__title .icon { color: var(--accent); width: 1.15em; height: 1.15em; }
.sound__player { width: 100%; height: 48px; accent-color: var(--accent); border-radius: 999px; }

/* Language switcher */
.lang {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 999px;
}
.lang__btn {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; font-size: .85rem; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.lang__btn:hover { color: var(--accent-ink); }
.lang__btn[aria-selected="true"] { background: var(--accent); color: #fff; font-weight: 700; }

.desc__title { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.desc p { margin: 0 0 12px; font-size: 1.02rem; font-weight: 300; line-height: 1.75; }
.desc p:last-child { margin-bottom: 0; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager__link {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-width: 0;
  text-decoration: none; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  transition: border-color .15s;
}
.pager__link:hover { border-color: var(--accent); color: inherit; }
.pager__link--next { text-align: right; grid-column: 2; }
.pager__label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.pager__name { font-family: var(--font-title); font-size: 1.45rem; line-height: 1.1; overflow-wrap: anywhere; }

/* 404 */
.notfound { padding-top: 56px; padding-bottom: 80px; }
.notfound p { color: var(--muted); }
.button {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; border-radius: 999px;
}
.button:hover { background: var(--accent-ink); color: #fff; }

/* ---------- Footer ---------- */

.site-footer { background: var(--text); color: var(--bg); margin-top: auto; }
.site-footer__inner { display: grid; gap: 22px; padding-top: 40px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.site-footer__mark { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }
.site-footer__name { margin: 0; font-family: var(--font-title); font-size: 2.2rem; line-height: 1; }
.site-footer__tagline { margin: 8px 0 0; max-width: 36ch; font-weight: 300; opacity: .85; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer__nav a { color: var(--bg); text-decoration-color: var(--accent); padding: 4px 0; }
.site-footer__nav a:hover { color: #fff; }
.site-footer__legal { margin: 0; padding-top: 18px; border-top: 1px solid rgba(255, 238, 221, .18); font-size: .78rem; opacity: .7; }
@media (min-width: 760px) {
  .site-footer__inner { grid-template-columns: 1fr auto; align-items: end; }
  .site-footer__legal { grid-column: 1 / -1; }
}
