/* AL-DIAA — Products catalogue 2026 */

:root {
  --ink: #11100e;
  --cream: #f5ead5;
  --sand: #efe4cd;
  --gold: #c3a76a;
  --green: #2f7b46;
  --green-hover: #35894f;
  --text: #1a1916;
  --muted: #6f675c;

  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[dir="rtl"] {
  --font-sans: "Tajawal", "DM Sans", system-ui, sans-serif;
  --font-serif: "Tajawal", "Fraunces", Georgia, serif;
}

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

html,
body {
  overflow-x: clip;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgb(255 255 255 / 0.45), transparent 70%),
    var(--sand);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

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

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 16px 0;
  padding: 10px 14px 10px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  animation: drop 0.9s var(--ease-out) both;
}
@media (min-width: 768px) {
  .header { margin: 18px 48px 0; padding-inline: 40px 16px; }
}
.header__logo {
  flex: none;
  transition: transform 0.5s var(--ease-out);
}
.header__logo:hover {
  transform: scale(1.05) rotate(-2deg);
}
.header__logo img {
  width: 104px;
}
@media (min-width: 640px) {
  .header__logo img { width: 132px; }
}
.header__badge {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 0 0 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
[dir="rtl"] .header__badge {
  margin: 0 24px 0 0;
  letter-spacing: 0;
  font-size: 13px;
}
@media (min-width: 900px) {
  .header__badge { display: flex; }
}
.header__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fcf8a;
}
.header__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #6fcf8a;
  animation: ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.header__actions {
  display: flex;
  gap: 8px;
  margin-inline-start: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding-inline: 14px;
  border: 1px solid rgb(245 234 213 / 0.2);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    background-color 0.3s,
    border-color 0.3s,
    transform 0.3s var(--ease-out);
}
[dir="rtl"] .pill {
  letter-spacing: 0;
  font-size: 13px;
}
.pill:hover {
  border-color: rgb(245 234 213 / 0.45);
  background: rgb(245 234 213 / 0.08);
}
.pill:active {
  transform: scale(0.95);
}
.pill svg {
  width: 20px;
  height: 20px;
  transition: transform 0.7s var(--ease-out);
}
.pill:hover .pill__globe {
  transform: rotate(180deg);
}
.pill--solid {
  border-color: transparent;
  background: var(--green);
  color: #fff;
}
.pill--solid:hover {
  border-color: transparent;
  background: var(--green-hover);
}
.pill--solid:hover svg {
  transform: translateY(2px);
}
#lang-toggle span {
  min-width: 1.2em;
  font-size: 13px;
  letter-spacing: 0;
  text-align: center;
}
@media (max-width: 479px) {
  .pill--solid span { display: none; }
  .pill--solid { padding-inline: 11px; }
}

/* Catalogue --------------------------------------------------------------- */

