/* Catalog page */
.cat-head {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: clamp(20px, 4vw, 50px);
  align-items: end;
  padding: clamp(28px, 6vh, 62px) 0 clamp(20px, 3vh, 30px);
}
.cat-head h1 .en { font-size: clamp(36px, 6vw, 68px); color: #fff; line-height: 1; }
.cat-head h1 .ar { margin-top: 10px; font-size: clamp(15px, 2vw, 22px); }
.cat-head .lede { margin-top: 18px; max-width: 46ch; }
.cat-head .lede .en { font-family: var(--ui); font-size: 13.5px; color: #d6cfc0; }
.cat-head .lede .ar { font-size: 12.5px; margin-top: 5px; }
.cat-actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: clamp(18px, 3vh, 28px); border-bottom: 1px solid var(--line-soft); }
.f {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line-soft);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.f small { font-family: var(--ar); text-transform: none; letter-spacing: 0; font-size: 11px; }
.f:hover { color: var(--gold-lit); border-color: var(--line); }
.f.on { color: #0b0b0c; background: var(--gold); border-color: var(--gold); }
.grid-btn { margin-left: auto; }

/* viewer */
.viewer {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(22px, 4vw, 56px);
  align-items: center;
  padding: clamp(24px, 5vh, 50px) 0;
}
.stage { position: relative; display: grid; grid-auto-flow: column; align-items: center; gap: clamp(6px, 1.5vw, 18px); }
.halo {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(58vh, 86%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 190, 121, 0.16), transparent 65%);
  filter: blur(24px);
  pointer-events: none;
}
.disc { position: relative; flex: 1; margin-inline: auto; width: min(100%, 460px); }
.disc img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(217, 190, 121, 0.22) inset;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease);
}
.disc img.ready { opacity: 1; transform: none; }
.disc-ring {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid var(--line);
  pointer-events: none;
}
.disc-ring::before, .disc-ring::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
}
.disc-ring::before { top: -4px; left: calc(50% - 4px); }
.disc-ring::after { bottom: -4px; left: calc(50% - 4px); }

