/* Layout: a museum floor plan. Numbered rooms run down one corridor; the main hall
   hangs on a dark green salon wall, every other room is a white cube. */
:root {
  --white: #ffffff;
  --floor: #ebece8;
  --ink: #161716;
  --muted: #5d615c;
  --rule: #d3d6d0;
  --salon: #1f3a30;
  --salon-ink: #e9efe9;
  --gilt-1: #7d5f25;
  --gilt-2: #d9ba68;
  --gilt-3: #9c7a34;
  --rope: #7c1d22;
  --brass: #b8964c;
  --paper: #fbfaf6;

  --f-display: "Aref Ruqaa", "Amiri", "Times New Roman", serif;
  --f-ar: "Amiri", "Noto Naskh Arabic", "Times New Roman", serif;
  --f-en: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --f-en-title: "Libre Caslon Text", Georgia, serif;

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --measure: 62ch;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--f-ar);
  font-size: 1.125rem;
  line-height: 1.75;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--rope); outline-offset: 3px; }
[lang="en"] { font-family: var(--f-en); }
.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}
.num { font-variant-numeric: tabular-nums; }

/* ---------- utility bar ---------- */
.util {
  background: var(--ink);
  color: #dfe2dd;
  font-size: 0.85rem;
}
.util .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding-block: 8px;
  justify-content: space-between;
}
.util b { color: #fff; font-weight: 700; }
.util .open-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #6fbf73; margin-inline-end: 8px; vertical-align: middle;
}

/* ---------- header ---------- */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding-block: 22px 18px;
}
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; min-width: 0; }
.brand img { width: 84px; height: auto; flex: none; }
.brand-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4.4vw, 2.35rem);
  line-height: 1.15;
  display: block;
}
.brand-en {
  font-family: var(--f-en);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}
