/* KRS Payals catalogue: design cards, category buttons and the design sheet.
   Uses the page's own colours and fonts (set in index.html). */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --card: #F8F9F6;
}

.cat-note { font-size: .88rem; color: var(--oxide-soft); }
.cat-sample-note {
  font-size: .8rem;
  color: var(--kumkum);
  background: rgba(122, 31, 43, .06);
  border-left: 2px solid var(--kumkum);
  padding: .5rem .7rem;
  margin: 0 0 1rem;
}

/* Category buttons */
.cat-chips { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1.5rem 1rem; padding: 0 1.5rem .2rem; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none;
  min-height: 38px;
  padding: .4rem .9rem;
  border: 1px solid rgba(29, 34, 38, .25);
  border-radius: 999px;
  background: none;
  color: var(--oxide);
  font-size: .9rem;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.cat-chip span { color: var(--oxide-soft); font-size: .78rem; margin-left: .25rem; transition: color 150ms ease; }
.cat-chip:active { transform: scale(.97); }
.cat-chip[aria-pressed="true"] { background: var(--oxide); color: var(--silver-pale); border-color: var(--oxide); }
.cat-chip[aria-pressed="true"] span { color: var(--silver-mid); }

/* Design cards: two to a row on a phone */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: var(--rule);
  border-radius: 6px;
  background: var(--card);
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: inherit;
  transition: transform 160ms var(--ease-out);
}
.cat-card:active { transform: scale(.97); }
.cat-card img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--silver-pale); }
.cat-card .body { padding: .6rem .7rem .75rem; }
.cat-card .name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: .98rem; line-height: 1.25; display: block; }
.cat-card .meta { font-size: .76rem; color: var(--oxide-soft); display: block; margin-top: .2rem; }
.cat-badge {
  position: absolute;
  top: .45rem;
  left: .45rem;
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(240, 241, 237, .92);
  color: var(--kumkum);
  border: 1px solid rgba(122, 31, 43, .35);
  border-radius: 3px;
  padding: .1rem .35rem;
}
.cat-empty { font-size: .9rem; color: var(--oxide-soft); }
.cat-noimg {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--silver-pale);
  color: var(--oxide-soft);
  font-size: .8rem;
}
.cat-noimg.big { border-radius: 6px; margin: .4rem 0 1rem; }

/* Cards rise in, then a silver shine sweeps across each picture (catalogue-view.js starts it
   when the catalogue comes into view). */
@keyframes cat-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes cat-shine { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
.cat-grid:not(.play) .cat-card.enter { opacity: 0; }
.cat-grid.play .cat-card.enter { animation: cat-rise 300ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
.cat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  aspect-ratio: 4 / 3;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%);
  transform: translateX(-120%);
  pointer-events: none;
}
.cat-grid.play .cat-card.enter::after { animation: cat-shine 900ms var(--ease-in-out) both; animation-delay: calc(var(--i, 0) * 50ms + 300ms); }

/* On a laptop: cards lift a little under the mouse, and the shine sweeps again */
@media (hover: hover) and (pointer: fine) {
  .cat-card { transition: transform 200ms var(--ease-out), box-shadow 200ms ease; }
  .cat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -16px rgba(0, 0, 0, .45); }
  .cat-grid.play .cat-card.enter:hover::after { animation: cat-shine 900ms var(--ease-in-out); }
}
/* Resting the mouse on a design: a line fills along the bottom of the card for 2 seconds, then
   its sheet opens (catalogue-view.js). It takes the card's text colour, so it suits every look. */
.cat-hold {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: currentColor;
  opacity: .7;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
  pointer-events: none;
}
.cat-card.is-holding .cat-hold { transform: scaleX(1); transition: transform 2s linear; }

@media (prefers-reduced-motion: reduce) {
  .cat-card::after { display: none; }
  .cat-hold { transform: none; opacity: 0; transition: opacity 150ms ease; }
  .cat-card.is-holding .cat-hold { opacity: .7; transition: opacity 2s linear; }
  .cat-grid.play .cat-card.enter { animation-delay: 0ms; }
}

/* In the sheet: ‹ 2 of 9 › over the picture, and the size picker */
.cat-sheet .pic { position: relative; }
.cat-sheet .pic img { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.cat-sheet .nav {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .2rem;
  border-radius: 999px;
  background: rgba(240, 241, 237, .92);
  color: #1D2226;
  font-size: .8rem;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .35);
}
.cat-sheet .nav button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(29, 34, 38, .2);
  border-radius: 50%;
  background: #F8F9F6;
  color: #1D2226;
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 160ms var(--ease-out);
}
.cat-sheet .nav button:active { transform: scale(.97); }

