/* ==========================================================
   KIWAN — كيوان
   Carré, filets fins, beaucoup d'air. Aucun coin arrondi.
   ========================================================== */

:root {
  --ivory: #f2ebdf;
  --ink: #1d1a16;
  --gold: #a8823a;
  --gold-light: #c9a45c;
  --night: #16120d;

  --line: rgba(29, 26, 22, 0.16);
  --line-dark: rgba(242, 235, 223, 0.14);
  --muted: rgba(29, 26, 22, 0.62);

  --serif: "Libre Caslon Text", "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --arabic: "Amiri", "Geeza Pro", serif;

  --gutter: clamp(16px, 4vw, 56px);
  --section: clamp(80px, 12vw, 168px);
  --nav-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
ul, ol { list-style: none; margin: 0; padding: 0; }
figure, blockquote { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.eyebrow, .label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}
.label { margin-bottom: 14px; }

.btn {
  display: inline-block;
  padding: 15px 30px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .35s, color .35s, border-color .35s;
}
.btn--light { color: var(--ivory); border-color: rgba(242, 235, 223, .6); }
.btn--light:hover { background: var(--ivory); color: var(--ink); border-color: var(--ivory); }

/* ---------- 1. Menu ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  color: var(--ivory);
  border-bottom: 1px solid transparent;
  transition: background .4s, color .4s, border-color .4s;
}
.nav.is-solid {
  background: rgba(242, 235, 223, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  border-bottom-color: var(--line);
}
.nav__brand { display: flex; align-items: baseline; gap: 14px; text-decoration: none; }
.nav__latin { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: .08em; }
.nav__arabic { font-family: var(--arabic); font-size: 24px; line-height: 1; color: var(--gold-light); }
.nav.is-solid .nav__arabic { color: var(--gold); }
.nav__links { display: flex; gap: clamp(20px, 3vw, 44px); }
.nav__links a {
  font-size: 12px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase;
  text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav__links a:hover, .nav__links a.is-current { border-bottom-color: currentColor; }
.nav__toggle { display: none; width: 44px; height: 44px; position: relative; }
.nav__toggle span:not(.sr-only) {
  position: absolute; left: 11px; right: 11px; height: 1px; background: currentColor;
  transition: transform .3s, top .3s;
}
.nav__toggle span:nth-child(1) { top: 18px; }
.nav__toggle span:nth-child(2) { top: 25px; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { top: 22px; transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { top: 22px; transform: rotate(-45deg); }

@media (max-width: 760px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--ivory); color: var(--ink);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .3s, transform .3s;
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: 20px var(--gutter); border-top: 1px solid var(--line); border-bottom: 0; }
  .nav.menu-open { background: var(--ivory); color: var(--ink); border-bottom-color: var(--line); }
  .nav.menu-open .nav__arabic { color: var(--gold); }
}

/* ---------- 2. Hero ---------- */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 560px;
  overflow: hidden; background: var(--night); color: var(--ivory);
  display: grid; place-items: center; text-align: center;
}
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(22,18,13,.55) 0%, rgba(22,18,13,.15) 35%, rgba(22,18,13,.25) 65%, rgba(22,18,13,.85) 100%);
}
.hero__content { position: relative; padding: 0 var(--gutter); display: grid; justify-items: center; }
.hero__content .eyebrow { color: var(--gold-light); margin-bottom: 26px; }
.hero__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(72px, 17vw, 232px);
  line-height: .9; letter-spacing: .1em; margin-right: -.1em;
}
.hero__arabic {
  font-family: var(--arabic); font-weight: 400;
  font-size: clamp(64px, 13vw, 172px);
  line-height: 1.15; color: var(--gold-light);
}
.hero__sub { max-width: 30em; margin: 18px 0 38px; font-size: 15px; letter-spacing: .04em; color: rgba(242,235,223,.82); }
.hero__scroll {
  position: absolute; bottom: 28px; left: 50%; width: 1px; height: 56px;
  background: linear-gradient(var(--gold-light), transparent);
  animation: drip 2.4s ease-in-out infinite;
}
@keyframes drip { 0%,100% { transform: scaleY(.4); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } }

/* ---------- Sections ---------- */
.section { padding: var(--section) var(--gutter); }
.section__head { max-width: 1320px; margin: 0 auto clamp(40px, 6vw, 80px); }
.section__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(34px, 5vw, 64px); line-height: 1.1;
  margin-top: 18px; letter-spacing: -.005em;
}
.section__lead { max-width: 36em; margin-top: 24px; color: var(--muted); }