.nav { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 1.05rem; font-weight: 700; }
.nav a { text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover { border-color: var(--rope); }

/* ---------- motto strip ---------- */
.motto {
  text-align: center;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 1rem;
}
.motto q { quotes: "«" "»"; font-family: var(--f-display); color: var(--ink); font-size: 1.2rem; }
.motto i { font-family: var(--f-en-title); font-size: 0.95rem; }

/* ---------- rooms ---------- */
.room { padding-block: clamp(56px, 9vw, 104px); }
.room--floor { background: var(--floor); }
.room-no {
  font-family: var(--f-en);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.room-no .ar { font-family: var(--f-ar); letter-spacing: 0; text-transform: none; font-size: 1rem; font-weight: 700; color: var(--ink); }
.room h2 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  line-height: 1.2;
  margin: 6px 0 18px;
  text-wrap: balance;
}
.walltext { max-width: var(--measure); display: grid; gap: 12px; }
.walltext p { margin: 0; }
.walltext .en { font-size: 0.92rem; line-height: 1.6; color: var(--muted); direction: ltr; text-align: left; }

/* ---------- main hall ---------- */
.hall {
  background:
    radial-gradient(ellipse 60% 55% at 50% 0%, rgba(255, 238, 196, 0.16), transparent 70%),
    var(--salon);
  color: var(--salon-ink);
  padding-block: clamp(40px, 7vw, 80px) 0;
  overflow: hidden;
}
.hall .room-no, .hall .room-no .ar { color: #b9c7bd; }
.hall h1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.2;
  margin: 6px 0 clamp(28px, 5vw, 48px);
  color: #fff;
  text-wrap: balance;
}
.hall-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 330px);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.hall .label { align-self: center; }
.stanchions { margin-top: clamp(28px, 4vw, 44px); height: 90px; position: relative; }
.stanchions svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.stanchions .post {
  position: absolute; bottom: 0; top: 8px; width: 14px;
  background: linear-gradient(90deg, #7a6230, var(--brass) 40%, #e8d29a 55%, #8f7435);
  border-radius: 8px 8px 2px 2px;
}
.stanchions .post::before {
  content: ""; position: absolute; top: -8px; left: -3px; width: 20px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f1e0ae, var(--brass) 60%, #6f5826);
}
.stanchions .post::after {
  content: ""; position: absolute; bottom: 0; left: -14px; width: 42px; height: 7px; border-radius: 3px;
  background: linear-gradient(90deg, #6f5826, var(--brass) 50%, #6f5826);
}
.floorline { height: 26px; background: #16291f; }

/* ---------- frames ---------- */
.frame { position: relative; margin: 0; }
.frame--gilt {
  padding: clamp(10px, 1.8vw, 22px);
  background: linear-gradient(135deg, var(--gilt-1), var(--gilt-2) 28%, var(--gilt-3) 52%, var(--gilt-2) 76%, var(--gilt-1));
  box-shadow: 0 28px 40px -18px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(0, 0, 0, 0.28);
}
.frame--gilt::after {
  content: ""; position: absolute; inset: clamp(10px, 1.8vw, 22px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 6px 14px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.frame--paper {
  border: 7px solid #1c1c1b;
  background: var(--paper);
  padding: clamp(14px, 6%, 34px);
  box-shadow: 0 22px 30px -18px rgba(0, 0, 0, 0.45);
}
.frame--paper img { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.frame--black {
  border: 9px solid #222120;
  box-shadow: 0 22px 30px -18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255,255,255,.06);
}

/* ---------- labels ---------- */
.label {
  background: var(--white);
  color: var(--ink);
  padding: 16px 18px 18px;
  max-width: 340px;
  font-size: 1rem;
  line-height: 1.65;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  display: grid;
  gap: 8px;
}
.label h3 { margin: 0; font-family: var(--f-ar); font-weight: 700; font-size: 1.2rem; line-height: 1.4; }
.label .t-en { font-family: var(--f-en-title); font-style: italic; font-size: 0.92rem; direction: ltr; text-align: left; color: var(--muted); display: block; font-weight: 400; }
.label .meta { font-family: var(--f-en); font-size: 0.76rem; color: var(--muted); direction: ltr; text-align: left; letter-spacing: 0.02em; }
.label .meta-ar { font-size: 0.95rem; color: var(--muted); }
.label p { margin: 0; }
.label .en { font-family: var(--f-en); font-size: 0.8rem; line-height: 1.55; color: var(--muted); direction: ltr; text-align: left; }
.label .est {
  border-top: 1px solid var(--rule);
  padding-top: 8px;
  font-size: 0.92rem;
  display: grid; gap: 2px;
}
.label .est span { font-variant-numeric: tabular-nums; }
.label .est .zero { color: var(--rope); font-weight: 700; }

.guide-btn {
  justify-self: start;
  font: 700 0.95rem var(--f-ar);
  background: var(--ink); color: #fff;
  border: 0; padding: 7px 14px 8px; cursor: pointer;
  display: inline-flex; gap: 8px; align-items: center;
}
.guide-btn:hover { background: var(--rope); }
.guide-btn .stop { display: none; }
.guide-btn[aria-expanded="true"] .play { display: none; }
.guide-btn[aria-expanded="true"] .stop { display: inline; }
.guide {
  font-size: 0.95rem; line-height: 1.7;
  border-inline-start: 3px solid var(--rope);
  padding-inline-start: 12px;
  display: grid; gap: 8px;
}
.guide p { margin: 0; }
.guide .en { font-family: var(--f-en); font-size: 0.78rem; direction: ltr; text-align: left; color: var(--muted); }
.guide-progress { height: 3px; background: var(--rule); position: relative; overflow: hidden; }
.guide-progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--rope); }
.guide.playing .guide-progress i { animation: guide 38s linear forwards; }
@keyframes guide { to { width: 100%; } }

/* ---------- hangs ---------- */
.hang {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(40px, 6vw, 72px) clamp(28px, 4vw, 56px);
  margin-top: clamp(40px, 6vw, 64px);
}
.work {
  width: var(--w, 320px);
  max-width: 100%;
  display: grid;
  gap: 18px;
  justify-items: start;
}
.work .label { box-shadow: none; padding: 0; background: none; max-width: 100%; }
.room--floor .work .label { background: none; }
.view {
  all: unset;
  display: block;
  cursor: zoom-in;
  width: 100%;
  transition: transform 0.25s ease;
}
.view:hover { transform: translateY(-3px); }
.view:focus-visible { outline: 2px solid var(--rope); outline-offset: 6px; }
.w-l { --w: 460px; }
.w-m { --w: 360px; }
.w-s { --w: 280px; }

.empty-frame {
  aspect-ratio: 4 / 5;
  width: 100%;
  border: 9px solid #222120;
  background: var(--floor);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.empty-frame span {
  font-family: var(--f-en);
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  border: 1px dashed #a9ada6; padding: 6px 10px;
}

/* ---------- archive / awards ---------- */
.archive {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  margin-top: clamp(36px, 5vw, 56px);
  align-items: start;
}
.vitrine {
  background: #d9dcd5;
  padding: clamp(16px, 3vw, 28px);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.vitrine::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,.45) 0 18%, transparent 18% 64%, rgba(255,255,255,.22) 64% 70%, transparent 70%);
  pointer-events: none;
}
.vitrine .label { margin-top: 18px; max-width: 100%; }
.awards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: aw; }
.awards li {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 4px 18px;
  padding-block: 18px;
  border-top: 1px solid var(--rule);
}
.awards li:last-child { border-bottom: 1px solid var(--rule); }
.awards .yr { font-family: var(--f-en); font-size: 0.8rem; font-weight: 600; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.awards h3 { margin: 0; font-size: 1.15rem; line-height: 1.45; }
.awards p { margin: 2px 0 0; color: var(--muted); font-size: 1rem; }
.awards .prize { color: var(--ink); }
.awards .prize b { color: var(--rope); }

/* ---------- closed room ---------- */
.closed {
  position: relative;
  display: grid;
  justify-items: center;
  padding-block: clamp(24px, 4vw, 40px) 0;
}
.sign {
  background: #fff;
  width: min(100%, 520px);
  padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 40px);
  transform: rotate(-1.6deg);
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.35);
  position: relative;
  text-align: center;
}
.sign::before, .sign::after {
  content: ""; position: absolute; top: -12px; width: 92px; height: 26px;
  background: rgba(226, 214, 170, 0.78);
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.sign::before { left: 18px; transform: rotate(-7deg); }
.sign::after { right: 18px; transform: rotate(6deg); }
.sign strong {
  display: block;
  font-family: var(--f-display);
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.25;
  color: var(--rope);
}
.sign p { margin: 12px 0 0; font-size: 1.12rem; }
.sign .handle { font-family: var(--f-en); direction: ltr; unicode-bidi: isolate; font-weight: 600; font-size: 0.95rem; }
.sign .en { font-family: var(--f-en); font-size: 0.8rem; color: var(--muted); direction: ltr; }
.closed .stanchions { width: min(100%, 640px); height: 80px; margin-top: 20px; }

/* ---------- visit ---------- */
.visit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 0 40px;
  margin-top: clamp(28px, 4vw, 44px);
}
.visit div { border-top: 2px solid var(--ink); padding-block: 14px 26px; }
.visit dt { font-weight: 700; font-size: 1.1rem; }
.visit dt [lang="en"] { display: block; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.visit dd { margin: 8px 0 0; }
.visit dd .en { display: block; font-family: var(--f-en); font-size: 0.82rem; color: var(--muted); direction: ltr; text-align: left; margin-top: 4px; line-height: 1.5; }
.rules { margin: 0; padding-inline-start: 20px; }

/* ---------- shop ---------- */
.shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 32px 28px;
  margin-top: clamp(32px, 5vw, 48px);
}
.item { display: grid; gap: 10px; align-content: start; min-width: 0; }
.item .thumb {
  aspect-ratio: 1;
  background: var(--floor);
  display: grid; place-items: center;
  overflow: hidden;
  position: relative;
}
.w-xs { --w: 230px; }
.item .thumb img { width: 62%; height: 62%; object-fit: cover; box-shadow: 0 10px 18px -10px rgba(0,0,0,.4); }
.item .thumb .mug { width: 52%; height: 46%; border-radius: 4px 4px 14px 14px; border: 0; }
.item .thumb .handle-shape {
  position: absolute; width: 16%; height: 22%; border: 7px solid #e6e6e2; border-left: 0;
  border-radius: 0 40% 40% 0; right: 16%; top: 38%;
}
.item .thumb .pencil {
  width: 26%; height: 8px; background: linear-gradient(90deg, #333 0 12%, #e2c07a 12% 30%, #c8a148 30%);
  border-radius: 1px; box-shadow: 0 6px 10px -6px rgba(0,0,0,.4);
}
.item h3 { margin: 0; font-size: 1.1rem; line-height: 1.45; }
.item .sub { font-family: var(--f-en); font-size: 0.78rem; color: var(--muted); direction: ltr; text-align: left; }
.item .price { font-weight: 700; font-variant-numeric: tabular-nums; }
.item .royalty { font-size: 0.88rem; color: var(--muted); }
.btn {
  font: 700 1rem var(--f-ar);
  background: var(--ink); color: #fff;
  border: 0; padding: 8px 16px 9px;
  cursor: pointer; justify-self: start;
}
.btn:hover { background: var(--rope); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.msg { min-height: 1.6em; font-size: 0.98rem; color: var(--rope); margin: 0; }

/* ---------- fund ---------- */
.fund {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  margin-top: clamp(32px, 5vw, 48px);
  align-items: start;
}
.meter { display: grid; gap: 10px; }
.meter-bar { height: 22px; background: var(--white); box-shadow: inset 0 0 0 1px var(--rule); position: relative; }
.meter-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--rope); width: 5.4%; transition: width 0.6s ease; }
.meter-nums { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.meter-nums b { font-size: 1.6rem; }
.meter .note { font-size: 0.9rem; color: var(--muted); margin: 0; }
.tiers { display: grid; gap: 12px; }
.tier {
  all: unset;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: baseline;
  padding: 14px 16px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.tier:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tier:focus-visible { outline: 2px solid var(--rope); outline-offset: 2px; }
.tier b { font-size: 1.08rem; }
.tier .amt { font-variant-numeric: tabular-nums; font-weight: 700; }
.tier .en { grid-column: 1 / -1; font-family: var(--f-en); font-size: 0.78rem; color: var(--muted); direction: ltr; text-align: left; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: #cfd3cd; font-size: 0.98rem; }
.foot .wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px 48px;
  padding-block: 48px 40px;
  align-items: start;
}
.foot img { width: 86px; filter: invert(1); opacity: 0.92; }
.foot h4 { margin: 0 0 8px; color: #fff; font-size: 1rem; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.foot .en { font-family: var(--f-en); font-size: 0.78rem; color: #9da39b; direction: ltr; text-align: left; }
.foot a { color: #fff; }
.foot-base { border-top: 1px solid #2f312e; }
.foot-base .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 16px; grid-template-columns: none; font-size: 0.85rem; color: #9da39b; }

/* ---------- viewer dialog ---------- */
dialog.viewer {
  border: 0;
  padding: 0;
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--white);
  color: var(--ink);
  overflow: auto;
}
dialog.viewer::backdrop { background: rgba(16, 20, 17, 0.86); }
.viewer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}
.viewer-img { background: #1a1c1a; display: grid; place-items: center; padding: clamp(12px, 3vw, 32px); min-height: 280px; }
.viewer-img img { max-height: 78vh; width: auto; object-fit: contain; }
.viewer-side { padding: clamp(18px, 3vw, 30px); display: grid; gap: 18px; align-content: start; min-width: 0; }
.viewer-side .label { box-shadow: none; padding: 0; max-width: 100%; }
.offer { display: grid; gap: 10px; border-top: 2px solid var(--ink); padding-top: 14px; }
.offer label { font-weight: 700; }
.offer .row { display: flex; gap: 8px; flex-wrap: wrap; }
.offer input {
  font: 1rem var(--f-en);
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  width: 0; flex: 1 1 140px; min-width: 0;
  direction: ltr;
  background: var(--white); color: var(--ink);
}
.close-x {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2;
  font: 700 1.3rem var(--f-en);
  width: 40px; height: 40px;
  background: var(--white); color: var(--ink); border: 0; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hall-grid, .archive, .fund, .viewer-grid { grid-template-columns: minmax(0, 1fr); }
  .hall .label { max-width: 100%; }
  .foot .wrap { grid-template-columns: minmax(0, 1fr); }
  .viewer-img img { max-height: 52vh; }
}
@media (max-width: 520px) {
  .brand img { width: 60px; }
  .nav { gap: 2px 16px; font-size: 0.98rem; }
  .stanchions { height: 60px; }
  .awards li { grid-template-columns: minmax(0, 1fr); }
  body { font-size: 1.06rem; }
  .room { padding-block: 52px; }
  .hang { gap: 44px 16px; }
  .w-xs { --w: calc(50% - 8px); }
  .w-xs .label .en, .w-xs .label p:not(.en) { font-size: 0.9rem; }
  .w-xs .frame--paper { padding: 8px; border-width: 5px; }
  .w-xs .frame--gilt { padding: 7px; }
  .w-xs .frame--gilt::after { inset: 7px; }
  .shop { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
  .item h3 { font-size: 1rem; }
  .item .sub { font-size: 0.72rem; }
  .btn { font-size: 0.95rem; padding: 7px 12px 8px; }
  .label { padding: 14px 14px 16px; }
  .hall h1 { margin-bottom: 22px; }
  dialog.viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .viewer-img { padding-top: max(56px, env(safe-area-inset-top, 0px)); }
  .viewer-img img { max-height: 48dvh; }
  .viewer-side { padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
  .close-x { position: fixed; top: max(10px, env(safe-area-inset-top, 0px)); inset-inline-start: max(10px, env(safe-area-inset-right, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