.catalogue {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 16px 32px;
}
.catalogue__head {
  text-align: center;
}
.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
}
[dir="rtl"] .eyebrow {
  letter-spacing: 0;
  font-size: 14px;
}
.title {
  margin: 14px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
[dir="rtl"] .title {
  letter-spacing: 0;
  font-weight: 700;
  line-height: 1.3;
}

/* The book is sized so a full spread (2 × 681:483 pages) fits under the header and controls. */
.book-stage {
  position: relative;
  width: min(100%, 1400px, calc((100svh - 330px) * 2.82));
  --edge: 12px;
  min-width: min(100%, 280px);
  margin-top: 28px;
  perspective: 2400px;
  animation: book-in 1.4s var(--ease-out) 0.3s both;
}
/* Static floor shadow: painted once, never re-rasterised while pages turn */
.book-stage::before {
  content: "";
  position: absolute;
  inset: auto 6% -18px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgb(60 40 20 / 0.35), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}
@media (min-width: 760px) {
  .book-stage { width: min(100% - 170px, 1400px, calc((100svh - 330px) * 2.82)); }
}
.book-wrap {
  position: relative;
  transition: transform 0.9s var(--ease-out);
  will-change: transform;
}
.book {
  margin-inline: auto;
}

/* Paper edges — the block of pages peeking out on each side of the open book */
.edges {
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: var(--edge);
  background:
    linear-gradient(180deg, rgb(0 0 0 / 0.08), transparent 12%, transparent 88%, rgb(0 0 0 / 0.1)),
    repeating-linear-gradient(90deg, #f7f0e2 0 1.4px, #cfc2a6 1.4px 2.4px);
  box-shadow: 0 10px 18px -8px rgb(60 40 20 / 0.45);
  transition: transform 0.8s var(--ease-out);
}
.edges--read {
  right: 100%;
  border-radius: 3px 0 0 3px;
  transform: scaleX(var(--read, 0));
  transform-origin: right;
}
.edges--unread {
  left: 100%;
  border-radius: 0 3px 3px 0;
  transform: scaleX(var(--unread, 1));
  transform-origin: left;
}

/* Corner-turn buttons beside the book */
.turn {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-top: -27px;
  border: 1px solid rgb(17 16 14 / 0.12);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.55);
  color: var(--text);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition:
    transform 0.45s var(--ease-spring),
    background-color 0.3s,
    color 0.3s,
    border-color 0.3s,
    opacity 0.3s;
}
.turn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.45s var(--ease-out);
}
.turn--prev { left: -85px; }
.turn--next { right: -85px; }
.turn:hover {
  border-color: transparent;
  background: var(--ink);
  color: var(--cream);
  transform: scale(1.08);
}
.turn--prev:hover svg { transform: translateX(-3px); }
.turn--next:hover svg { transform: translateX(3px); }
.turn:active {
  transform: scale(0.92);
}
.turn:disabled {
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 759px) {
  .book-stage { --edge: 6px; }
  .turn {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border-color: transparent;
    background: rgb(17 16 14 / 0.55);
    color: var(--cream);
  }
  .turn--prev { left: 6px; }
  .turn--next { right: 6px; }
}
.book .stf__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.book-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 0.5s;
}
.book-loading.is-done {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 2px solid rgb(31 74 46 / 0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.book-stage:fullscreen {
  display: grid;
  place-items: center;
  width: 100%;
  margin: 0;
  padding: 24px;
  background: var(--ink);
}

/* Folio & tools ---------------------------------------------------------- */

.folio {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 34px;
}
.folio__rule {
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.folio__rule:last-child {
  background: linear-gradient(270deg, transparent, var(--gold));
}
.folio__text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
[dir="rtl"] .folio__text {
  letter-spacing: 0;
  font-size: 13px;
}
.folio__num,
#page-total {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--text);
}
#page-total {
  font-size: 16px;
  color: var(--muted);
}
.folio__num {
  display: inline-block;
}
.folio__num.is-bump {
  animation: bump 0.5s var(--ease-spring);
}

.tools {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.3s;
}
[dir="rtl"] .tool {
  letter-spacing: 0;
  font-size: 13px;
}
.tool svg {
  width: 16px;
  height: 16px;
  transition: transform 0.45s var(--ease-spring);
}
.tool__label {
  position: relative;
}
.tool__label::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
[dir="rtl"] .tool__label::after {
  transform-origin: right;
}
.tool:hover,
.tool[aria-expanded="true"] {
  color: var(--green);
}
.tool:hover .tool__label::after,
.tool[aria-expanded="true"] .tool__label::after {
  transform: scaleX(1);
}
.tool:hover svg {
  transform: scale(1.15);
}
.tools__dot {
  color: var(--gold);
}
@media (max-width: 560px) {
  #fullscreen,
  .tools__dot { display: none; }
}

/* Thumbnails -------------------------------------------------------------- */

.thumbs {
  width: min(100%, 1400px);
  margin-top: 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  animation: fade-up 0.5s var(--ease-out) both;
}
.thumbs[hidden] {
  display: none;
}
.thumbs__track {
  display: flex;
  gap: 10px;
  padding: 8px 5%;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.thumbs__track::-webkit-scrollbar {
  display: none;
}
.thumb {
  position: relative;
  flex: none;
  width: 104px;
  overflow: hidden;
  border-radius: 6px;
  opacity: 0.55;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition:
    opacity 0.3s,
    transform 0.4s var(--ease-out),
    outline-color 0.3s;
}
.thumb img {
  width: 100%;
  aspect-ratio: 681 / 483;
  object-fit: cover;
}
.thumb span {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.8);
}
.thumb:hover {
  opacity: 0.9;
  transform: translateY(-3px);
}
.thumb.is-active {
  opacity: 1;
  outline-color: var(--green);
}

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 22px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
@media (min-width: 768px) {
  .footer { padding-inline: 64px; }
}
[dir="rtl"] .footer {
  letter-spacing: 0;
  font-size: 12px;
}

.footer__meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}
.footer__sep {
  color: var(--gold);
}
.footer__credit {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #eea240;
}
.footer__logo {
  flex: none;
  stroke: none;
  transition: transform 0.6s var(--ease-spring);
}
.footer__name {
  position: relative;
}
.footer__name::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.footer__credit:hover .footer__logo {
  transform: rotate(-20deg) scale(1.15);
}
.footer__credit:hover .footer__name::after {
  transform: scaleX(1);
}

/* Motion ------------------------------------------------------------------ */

.mask {
  display: block;
  overflow: hidden;
  margin-block: -0.14em;
  padding-block: 0.14em;
}
.rise {
  display: block;
  animation: rise 1.2s var(--ease-out) var(--d, 0s) both;
}
.fade {
  animation: fade-up 0.9s var(--ease-out) var(--d, 0s) both;
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { transform: translateY(150%); }
  to { transform: none; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes book-in {
  from { opacity: 0; transform: translateY(60px) rotateX(14deg) scale(0.95); }
  to { opacity: 1; transform: none; }
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(2.6); opacity: 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes bump {
  40% { transform: translateY(-4px) scale(1.12); color: var(--green); }
}

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