.cat-sheet .sizes { margin: .4rem 0 .2rem; }
.cat-sheet .sizes-label { font-size: .82rem; color: var(--oxide-soft); margin: 0 0 .5rem; }
.size-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.size-chip {
  min-width: 48px;
  min-height: 40px;
  padding: .3rem .6rem;
  border: 1px solid rgba(29, 34, 38, .25);
  border-radius: 6px;
  background: none;
  color: var(--oxide);
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.size-chip:active { transform: scale(.97); }
.size-chip[aria-pressed="true"] { background: var(--oxide); color: var(--silver-pale); border-color: var(--oxide); }

/* Design sheet: slides up from the bottom */
dialog.cat-sheet {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  padding: 0 0 env(safe-area-inset-bottom);
  border: 0;
  border-radius: 14px 14px 0 0;
  background: var(--paper);
  color: var(--oxide);
  overflow: auto;
  transform: translateY(100%);
  transition:
    transform 250ms var(--ease-drawer),
    overlay 250ms var(--ease-drawer) allow-discrete,
    display 250ms var(--ease-drawer) allow-discrete;
}
dialog.cat-sheet[open] { transform: translateY(0); }
@starting-style { dialog.cat-sheet[open] { transform: translateY(100%); } }
dialog.cat-sheet::backdrop {
  background-color: rgb(0 0 0 / 0);
  transition:
    background-color 250ms var(--ease-drawer),
    overlay 250ms var(--ease-drawer) allow-discrete,
    display 250ms var(--ease-drawer) allow-discrete;
}
dialog.cat-sheet[open]::backdrop { background-color: rgb(0 0 0 / .45); }
@starting-style { dialog.cat-sheet[open]::backdrop { background-color: rgb(0 0 0 / 0); } }

.cat-sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(29, 34, 38, .2); margin: .6rem auto .2rem; }
.cat-sheet .inner { padding: .4rem 1.5rem 1.4rem; }
.cat-sheet img { width: 100%; height: auto; border-radius: 6px; border: var(--rule); display: block; margin: .4rem 0 1rem; background: var(--silver-pale); }
.cat-sheet h2 { font-size: 1.4rem; margin: 0 0 .2rem; }
.cat-sheet .code { font-size: .8rem; color: var(--oxide-soft); margin: 0 0 .8rem; }
.cat-sheet .facts { list-style: none; margin: .8rem 0 1rem; padding: 0; }
.cat-sheet .facts li { display: flex; gap: 1rem; border-bottom: var(--rule); padding: .55rem 0; font-size: .92rem; }
.cat-sheet .facts li:last-child { border-bottom: 0; }
.cat-sheet .facts b { flex: none; width: 7.5rem; font-weight: 500; color: var(--oxide-soft); }
.cat-sheet .sheet-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.cat-sheet .btn { transition: transform 160ms var(--ease-out); }
.cat-sheet .btn:active { transform: scale(.97); }
body:has(dialog.cat-sheet[open]) { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  dialog.cat-sheet, dialog.cat-sheet[open] { transform: none; }
}

/* ---------- Two pages from one file ----------
   Home page: one tile per range. /catalogue (html.page-cat): only the catalogue, with the
   range buttons kept at the top while you scroll the designs. */

html:not(.page-cat) #catalogue .cat-chips,
html:not(.page-cat) #catalogue .cat-grid { display: none; }
.page-cat .cat-ranges { display: none; }

.cat-ranges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.cat-range .name::after { content: " \203A"; color: var(--oxide-soft); }
.cat-ranges .cat-all { grid-column: 1 / -1; margin-top: .2rem; }

.page-cat .hero,
.page-cat .band:not(#catalogue) { display: none; }
.page-cat #catalogue { margin-top: .4rem; }
.page-cat #catalogue > .chain-rule { display: none; }
.page-cat #catalogue h2 { font-size: clamp(1.75rem, 7.5vw, 2.3rem); margin: .2rem 0 .35rem; }
.cat-back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: .9rem;
  color: var(--oxide-soft);
  transition: transform 160ms var(--ease-out);
}
.cat-back:active { transform: scale(.97); }
.page-cat .cat-chips {
  position: sticky;
  top: 0;
  z-index: 3;
  padding-top: .55rem;
  padding-bottom: .55rem;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ---------- A design or range without a photo yet (slotHtml in catalogue-view.js) ----------
   Its name in Tamil and English on a quiet card, between two thin rows of silver beads. The
   colours come from the text around it, so it suits every look in light and dark. Kolam and
   Boutique use the same card and set its colour and position in their own files. */
.krs-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2em;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 8% 9%;
  overflow: hidden;
  text-align: center;
  line-height: 1.25;
  container-type: inline-size;
  pointer-events: none;
}
.krs-slot:not(.cat-noimg) { background: rgba(128, 128, 128, .08); background: color-mix(in srgb, currentColor 6%, transparent); }
.krs-slot::before,
.krs-slot::after {
  content: "";
  flex: none;
  width: min(62%, 200px);
  height: 9px;
  background:
    radial-gradient(circle, currentColor 0 2px, transparent 2.6px) 0 50% / 12px 9px repeat-x,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 1px no-repeat;
  opacity: .28;
}
.krs-slot::before { margin-bottom: .5em; }
.krs-slot::after { margin-top: .5em; }
.krs-slot b { font-weight: 600; font-size: 1.05rem; font-size: clamp(.9rem, 9.5cqi, 1.9rem); overflow-wrap: break-word; max-width: 100%; }
.krs-slot-en { font-size: .8rem; font-size: clamp(.7rem, 5.2cqi, 1.05rem); opacity: .8; }
.krs-slot small { margin-top: .25em; font-size: .62rem; font-size: clamp(.56rem, 3.6cqi, .74rem); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.cat-noimg.krs-slot { font-size: 1rem; }

/* "The range" list: the Tamil name sits beside the English one; a long range takes two columns */
.group h3 .ta, .group li .ta { display: inline; margin: 0 0 0 .45em; font-size: .86em; font-weight: 400; color: var(--oxide-soft); }
.range .group.wide { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .group.wide ul { columns: 2; column-gap: 2rem; }
  .group.wide li { break-inside: avoid; }
}
