/* ═══════════════════════════════════════════════════════════════
   site.css — מ.ט.י.מ. · קטלוג אינטראקטיבי
   טוקנים מועתקים מ- D:\אתרים\mtym-site\demo\index.html (מקור האמת)
   ברירת מחדל: ערכה כהה. RTL/LTR נשלט ע"י html[dir], לא ע"י מדיה-קוורי.
   ═══════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #fb8500;
  --dur: .45s;
  /* ברירת מחדל: כהה */
  --wall-hi: #241E18; --wall-lo: #100D0B;
  --stone: #221D18;
  --ink: #f0ede4; --muted: #9a978c;
  --hair: rgba(240, 237, 228, .16); --chip: #1d1a15;
  --card-bg: #17140f;
  --card-border: rgba(240, 237, 228, .10);
}
:root[data-theme="light"] {
  --wall-hi: #F2EDE5; --wall-lo: #DED6C9;
  --stone: #E7E1D7;
  --ink: #2B241D; --muted: #6F6455;
  --hair: rgba(43, 36, 29, .2); --chip: #EFEAE1;
  --card-bg: #F8F5EF;
  --card-border: rgba(43, 36, 29, .12);
}

html, body { background: var(--wall-lo); }
body {
  font-family: 'Heebo', 'Segoe UI', sans-serif;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  color: var(--ink);
  transition: background var(--dur), color var(--dur);
  -webkit-font-smoothing: antialiased;
}
.display { font-family: 'Bellefair', serif; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ── סרגל עליון ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: max(10px, env(safe-area-inset-top)) 20px 10px;
  border-bottom: 1px solid var(--hair);
  background: var(--wall-lo);
}
.topbar .brandLink { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .brandLink .bn { font-size: 16px; color: var(--ink); }
.topbar .brandLink .bt { font-size: 10px; letter-spacing: .16em; color: var(--muted); }
.crumbs {
  flex: 1; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); min-width: 0;
  padding-inline-start: 8px;
}
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--ink); font-weight: 500; }
.topControls { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.iconBtn {
  appearance: none; border: 1px solid var(--hair); background: var(--chip);
  color: var(--ink); width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: border-color .2s;
}
.iconBtn:hover { border-color: var(--accent); }
.langSel {
  appearance: none; border: 1px solid var(--hair); background: var(--chip);
  color: var(--ink); font: inherit; font-size: 12.5px; padding: 7px 10px;
  border-radius: 999px; cursor: pointer;
}

/* ── מיכל עמוד ── */
.container { max-width: 1180px; margin: 0 auto; width: 100%; padding: 0 20px; }
main { flex: 1; display: flex; flex-direction: column; }

/* ── שער (בית) ── */
.hero { padding: 46px 0 18px; text-align: center; }
.hero .k { font-size: 12px; letter-spacing: .22em; color: var(--muted); }
.hero h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 400; margin-top: 8px; color: var(--ink); }
.hero .underline { width: 34px; height: 2.5px; background: var(--accent); margin: 12px auto 0; }
.hero .sub { margin-top: 12px; font-size: 13px; color: var(--muted); letter-spacing: .04em; }

.chapterGrid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  padding: 26px 0 48px;
}
@media (max-width: 860px) { .chapterGrid { grid-template-columns: 1fr; } }
.chapterCard {
  position: relative; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--card-border); background: var(--card-bg);
  display: flex; flex-direction: column; min-height: 340px;
  transition: transform .25s, border-color .25s;
}
.chapterCard:hover { transform: translateY(-3px); border-color: var(--accent); }
.chapterCard .thumbWrap {
  position: relative; flex: 1; overflow: hidden;
  background: linear-gradient(180deg, var(--wall-lo) 0%, var(--wall-hi) 62%, var(--stone) 62%, var(--stone) 100%);
}
.chapterCard .thumbWrap img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  object-position: center 68%;
}
.chapterCard .info { padding: 16px 18px 20px; }
.chapterCard .ct { font-size: 22px; color: var(--ink); }
.chapterCard .cs { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.chapterCard .cn { margin-top: 10px; font-size: 11px; letter-spacing: .1em; color: var(--accent); }

/* ── עמוד פרק: רשת אריחים ── */
.pageHead { padding: 28px 0 6px; }
.pageHead h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 400; color: var(--ink); }
.pageHead .underline { width: 28px; height: 2.5px; background: var(--accent); margin-top: 8px; }

