/* IBX Labs — the house.
   Lacquer and bone; gilt only as hairline and as light.
   One family (Bodoni Moda, optical sizes), Aref Ruqaa for the Arabic. */

:root {
  --bone: #efe5d0;
  --bone-2: rgba(239, 229, 208, 0.78);
  --bone-3: rgba(239, 229, 208, 0.56);
  --gilt: #d7b089;
  --gilt-line: rgba(218, 180, 140, 0.66);
  --gilt-dim: rgba(218, 180, 140, 0.28);
  --lacquer: #1e0507;
  --serif: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --arabic: "Aref Ruqaa", "Amiri", serif;
  --gutter: clamp(18px, 4.6vw, 72px);
  --mast: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--lacquer);
  color: var(--bone);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 19px;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: rgba(215, 176, 137, 0.34); color: var(--bone); }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--gilt); outline-offset: 5px; border-radius: 1px; }
p, h1, h2, h3, figure { margin: 0; }
h1, h2, h3 { font-weight: 400; }

#sky {
  position: fixed; inset: 0 auto auto 0;
  width: 100%; height: 100vh; height: 100lvh;
  display: block; z-index: 0;
}
.no-gl body {
  background:
    radial-gradient(120% 80% at 30% 10%, #5a0c12 0%, transparent 60%),
    radial-gradient(100% 70% at 70% 90%, #3d080c 0%, transparent 65%),
    #1e0507;
}
.no-gl #sky { display: none; }
main, .mast { position: relative; z-index: 1; }

/* ───────── masthead ───────── */
.mast {
  position: fixed; inset: 0 0 auto 0; height: var(--mast); z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background-color 0.6s ease, border-color 0.6s ease, opacity 1.2s ease 0.3s;
}
.past-dawn .mast {
  background: rgba(22, 4, 6, 0.46);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  border-bottom-color: var(--gilt-dim);
}
.mast-home { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; justify-self: start; }
.mast-mark { width: 24px; height: 24px; display: block; }
.mast-mark svg { width: 100%; height: 100%; display: block; }
.mast-name { font-size: 16px; font-weight: 500; letter-spacing: 0.05em; }

.dial { position: relative; width: 120px; height: 52px; display: grid; justify-items: center; }
.dial svg { width: 120px; height: 36px; overflow: visible; }
.dial-arc { fill: none; stroke: var(--gilt-line); stroke-width: 0.8; stroke-dasharray: 1.2 2.6; }
.dial-ground { fill: none; stroke: var(--gilt-dim); stroke-width: 0.8; }
.dial-ticks circle { fill: var(--gilt-line); }
.dial-sun { fill: var(--bone); filter: drop-shadow(0 0 3px rgba(255, 214, 170, 0.8)); }
.dial-hour { font-style: italic; font-size: 13px; line-height: 1; color: var(--bone-2); margin-top: -1px; }
.dial-stops { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.dial-stops li { position: absolute; width: 18px; height: 18px; transform: translate(-50%, -50%); }
.dial-stops li:nth-child(1) { left: 8.3%; top: 57.7%; }
.dial-stops li:nth-child(2) { left: 20.5%; top: 27.7%; }
.dial-stops li:nth-child(3) { left: 50%; top: 15.4%; }
.dial-stops li:nth-child(4) { left: 79.5%; top: 27.7%; }
.dial-stops li:nth-child(5) { left: 91.7%; top: 57.7%; }
.dial-stops a {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  font-size: 0; color: transparent;
}
.dial-stops a:hover { background: radial-gradient(circle, rgba(239, 229, 208, 0.25) 0 35%, transparent 60%); }

.mast-write {
  justify-self: end; font-style: italic; font-size: 16px; color: var(--bone-2); text-decoration: none;
  border-bottom: 1px solid var(--gilt-dim); padding-bottom: 1px; transition: color 0.3s, border-color 0.3s;
}
.mast-write:hover { color: var(--bone); border-bottom-color: var(--gilt); }

/* ───────── I · the vestibule ───────── */
.vestibule {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: end;
  padding: calc(var(--mast) + 2vh) var(--gutter) 11vh;
}
.crest {
  width: min(60vh, 86vw, 680px); aspect-ratio: 1; align-self: center;
  position: relative; cursor: default;
}
.crest-fallback { display: none; position: absolute; inset: 0; }
.crest-fallback svg { width: 100%; height: 100%; }
.no-gl .crest-fallback { display: block; }
.title { text-align: center; margin-top: 1vh; }
.wordmark {
  font-size: clamp(44px, 5.4vw, 74px); line-height: 1; font-weight: 500;
  letter-spacing: 0.04em; font-variation-settings: "opsz" 96;
}
.wordmark span { font-style: italic; font-weight: 400; letter-spacing: 0.01em; }
.house-line { font-style: italic; font-size: clamp(19px, 1.6vw, 23px); color: var(--bone-2); margin-top: 16px; }
.kind { font-size: 14.5px; letter-spacing: 0.07em; color: var(--bone-3); margin-top: 10px; }
.crest-caption {
  position: absolute; left: 50%; bottom: 5.4vh; transform: translateX(-50%);
  font-style: italic; font-size: 14px; color: var(--bone-2); white-space: nowrap;
  opacity: 0; transition: opacity 0.9s ease;
}
.crest-caption.on { opacity: 1; }

/* the one entrance */
.entering .mast { opacity: 0; }
.entering .title > * { opacity: 0; }
.entering .wordmark { letter-spacing: 0.34em; }
.title > * {
  transition: opacity 1.4s ease, letter-spacing 2.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.entered .house-line { transition-delay: 0.35s; }
.entered .kind { transition-delay: 0.6s; }

/* ───────── rooms ───────── */
.room {
  position: relative;
  display: grid;
  grid-template-columns: [folio] minmax(110px, 1fr) [body] minmax(0, 5fr) [end] minmax(0, 1.1fr) [edge];
  column-gap: clamp(24px, 4vw, 72px);
  padding: clamp(110px, 18vh, 220px) var(--gutter);
}
.room > :not(.folio) { grid-column: body / edge; }
.folio {
  grid-column: folio; grid-row: 1 / span 2; align-self: start;
  display: grid; justify-items: start; gap: 4px;
}
.numeral { font-size: 60px; line-height: 1; color: var(--gilt); font-weight: 500; font-variation-settings: "opsz" 24; letter-spacing: 0.02em; }
.hour { font-style: italic; font-size: 16px; color: var(--bone-3); }

/* II · manifesto */
.manifesto { max-width: 17em; font-size: clamp(27px, 3.2vw, 48px); line-height: 1.17; letter-spacing: -0.018em; }
.manifesto p + p { margin-top: 0.85em; }
.manifesto p:not(.lead) { color: var(--bone-2); }
.manifesto .lead { font-size: 1.28em; line-height: 1.1; color: var(--bone); }
.settle-word { display: inline-block; white-space: nowrap; }
.settle-word span { display: inline-block; will-change: transform; }

.declaration {
  position: relative; text-align: center;
  padding: clamp(60px, 10vh, 140px) var(--gutter) clamp(120px, 20vh, 240px);
}
.wings { width: min(1000px, 94vw); margin: 0 auto clamp(40px, 7vh, 80px); }
.wings svg { width: 100%; height: auto; display: block; overflow: visible; }
.declaration h2 { font-size: clamp(40px, 7.3vw, 128px); line-height: 1.02; letter-spacing: -0.024em; }
.declaration .d1, .declaration .d2 { display: block; text-wrap: balance; }
.declaration .d2 { font-style: italic; margin-top: 0.06em; }

/* III · atelier */
.atelier-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: clamp(32px, 6vw, 96px); align-items: center;
}
.maher {
  font-family: var(--arabic); font-size: clamp(104px, 12vw, 188px); line-height: 1.05;
  text-align: left; color: var(--bone);
  transition: color 1.4s ease, text-shadow 1.4s ease;
}
.maher-lit .maher { color: var(--gilt); text-shadow: 0 0 28px rgba(230, 186, 140, 0.45), 0 0 2px rgba(255, 230, 200, 0.6); }
.def { font-style: italic; font-size: 21px; color: var(--bone-2); margin-top: 6px; }
.def i { font-style: normal; color: var(--bone); font-weight: 500; font-variation-settings: "opsz" 8; }
.about { margin-top: 30px; max-width: 32em; color: var(--bone-2); line-height: 1.62; }

.instrument { display: grid; justify-items: center; gap: 18px; }
.instrument canvas { width: min(100%, 460px); aspect-ratio: 1; display: block; cursor: pointer; }
.instrument figcaption { display: grid; justify-items: center; gap: 6px; text-align: center; min-height: 86px; }
.inst-title { font-style: italic; font-size: 19px; }
.readout { font-size: 15px; color: var(--bone-2); display: flex; gap: 20px; font-variant-numeric: tabular-nums lining-nums; }
.readout .kn { font-style: italic; color: var(--bone); }
.again {
  font: italic 15px/1.4 var(--serif); color: var(--bone-2); background: none; border: 0; padding: 2px 0;
  border-bottom: 1px solid var(--gilt-dim); cursor: pointer;
}
.again:hover { color: var(--bone); border-bottom-color: var(--gilt); }

.colonnade { grid-column: folio / edge !important; margin-top: clamp(90px, 16vh, 180px); }
.colonnade svg, .cortex svg { width: 100%; height: auto; display: block; }
.colonnade figcaption { text-align: center; font-style: italic; font-size: 18px; color: var(--bone-2); margin-top: 22px; }

.faculties {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 64px);
  margin-top: clamp(80px, 13vh, 150px);
}
.faculty h3 { font-size: 27px; line-height: 1.2; letter-spacing: -0.01em; padding-top: 20px; border-top: 1px solid var(--gilt-dim); }
.faculty p { font-size: 17.5px; line-height: 1.58; color: var(--bone-2); margin-top: 12px; max-width: 22em; }

/* IV · the house */
.founding { font-size: clamp(28px, 3.6vw, 56px); line-height: 1.14; max-width: 16em; letter-spacing: -0.018em; }
.founding p + p { margin-top: 0.7em; }
.founding .f2 { color: var(--bone-2); }
.founding .f3 { font-style: italic; }
.cortex { grid-column: folio / edge !important; margin-top: clamp(70px, 12vh, 150px); }
.cortex figcaption { text-align: center; font-style: italic; font-size: 18px; color: var(--bone-2); margin-top: 20px; }

/* V · dusk */
.letter { padding-bottom: 0; }
.room.dusk { padding-bottom: clamp(60px, 10vh, 120px); }
.write { font-size: clamp(42px, 6.8vw, 116px); line-height: 1.02; letter-spacing: -0.026em; max-width: 11.5em; text-wrap: balance; }
.email {
  display: inline-block; margin-top: clamp(40px, 8vh, 90px);
  font-size: clamp(26px, 3.3vw, 50px); font-style: italic; text-decoration: none; line-height: 1.25;
  background: linear-gradient(var(--gilt), var(--gilt)) no-repeat 0 100% / 0% 1px,
              linear-gradient(var(--gilt-dim), var(--gilt-dim)) no-repeat 0 100% / 100% 1px;
  transition: background-size 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: 4px;
}
.email:hover, .email:focus-visible { background-size: 100% 1px, 100% 1px; }
.open { margin-top: 22px; font-size: 17px; color: var(--bone-3); }

/* colophon */
.colophon { text-align: center; padding: clamp(40px, 6vh, 80px) var(--gutter) clamp(60px, 9vh, 110px); }
.seal { width: min(230px, 62vw); margin: 0 auto clamp(40px, 7vh, 70px); }
.seal svg { width: 100%; height: auto; display: block; overflow: visible; }
.sign { font-family: var(--arabic); font-size: 36px; line-height: 1.4; color: var(--bone-2); }
.sign-en { font-style: italic; font-size: 16px; color: var(--bone-3); margin-top: 4px; }
.imprint { margin-top: 36px; font-size: 12.5px; letter-spacing: 0.1em; color: var(--bone-3); }

/* ───────── engraving ───────── */
.eng path, .eng circle {
  fill: none; stroke: var(--gilt-line); stroke-width: 0.85;
  vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round;
}
.eng .dim { stroke-opacity: 0.6; }
.eng .faint { stroke-opacity: 0.36; }
.eng .dots { stroke-width: 2.4; stroke-opacity: 0.7; }
.eng .layer { stroke-opacity: 0.22; stroke-dasharray: 2 5; }
.eng .axon { stroke-opacity: 0.5; stroke-width: 0.5; }
.eng .stipple { stroke-width: 1.5; stroke-opacity: 0.26; }
.soma path, .soma circle { fill: var(--gilt); stroke: none; }
.spark circle { fill: var(--bone); filter: drop-shadow(0 0 3px rgba(255, 226, 190, 0.95)); }
.layer-label { font-family: var(--serif); font-style: italic; font-size: 14px; fill: var(--bone-3); }
.eng .rose { stroke-opacity: 0.5; stroke-width: 0.55; }
.eng.lit path { stroke: var(--gilt); stroke-width: 1.15; stroke-opacity: 1; }
.eng.lit .pulse { stroke: var(--bone); stroke-width: 1.3; transition: opacity 0.3s; }
.mark-gilt, .mark-gilt * { fill: var(--gilt); stroke: none; }
.mark-dim, .mark-dim * { fill: var(--gilt-line); stroke: none; }
.mark-solid, .mark-solid * { fill: var(--bone); stroke: none; }
.capital-sun * { fill: var(--gilt-line); stroke: none; }
.capital-sun { opacity: 0.5; transition: opacity 0.6s ease, filter 0.6s ease; }
.capital-sun.on { opacity: 1; filter: drop-shadow(0 0 5px rgba(240, 196, 150, 0.75)); }
.capital-sun.on * { fill: var(--gilt); }
.seal-text { font-family: var(--serif); font-size: 11.5px; letter-spacing: 0.16em; fill: var(--gilt); }

/* ───────── narrow screens ───────── */
@media (max-width: 900px) {
  .atelier-body { grid-template-columns: 1fr; }
  .instrument { margin-top: 20px; }
  .faculties { grid-template-columns: 1fr; gap: 36px; }
}
@media (max-width: 760px) {
  :root { --mast: 58px; }
  body { font-size: 18px; }
  .mast { grid-template-columns: 1fr auto; }
  .mast-write { display: none; }
  .dial { justify-self: end; transform: scale(0.86); transform-origin: right center; }
  .room { grid-template-columns: minmax(0, 1fr); padding: 96px var(--gutter); }
  .room > :not(.folio), .colonnade, .cortex { grid-column: 1 / -1 !important; }
  .folio { grid-column: 1 / -1; grid-row: auto; display: flex; align-items: baseline; gap: 14px; margin-bottom: 30px; }
  .numeral { font-size: 44px; }
  .vestibule { padding-bottom: 16vh; }
  .crest { width: min(88vw, 52vh); }
  .crest-caption { bottom: 11vh; }
  .write { max-width: none; }
  .email { font-size: clamp(22px, 7vw, 30px); }
}