/* ---------- 3. Collection ---------- */
.collection__grid {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
}
.stage {
  position: relative; aspect-ratio: 1 / 1; background: var(--night);
  background-image: radial-gradient(circle at 50% 42%, #2a2218 0%, var(--night) 62%);
  overflow: hidden;
}
.stage canvas { width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.stage canvas:active { cursor: grabbing; }
.stage__fallback { position: absolute; inset: 10% 30%; width: 40%; height: 80%; object-fit: contain; }
.stage__hint {
  position: absolute; left: 0; right: 0; bottom: 22px; text-align: center;
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(242,235,223,.5); pointer-events: none; transition: opacity .6s;
}
.stage__hint.is-hidden { opacity: 0; }

.detail { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: 22px 8px;
  font-family: var(--serif); font-size: 17px; letter-spacing: .06em;
  color: var(--muted); transition: color .3s, background .3s;
}
.tab + .tab { border-left: 1px solid var(--line); }
.tab::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px;
  background: var(--juice); vertical-align: 1px;
}
.tab::after {
  content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 2px;
  background: var(--ink); transform: scaleX(0); transition: transform .4s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); background: rgba(255,255,255,.35); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

.detail__panel { flex: 1; display: grid; grid-template-rows: auto 1fr; transition: opacity .35s; }
.detail__panel.is-fading { opacity: 0; }
.detail__text { padding: clamp(28px, 4vw, 52px); border-bottom: 1px solid var(--line); }
.detail__family { font-size: 12px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.detail__name { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1.05; margin: 10px 0 18px; }
.detail__desc { color: var(--muted); max-width: 34em; }
.detail__specs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.detail__specs li {
  font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  padding: 7px 11px; border: 1px solid var(--line);
}

.detail__visuals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .42fr); }
.detail__notes { padding: clamp(24px, 3vw, 40px); }
.note-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.note-row li { min-width: 0; }
.note-row img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #000; }
.note-row span { display: block; margin-top: 8px; font-size: 13px; line-height: 1.3; }
.detail__box {
  border-left: 1px solid var(--line); padding: 20px;
  display: grid; place-items: center; background: rgba(255,255,255,.25);
}
.detail__box img { max-height: 340px; width: auto; box-shadow: 0 18px 40px -22px rgba(29,26,22,.5); }

@media (max-width: 960px) {
  .collection__grid { grid-template-columns: 1fr; }
  .stage { aspect-ratio: 1 / 1; max-height: 80vh; }
  .detail { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .tab { font-size: 14px; padding: 18px 4px; }
  .tab::before { display: block; margin: 0 auto 8px; }
  .detail__visuals { grid-template-columns: 1fr; }
  .detail__box { border-left: 0; border-top: 1px solid var(--line); }
  .detail__box img { max-height: 280px; }
  .note-row { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 4. Bibliothèque des notes ---------- */
.notes { background: var(--night); color: var(--ivory); }
.notes .section__title { color: var(--ivory); }
.notes .eyebrow { color: var(--gold-light); }
.filters {
  max-width: 1320px; margin: 0 auto 32px;
  display: grid; grid-auto-flow: column; gap: 1px; width: fit-content;
  background: var(--line-dark); border: 1px solid var(--line-dark);
}
.filter {
  padding: 13px 22px; font-size: 12px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: rgba(242,235,223,.6);
  background: var(--night); transition: background .3s, color .3s;
}
.filter:hover { color: var(--ivory); }
.filter.is-active { background: var(--ivory); color: var(--ink); }

.library {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--line-dark); border: 1px solid var(--line-dark);
}
.library li { background: var(--night); position: relative; transition: opacity .4s; }
.library li.is-dim { opacity: .14; }
.library li.is-hidden { display: none; }
.library img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #000; transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.library figure { overflow: hidden; }
.library li:hover img { transform: scale(1.05); }
.library__cap { padding: 18px 20px 22px; border-top: 1px solid var(--line-dark); }
.library__cap h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; }
.library__cap p { margin-top: 6px; font-size: 13px; color: rgba(242,235,223,.55); line-height: 1.5; }
.library__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.library__tags span {
  font-size: 10px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid var(--line-dark); color: var(--gold-light);
}
@media (max-width: 960px) { .library { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .library { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library__cap { padding: 14px 14px 16px; }
  .library__cap h3 { font-size: 18px; }
  .filters { width: 100%; grid-auto-flow: row; grid-template-columns: repeat(6, 1fr); }
  .filter { grid-column: span 2; padding: 13px 6px; letter-spacing: .16em; font-size: 11px; }
  .filter:nth-child(n+4) { grid-column: span 3; }
}

/* ---------- 5. L'écrin ---------- */
.boxes {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
}
.box-cell {
  position: relative; display: grid; justify-items: center; align-content: start;
  padding: clamp(36px, 5vw, 64px) 12px 28px; perspective: 1400px;
  text-align: center; cursor: pointer;
}
.box-cell + .box-cell { border-left: 1px solid var(--line); }
.box-cell:hover { background: rgba(255,255,255,.3); }

.box3d {
  --w: clamp(96px, 10vw, 140px);
  --h: calc(var(--w) * 2.48);
  --d: calc(var(--h) * .2368);
  position: relative; width: var(--w); height: var(--h);
  transform-style: preserve-3d;
  transform: rotateX(-6deg) rotateY(-28deg);
  transition: transform 1.1s cubic-bezier(.2,.7,.2,1);
}
.box-cell:hover .box3d, .box-cell:focus-visible .box3d {
  animation: spin 6s linear infinite;
}
@keyframes spin {
  from { transform: rotateX(-6deg) rotateY(-28deg); }
  to   { transform: rotateX(-6deg) rotateY(332deg); }
}
@media (prefers-reduced-motion: reduce) {
  .box-cell:hover .box3d { animation: none; transform: rotateX(-6deg) rotateY(28deg); }
}
.box3d__face {
  position: absolute; left: 50%; top: 50%;
  background-size: 100% 100%; background-color: var(--ivory);
  backface-visibility: hidden;
}
.box3d__face--front, .box3d__face--back {
  width: var(--w); height: var(--h); margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
}
.box3d__face--front { transform: translateZ(calc(var(--d) / 2)); }
.box3d__face--back  { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.box3d__face--left, .box3d__face--right {
  width: var(--d); height: var(--h); margin: calc(var(--h) / -2) 0 0 calc(var(--d) / -2);
  background-image: url("../images/boites/cote.jpg");
}
.box3d__face--right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); filter: brightness(.9); }
.box3d__face--left  { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); filter: brightness(.82); }
.box3d__face--top, .box3d__face--bottom {
  width: var(--w); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--w) / -2);
  background: #e9dfcd; box-shadow: inset 0 0 0 2px var(--gold-light);
}
.box3d__face--top    { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); }
.box3d__face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }
.box-cell__shadow {
  width: calc(var(--w, 120px) * 1.3); height: 18px; margin-top: 22px;
  background: radial-gradient(ellipse at center, rgba(29,26,22,.28), transparent 70%);
}
.box-cell h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin-top: 18px; }
.box-cell p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.box-cell__cta {
  margin-top: 16px; font-size: 11px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); border-bottom: 1px solid currentColor; padding-bottom: 2px;
}