.subSection { padding: 26px 0 8px; }
.subSection h2 {
  font-size: 13px; font-weight: 500; letter-spacing: .16em; color: var(--muted);
  padding-bottom: 8px; border-bottom: 1px solid var(--hair); margin-bottom: 16px;
}
.tileGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
  padding-bottom: 8px;
}
/* ── פיצול ניווט לגרסאות מסומנות בתוך תת-קבוצה (למשל מסגרת ומילואה H-6: סרגל 15 / סרגל 12) ── */
.variantRow { margin-bottom: 22px; }
.variantRow:last-child { margin-bottom: 0; }
.variantRow .variantTitle {
  font-size: 11px; font-weight: 500; letter-spacing: .14em; color: var(--muted);
  margin-bottom: 12px;
}
.tile {
  border: 1px solid var(--card-border); background: var(--card-bg); border-radius: 12px;
  overflow: hidden; transition: transform .2s, border-color .2s; display: block;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile .tw {
  aspect-ratio: 3 / 4; overflow: hidden; position: relative;
  background: linear-gradient(180deg, var(--wall-lo) 0%, var(--wall-hi) 62%, var(--stone) 62%, var(--stone) 100%);
}
.tile .tw img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile .ti { padding: 9px 11px 11px; }
.tile .tn { font-size: 13.5px; color: var(--ink); text-align: start; overflow-wrap: anywhere; }
.tile .tc { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; direction: ltr; text-align: start; margin-top: 2px; }
.pageFoot { padding: 30px 0 50px; }

/* ── גלריית מפעל (בעמוד הבית) ── */
.factorySection { padding: 8px 0 50px; }
.factorySection .fsTitle { font-size: clamp(20px, 3.4vw, 28px); font-weight: 400; color: var(--ink); }
.factorySection .fsHint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.factoryStrip {
  margin-top: 16px; display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity;
}
.factoryItem {
  flex: 0 0 auto; scroll-snap-align: start; width: 220px; aspect-ratio: 4 / 3;
  border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden;
  background: var(--card-bg); cursor: pointer; padding: 0;
}
.factoryItem img, .factoryItem video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ── עמוד דגם ── */
.modelWrap {
  display: flex; flex-direction: column; flex: 1; min-width: 0;
}
@media (min-width: 860px) {
  .modelWrap { display: grid; grid-template-columns: 1fr 380px; gap: 0 30px; align-items: stretch; }
}
.stage {
  position: relative; min-height: 44dvh; margin-top: 6px; border-radius: 0; min-width: 0;
  overflow: hidden;
}
@media (min-width: 860px) { .stage { min-height: 62dvh; } }
.stage::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--wall-lo) 0%, var(--wall-hi) 58%, var(--wall-hi) 74%, var(--stone) 74%, var(--stone) 100%);
}
.stage model-viewer, .stage .stageImg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  --poster-color: transparent;
}
.stage .stageImg {
  object-fit: contain; padding: 5%; box-sizing: border-box;
  transform-origin: center center; cursor: zoom-in; touch-action: none;
  will-change: transform;
}
/* גודל ברירת מחדל פר-מבט — "1x" של הזום מתייחס לגודל הזה (ר' site.js: initStageZoom) */
.stage .stageImg.view-front { --base-scale: 1; }
.stage .stageImg.view-persp { --base-scale: 1; }
.stage .stageImg.view-section { --base-scale: .55; }