.arrow {
  width: clamp(38px, 5vw, 52px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  color: var(--gold);
  transition: background 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease);
  flex: none;
}
.arrow:hover { background: var(--gold); color: #0a0a0a; border-color: var(--gold); }
.arrow[disabled] { opacity: 0.3; pointer-events: none; }

.meta .pageno { font-family: var(--display); font-size: 13px; letter-spacing: 0.3em; color: var(--gold-deep); }
.meta .pageno span:first-child { color: var(--gold-lit); font-size: 20px; }
.meta h2 { margin-top: 12px; }
.meta h2 .en, .meta h2 { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3.6vw, 42px); color: #fff; line-height: 1.05; }
.meta > .ar { font-family: var(--ar); direction: rtl; text-align: right; color: var(--gold); margin-top: 8px; font-size: clamp(14px, 1.7vw, 18px); opacity: 0.9; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags .chip { font-size: 9.5px; letter-spacing: 0.2em; }
.tags .chip.ar { font-family: var(--ar); letter-spacing: 0; text-transform: none; direction: rtl; }

.specs { margin-top: 20px; border-top: 1px solid var(--line-soft); }
.specs div { display: flex; justify-content: space-between; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.specs dt { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.specs dd { font-size: 13px; color: var(--gold-lit); letter-spacing: 0.04em; }

.meta-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 24px; }

/* rail */
.rail-wrap { padding-bottom: clamp(20px, 4vh, 34px); }
.rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 2px 14px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 190, 121, 0.4) transparent;
}
.rail::-webkit-scrollbar { height: 4px; }
.rail::-webkit-scrollbar-thumb { background: rgba(217, 190, 121, 0.4); }
.rail button {
  position: relative;
  flex: none;
  width: 74px;
  scroll-snap-align: center;
  opacity: 0.5;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.rail button img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 1px solid transparent; }
.rail button b {
  display: block;
  font-family: var(--ui);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail button:hover { opacity: 0.9; transform: translateY(-2px); }
.rail button.on { opacity: 1; }
.rail button.on img { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 190, 121, 0.35), 0 12px 26px -14px #000; }
.rail button.on b { color: var(--gold-lit); }

/* index grid */
.index-grid { border-top: 1px solid var(--line-soft); padding: clamp(22px, 4vh, 40px) 0; }
.grid-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: clamp(14px, 2vw, 24px); }
.cell { text-align: left; display: block; width: 100%; }
.cell img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 1px solid var(--line-soft); transition: border-color 0.4s var(--ease), transform 0.5s var(--ease); }
.cell:hover img { border-color: var(--gold); transform: translateY(-4px); }
.cell .en { display: block; font-family: var(--ui); font-weight: 400; font-size: 13px; color: #e9e2d4; margin-top: 12px; letter-spacing: 0.02em; }
.cell .ar { display: block; font-family: var(--ar); font-size: 11.5px; color: var(--gold); opacity: 0.85; margin-top: 3px; direction: rtl; }
.cell .no { display: block; font-size: 9.5px; letter-spacing: 0.24em; color: var(--gold-deep); margin-top: 6px; }
.index-grid[hidden] { display: none; }

@media (max-width: 940px) {
  .cat-head { grid-template-columns: 1fr; align-items: start; }
  .cat-actions { flex-direction: row; flex-wrap: wrap; }
  .viewer { grid-template-columns: 1fr; }
  .meta > .ar, .meta { text-align: left; }
  .meta > .ar { text-align: right; }
  .grid-btn { margin-left: 0; }
}
@media (max-width: 560px) {
  .disc { width: min(100%, 330px); }
  .stage { grid-auto-flow: row; }
  .arrow { display: none; }
}

/* catalog.css refers to these three names but kit.css never defined them, so every
   rule using them silently fell back to the inherited colour. Declared here. */
:root {
  --bone: #f4efe4;
  --gold-dim: rgba(217, 190, 121, 0.68);
  --serif: var(--display);
}

/* rectangular catalogs: same gold frame, page kept whole */
.layout-sheet .halo { display: none; }
.layout-sheet .disc-ring { display: none; }
.layout-sheet figure.sheet { width: min(100%, 560px); }
.layout-sheet figure.sheet img {
  width: 100%;
  height: auto;
  max-height: 62vh;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #0b0c0d;
  border: 1px solid var(--line);
  box-shadow: 0 40px 90px -44px rgba(0, 0, 0, 0.95), 0 0 0 6px rgba(8, 9, 10, 0.6);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.layout-sheet figure.sheet img.ready { opacity: 1; transform: none; }
.layout-sheet .rail button img { border-radius: 4px; aspect-ratio: auto; object-fit: cover; }
@media (max-width: 700px) {
  .layout-sheet figure.sheet { width: 100%; }
  .layout-sheet figure.sheet img { max-height: 54vh; }
}

/* stone index: one row per granite, with a chip per edition that shows it */
.page-index .stones-list { margin-top: clamp(18px, 3vw, 34px); border-top: 1px solid var(--line); }
.page-index .srow {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 74px minmax(0, 2.2fr);
  gap: clamp(10px, 2vw, 22px);
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(217, 190, 121, 0.13);
  transition: background 0.25s ease;
}
.page-index .srow:hover { background: rgba(217, 190, 121, 0.045); }
.page-index .sn { font-family: var(--display); font-size: clamp(16px, 1.6vw, 21px); color: var(--stone); letter-spacing: 0.01em; }
.page-index .sc { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.page-index .sl { display: flex; flex-wrap: wrap; gap: 6px; }
.page-index .sl .chip {
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 9px; border: 1px solid rgba(217, 190, 121, 0.28); border-radius: 999px;
  color: var(--gold); text-decoration: none; transition: all 0.2s ease;
}
.page-index .sl .chip:hover { background: var(--gold); color: #101010; border-color: var(--gold); }
@media (max-width: 760px) {
  .page-index .srow { grid-template-columns: 1fr auto; row-gap: 8px; padding: 14px 2px; }
  .page-index .sn { grid-column: 1; }
  .page-index .sc { grid-column: 2; text-align: right; }
  .page-index .sl { grid-column: 1 / -1; }
}

/* landscape editions get a stage that matches their spread */
.layout-sheet figure.sheet.wide { width: min(100%, 900px); }
.layout-sheet figure.sheet.wide img { max-height: 56vh; }
@media (max-width: 900px) {
  .layout-sheet figure.sheet.wide, .layout-sheet figure.sheet { width: 100%; }
  .layout-sheet figure.sheet.wide img, .layout-sheet figure.sheet img { max-height: 46vh; }
}