@media (max-width: 960px) {
  .boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .box-cell:nth-child(3) { border-left: 0; }
  .box-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 420px) { .box3d { --w: 92px; } }

/* ---------- 6. La Maison ---------- */
.maison { border-top: 1px solid var(--line); }
.maison__grid {
  max-width: 1320px; margin: 0 auto;
  display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line);
  grid-template-columns: 1.15fr .85fr .85fr;
  grid-template-areas:
    "text a b"
    "quote quote quote";
}
.maison__grid > * { background: var(--ivory); }
.maison__text { grid-area: text; padding: clamp(32px, 4vw, 60px); }
.pillars { margin-top: 40px; display: grid; gap: 0; }
.pillars li { display: grid; grid-template-columns: 44px 1fr; column-gap: 12px; padding: 20px 0; border-top: 1px solid var(--line); }
.pillars__n { font-family: var(--serif); color: var(--gold); font-size: 14px; padding-top: 4px; grid-row: span 2; }
.pillars h3 { font-family: var(--serif); font-weight: 400; font-size: 21px; line-height: 1.3; }
.pillars p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.maison__photo { overflow: hidden; background: var(--night); }
.maison__photo img { width: 100%; height: 100%; object-fit: cover; min-height: 420px; }
.maison__photo--a { grid-area: a; }
.maison__photo--b { grid-area: b; }
.maison__quote {
  grid-area: quote; background: var(--night) !important; color: var(--ivory);
  padding: clamp(56px, 8vw, 120px) var(--gutter); text-align: center;
}
.maison__quote p {
  font-family: var(--serif); font-style: italic; font-size: clamp(24px, 3.4vw, 44px);
  line-height: 1.35; max-width: 24em; margin: 0 auto;
}
.maison__quote footer { font-family: var(--arabic); font-size: 34px; color: var(--gold-light); margin-top: 28px; }

@media (max-width: 960px) {
  .maison__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "text text" "a b" "quote quote";
  }
  .maison__photo img { min-height: 0; aspect-ratio: 3 / 4; }
}
@media (max-width: 520px) {
  .maison__grid { grid-template-columns: 1fr; grid-template-areas: "text" "a" "b" "quote"; }
}

/* ---------- 7. Footer ---------- */
.footer { background: var(--night); color: rgba(242,235,223,.72); padding: clamp(64px, 8vw, 110px) var(--gutter) 36px; font-size: 14px; }
.footer > * { max-width: 1320px; margin-left: auto; margin-right: auto; }
.footer__brand { display: flex; align-items: baseline; gap: 18px; padding-bottom: 40px; border-bottom: 1px solid var(--line-dark); }
.footer__latin { font-family: var(--serif); font-size: clamp(36px, 6vw, 64px); color: var(--ivory); letter-spacing: .08em; }
.footer__arabic { font-family: var(--arabic); font-size: clamp(36px, 6vw, 60px); color: var(--gold-light); }
.footer__cols { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line-dark); }
.footer__cols > div { padding: 32px 32px 36px 0; }
.footer__cols > div + div { padding-left: 32px; border-left: 1px solid var(--line-dark); }
.footer .label { color: var(--gold-light); }
.footer__legal { padding-top: 28px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: rgba(242,235,223,.5); }
@media (max-width: 760px) {
  .footer__cols { grid-template-columns: 1fr; }
  .footer__cols > div, .footer__cols > div + div { padding: 24px 0; border-left: 0; }
  .footer__cols > div + div { border-top: 1px solid var(--line-dark); }
}

/* ---------- Apparition ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s, transform 1s cubic-bezier(.2,.7,.2,1); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