.panel {
  padding-block: 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
/* בדסקטופ (רשת שני-טורים): ריפוד רק בקצה החיצוני, הרחוק מהבמה — הקצה הפנימי כבר מרווח ע"י ה-gap של .modelWrap */
@media (min-width: 860px) {
  .panel { padding-inline: 0 24px; }
}
.panel .fam { font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.nameRow { display: flex; align-items: baseline; gap: 12px; margin-top: 4px; min-width: 0; flex-wrap: wrap; }
.nameRow .name { font-size: 28px; line-height: 1; color: var(--ink); direction: ltr; min-width: 0; overflow-wrap: anywhere; }
.nameRow .code { font-size: 16px; color: var(--ink); font-weight: 500; letter-spacing: .08em; direction: ltr; }
.modelDesc { margin-top: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.panel .underline { width: 34px; height: 2.5px; background: var(--accent); margin-top: 7px; }

.ctlLabel { font-size: 11px; letter-spacing: .14em; color: var(--muted); margin-bottom: 9px; }

/* ── בורר גוון (RAL / עץ) — עיגול + טקסט, בלי גלולות/מסגרות ── */
.colorPicker { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.colorItem {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 2px 0;
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  font: inherit; font-size: 13px; color: var(--ink);
  border-bottom: 1px solid transparent; transition: color .15s, border-color .15s;
}
.colorItem .dot {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}
.colorItem:hover, .colorItem[aria-pressed="true"] { color: var(--accent); }
.colorItem[aria-pressed="true"] { border-bottom-color: var(--accent); }

/* ── לשוניות מדיה: 3D + שלושת המבטים — מחליפות את תוכן הבמה ── */
.mediaTabs { display: flex; gap: 10px; flex-wrap: wrap; min-width: 0; }
.mediaTab {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.mediaTab .mtBox {
  width: 100%; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden;
  background: var(--chip); display: flex; flex-direction: column;
}
.mediaTab .mtBox img { width: 100%; height: 70px; object-fit: contain; padding: 6px; display: block; }
.mediaTab .mt3d { align-items: center; justify-content: center; height: 82px; }
.mediaTab .mt3dIcon { font-size: 14px; font-weight: 600; letter-spacing: .04em; color: var(--ink); }
.mediaTab .vl {
  font-size: 9.5px; letter-spacing: .08em; color: var(--muted); text-align: center;
  padding: 4px 4px 7px; border-top: 1px solid var(--hair); overflow-wrap: anywhere;
}
.mediaTab .mtBar { width: 22px; height: 2px; background: transparent; }
.mediaTab[aria-pressed="true"] .mtBar { background: var(--accent); }
.mediaTab[aria-pressed="true"] .vl { color: var(--accent); }

.specs { border-top: 1.5px solid var(--ink); }
.specs h3 {
  font-size: 10.5px; font-weight: 600; letter-spacing: .18em; color: var(--muted);
  margin: 10px 0 4px;
}
.row { display: flex; justify-content: space-between; gap: 12px; min-width: 0;
       padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.row dt { color: var(--muted); flex: 0 0 auto; }
.row dd { color: var(--ink); font-weight: 500; text-align: end; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.row dd.ltr { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
.matSwatches { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; justify-content: flex-end; }
.matItem { display: inline-flex; align-items: center; gap: 5px; }
.dotSm { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }

.orderRow { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.orderBtn {
  appearance: none; border: 0; border-radius: 999px; cursor: not-allowed;
  background: var(--accent); color: #1a1004; font-weight: 600; font-size: 14px;
  padding: 12px 26px; opacity: .55; position: relative;
}
.orderBtn[data-tip]:hover::after, .orderBtn[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); inset-inline-start: 50%;
  transform: translateX(-50%); background: var(--ink); color: var(--wall-lo);
  font-size: 11px; padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}

/* ── "משתלב עם" (תחתית עמוד ויטרינת עץ) — כרטיס קישור עדין לדגם המסגרת התואם ── */
.pairSection { margin-top: 2px; }
.pairCard {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border: 1px solid var(--hair); border-radius: 10px; transition: border-color .2s;
}
.pairCard:hover { border-color: var(--accent); }
.pairCard .pcThumb {
  width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex: 0 0 auto;
  background: linear-gradient(180deg, var(--wall-lo) 0%, var(--wall-hi) 62%, var(--stone) 62%, var(--stone) 100%);
}
.pairCard .pcThumb img { width: 100%; height: 100%; object-fit: contain; }
.pairCard .pcName { font-size: 13px; color: var(--ink); direction: ltr; overflow-wrap: anywhere; }

/* ── דחיסה אנכית בדסקטופ: העמוד נכנס במסך בלי גלילה גם במסכים נמוכים (בקשת הבעלים 4.9).
   שתי מדרגות לפי גובה החלון — ככל שהמסך נמוך יותר, הריווח והגדלים מצטמצמים. ── */
@media (min-width: 860px) and (max-height: 1020px) {
  .panel { gap: 10px; padding-block: 10px 14px; }
  .nameRow .name { font-size: 24px; }
  .modelDesc { margin-top: 3px; font-size: 12px; }
  .mediaTab .mtBox img { height: 52px; padding: 4px; }
  .mediaTab .mt3d { height: 64px; }
  .row { padding: 5px 0; font-size: 12.5px; }
  .orderBtn { padding: 9px 22px; font-size: 13px; }
  .pnBtn { padding: 7px 10px; }
  .stage { min-height: 56dvh; }
}
@media (min-width: 860px) and (max-height: 870px) {
  .panel { gap: 6px; padding-block: 6px 8px; }
  .panel .fam { font-size: 10px; }
  .nameRow .name { font-size: 20px; }
  .modelDesc { margin-top: 2px; font-size: 11.5px; }
  .panel .underline { margin-top: 3px; }
  .ctlLabel { margin-bottom: 4px; }
  .mediaTab .mtBox img { height: 36px; padding: 3px; }
  .mediaTab .mt3d { height: 46px; }
  .mediaTab .vl { padding: 2px 3px 3px; }
  .row { padding: 3px 0; font-size: 12px; }
  .specs h3 { margin: 5px 0 2px; }
  .orderBtn { padding: 6px 16px; font-size: 12px; }
  .pnBtn { padding: 4px 8px; font-size: 11px; }
  .pairCard { padding: 4px 8px; }
  .pairCard .pcThumb { width: 28px; height: 28px; }
}

.prevNext { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; min-width: 0; }
.pnBtn {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--hair); border-radius: 10px; font-size: 12.5px; color: var(--muted);
  transition: border-color .2s, color .2s;
}
.pnBtn:hover { border-color: var(--accent); color: var(--ink); }
.pnBtn.next { justify-content: flex-end; text-align: end; }
.pnBtn .pnText { min-width: 0; overflow-wrap: anywhere; }
.pnBtn .pnLabel { font-size: 10px; letter-spacing: .08em; opacity: .8; }
.pnBtn span.nm { color: var(--ink); direction: ltr; overflow-wrap: anywhere; }
.pnBtn.disabled { visibility: hidden; }

/* ── לייטבוקס ── */
.lightbox {
  position: fixed; inset: 0; background: rgba(8, 6, 4, .92); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 26px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lbClose {
  position: fixed; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 16px;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(240, 237, 228, .3);
  background: rgba(20, 16, 12, .6); color: #f0ede4; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── פוטר ── */
footer.siteFooter {
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  font-size: 11px; color: var(--muted); border-top: 1px solid var(--hair);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
footer.siteFooter .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-inline-end: 6px;
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .crumbs { order: 3; flex-basis: 100%; padding-inline-start: 0; }
  .viewThumb img { height: 58px; }
}
