/* Unity Dental Care — see DESIGN.md for the why behind every value here. */

:root {
  --navy: #0f3351;
  --navy-2: #143e60;
  --navy-deep: #0b2840;
  --teal: #02b0b7;
  --teal-ink: #05747a;
  --mineral: #eef3f2;
  --mineral-2: #e2ebea;
  --ink: #0f3351;
  --muted: #557086;
  --mist: #a9c1cf;
  --line-light: rgba(15, 51, 81, 0.14);
  --line-dark: rgba(238, 243, 242, 0.16);

  --display: "Markazi Text", "Zain", serif;
  --body: "Zain", system-ui, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 20px; --s5: 32px; --s6: 52px; --s7: 84px; --s8: 136px;
  --gutter: clamp(16px, 4.5vw, 72px);
  --bar-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }

body {
  margin: 0;
  background: var(--mineral);
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
html[lang="en"] body { font-size: 18px; line-height: 1.65; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 var(--s3); }
h1, h2, h3 { margin: 0; font-weight: 600; }

.skip { position: absolute; inset-inline-start: var(--s3); top: -60px; z-index: 50; background: var(--teal); color: var(--navy); padding: var(--s2) var(--s3); }
.skip:focus { top: var(--s3); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.h2 {
  font-family: var(--display);
  font-size: clamp(38px, 5.4vw, 72px);
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: var(--s4);
}
html[lang="en"] .h2 { line-height: 1.05; }
.h3 { font-family: var(--display); font-size: clamp(28px, 3vw, 38px); line-height: 1.25; margin-bottom: var(--s2); }
.lede { font-size: clamp(20px, 1.6vw, 23px); line-height: 1.75; color: var(--muted); max-width: 40ch; }
html[lang="en"] .lede { max-width: 46ch; }

.sec-head { padding-inline: var(--gutter); margin-bottom: var(--s6); }

/* ── buttons and links ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 26px;
  border-radius: 999px; text-decoration: none;
  font-weight: 700; font-size: 18px; line-height: 1;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn--teal { background: var(--teal); color: var(--navy-deep); }
.btn--teal:hover { background: #2bc6cc; }
.btn--line { border: 1.5px solid currentColor; color: inherit; }
.btn--line:hover { background: rgba(2, 176, 183, 0.12); }
.link {
  text-decoration: none; font-weight: 700;
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 100% 1.5px;
  padding-bottom: 2px;
  transition: background-size 0.35s var(--ease);
}
html[dir="ltr"] .link { background-position: 0 100%; }
.link:hover { background-size: 0 1.5px; }

/* ── top bar ───────────────────────────────────────────────────── */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: var(--bar-h);
  display: flex; align-items: center; gap: var(--s4);
  padding-inline: var(--gutter);
  color: var(--mineral);
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.bar.is-solid { background: rgba(11, 40, 64, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--line-dark); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand__mark { width: 34px; height: 32px; color: var(--teal); fill: currentColor; flex: none; }
.brand__word { font-family: var(--body); font-weight: 700; font-size: 27px; line-height: 1; letter-spacing: -0.01em; }
.brand__sub { font-size: 14px; color: var(--mist); line-height: 1.2; max-width: 9em; }
.bar__nav { display: flex; gap: var(--s4); margin-inline-start: auto; }
.bar__nav a { text-decoration: none; font-size: 17px; color: var(--mist); transition: color 0.2s; }
.bar__nav a:hover { color: var(--mineral); }
.bar__end { display: flex; align-items: center; gap: var(--s4); }
.bar__lang, .bar__me { text-decoration: none; font-size: 16px; color: var(--mist); }
.bar__lang:hover, .bar__me:hover { color: var(--mineral); }
.bar .btn { min-height: 42px; padding: 0 20px; font-size: 16px; }

@media (max-width: 980px) {
  .bar__nav, .brand__sub { display: none; }
  .bar__end { margin-inline-start: auto; gap: var(--s3); }
}
@media (max-width: 560px) {
  :root { --bar-h: 58px; }
  .bar .btn { display: none; }
  .brand__word { font-size: 24px; }
}

/* ── stage: hero + aligner story ───────────────────────────────── */
/*
 * Without motion (no JS, no WebGL, or reduced motion) this is an ordinary
 * dark section: the hero, then the five chapters in a column, with a still of
 * the finished arch. `.motion` on <html> turns it into the pinned scene.
 */
.stage { background: var(--navy); color: var(--mineral); position: relative; }
.stage__pin { position: relative; padding: calc(var(--bar-h) + var(--s7)) var(--gutter) var(--s7); }
.stage__canvas { display: none; }
.stage__poster { position: absolute; inset: 0 0 auto 0; height: 100svh; overflow: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.stage__poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.32; }
.stage__poster [data-poster-a] { display: none; }

.hero { position: relative; max-width: 620px; margin-bottom: var(--s7); }
.hero__where { color: var(--teal); font-size: 17px; margin-bottom: var(--s3); }
.hero__title {
  font-family: var(--display);
  font-size: clamp(50px, 7.4vw, 108px);
  line-height: 1.12;
  font-weight: 700;
  margin-bottom: var(--s4);
}
html[lang="en"] .hero__title { font-size: clamp(46px, 6vw, 92px); line-height: 0.98; letter-spacing: -0.01em; }
.hero__lede { font-size: clamp(19px, 1.5vw, 22px); color: var(--mist); max-width: 34em; line-height: 1.8; }
html[lang="en"] .hero__lede { line-height: 1.6; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s5); margin-top: var(--s5); }

.chapters { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: var(--s6); max-width: 520px; }
.chapter p { color: var(--mist); }
.chapter__step { color: var(--teal) !important; font-size: 16px; margin-bottom: var(--s1); }
.chapter__title { font-family: var(--display); font-size: clamp(32px, 3.4vw, 48px); line-height: 1.2; margin-bottom: var(--s3); }
.chapter .btn { margin-top: var(--s3); }

.counter, .stage__note { display: none; }

/* motion on: one pinned screen, the canvas behind, one chapter at a time */
.motion .stage__pin { height: 100svh; padding: 0; overflow: hidden; }
.motion .stage__canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.motion .stage__poster { display: none; }
.motion .hero,
.motion .chapters {
  position: absolute;
  inset-inline-start: var(--gutter);
  top: 50%;
  transform: translateY(-46%);
  margin: 0;
  width: min(560px, 40vw);
}
.motion .chapters { display: block; width: min(460px, 34vw); }
.motion .chapter { position: absolute; inset: 0 0 auto 0; transform: translateY(-50%); opacity: 0; visibility: hidden; }
.motion .counter {
  display: flex; align-items: baseline; gap: var(--s3);
  position: absolute; inset-inline-end: var(--gutter); bottom: var(--s6);
  color: var(--mist); font-size: 16px; opacity: 0;
}
.counter__num { font-family: var(--display); font-size: 44px; color: var(--mineral); font-variant-numeric: tabular-nums; }
.counter__num b { font-weight: 600; display: inline-block; min-width: 1.2em; text-align: end; }
.motion .stage__note {
  display: block; position: absolute; inset-inline-start: var(--gutter); bottom: var(--s4);
  font-size: 14px; color: var(--mist); opacity: 0.7; margin: 0; max-width: 40ch;
}

@media (max-width: 820px) {
  /* Phone: the arch sits in the top half, the words in the bottom half. */
  .motion .hero,
  .motion .chapters {
    inset-inline: var(--gutter);
    top: auto; bottom: calc(var(--s6) + env(safe-area-inset-bottom));
    transform: none; width: auto;
  }
  .motion .hero__title { font-size: clamp(44px, 12vw, 64px); }
  .motion .hero__lede { font-size: 18px; }
  .motion .chapter { inset: auto 0 0 0; transform: none; }
  /* The words share the screen with the arch here, so the lower half settles
     into navy behind them instead of printing text over enamel. */
  .motion .stage__pin::after {
    content: ""; position: absolute; inset: 38% 0 0 0; pointer-events: none;
    background: linear-gradient(to bottom, rgba(15, 51, 81, 0), rgba(15, 51, 81, 0.9) 34%, var(--navy) 60%);
  }
  .motion .hero, .motion .chapters, .motion .counter { z-index: 1; }
  .motion .chapter__title { font-size: 31px; }
  .motion .chapter p { font-size: 18px; line-height: 1.75; }
  .motion .counter { top: calc(var(--bar-h) + var(--s4)); bottom: auto; }
  .counter__num { font-size: 34px; }
  .motion .stage__note { display: none; }
}

/* ── Invisalign at Unity ───────────────────────────────────────── */
.invis {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--s6) var(--s7);
  padding: var(--s8) var(--gutter) var(--s7);
}
.invis__text p:not(.lede) { max-width: 46ch; }
.invis__photos { margin: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto auto; gap: var(--s3); align-self: start; }
.invis__photos img { width: 100%; height: 100%; min-width: 0; object-fit: cover; background: var(--mineral-2); }
.invis__a { grid-row: span 2; aspect-ratio: 4 / 5; }
.invis__b, .invis__c { aspect-ratio: 1; }
.invis__photos figcaption { grid-column: 1 / -1; font-size: 15px; color: var(--muted); }
.faq { grid-column: 1 / -1; max-width: 900px; margin-top: var(--s5); }
.faq details { border-top: 1px solid var(--line-light); }
.faq details:last-child { border-bottom: 1px solid var(--line-light); }
.faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--display); font-size: 27px; line-height: 1.4;
  padding: var(--s4) 0; display: flex; justify-content: space-between; gap: var(--s4);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--body); color: var(--teal-ink); transition: transform 0.3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); max-width: 62ch; padding-bottom: var(--s4); }

@media (max-width: 900px) { .invis { grid-template-columns: 1fr; padding-top: var(--s7); } }

/* ── treatments ────────────────────────────────────────────────── */
.treat { padding: var(--s7) 0 var(--s8); background: var(--mineral); position: relative; }
.treat__list { list-style: none; margin: 0; padding: 0 var(--gutter); }
.treat__row {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr);
  gap: var(--s5); align-items: baseline;
  padding: var(--s5) 0; border-top: 1px solid var(--line-light);
  transition: background-color 0.3s var(--ease);
}
.treat__row:last-child { border-bottom: 1px solid var(--line-light); }
.treat__row h3 { font-family: var(--display); font-size: clamp(30px, 3.2vw, 44px); line-height: 1.2; font-weight: 600; transition: color 0.3s var(--ease), transform 0.4s var(--ease); }
.treat__row p { margin: 0; color: var(--muted); }
.treat__who { font-size: 16px; color: var(--teal-ink) !important; }
@media (hover: hover) and (pointer: fine) {
  .treat__row:hover h3 { color: var(--teal-ink); transform: translateX(-10px); }
  html[dir="ltr"] .treat__row:hover h3 { transform: translateX(10px); }
}
.treat__float {
  position: fixed; top: 0; left: 0; z-index: 5; width: 300px; aspect-ratio: 3 / 2; object-fit: cover;
  pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.25s var(--ease);
}
.treat__float[src=""] , .treat__float:not([src]) { display: none; }
@media (max-width: 820px) {
  .treat__row { grid-template-columns: 1fr; gap: var(--s2); }
  .treat__float { display: none; }
}

/* ── before / after ────────────────────────────────────────────── */
.cases { background: var(--navy); color: var(--mineral); padding: var(--s8) 0; }
.cases .lede { color: var(--mist); }
.compare {
  --pos: 50%;
  /* The clinic's photos are about 530px wide and 2:1, so the viewer is sized
     to them rather than blowing them up across the screen. */
  position: relative; margin-inline: auto; width: min(calc(100% - 2 * var(--gutter)), 900px); aspect-ratio: 2 / 1;
  overflow: hidden; background: var(--navy-deep); user-select: none; touch-action: pan-y; cursor: ew-resize;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare__before { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
html[dir="ltr"] .compare__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 44px; margin-left: -22px;
  display: grid; place-items: center; outline-offset: -6px;
}
.compare__handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 21px; width: 2px; background: var(--mineral); }
.compare__handle span { width: 44px; height: 44px; border-radius: 50%; background: var(--mineral); position: relative; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3); }
.compare__handle span::before, .compare__handle span::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0; border: 6px solid transparent; margin-top: -6px;
}
.compare__handle span::before { left: 7px; border-right-color: var(--navy); }
.compare__handle span::after { right: 7px; border-left-color: var(--navy); }
.compare__tag { position: absolute; top: var(--s4); padding: 2px 12px; background: rgba(11, 40, 64, 0.72); font-size: 15px; }
.compare__tag--before { right: var(--s4); }
.compare__tag--after { left: var(--s4); }
html[dir="ltr"] .compare__tag--before { right: auto; left: var(--s4); }
html[dir="ltr"] .compare__tag--after { left: auto; right: var(--s4); }
.cases .sec-head { max-width: calc(900px + 2 * var(--gutter)); margin-inline: auto; }
.cases__pick { display: flex; gap: var(--s2); padding: var(--s4) 0 0; width: min(calc(100% - 2 * var(--gutter)), 900px); margin-inline: auto; overflow-x: auto; scrollbar-width: none; }
.cases__pick::-webkit-scrollbar { display: none; }
.cases__pick button {
  flex: none; text-align: start; font: inherit; color: var(--mist); background: none; cursor: pointer;
  border: 0; border-top: 2px solid var(--line-dark); padding: var(--s3) var(--s2) 0; min-width: 170px;
  transition: color 0.25s, border-color 0.25s;
}
.cases__pick button b { display: block; color: var(--mineral); font-weight: 700; font-size: 18px; line-height: 1.4; }
.cases__pick button span { font-size: 15px; }
.cases__pick button[aria-selected="true"] { border-top-color: var(--teal); }
.cases__pick button:hover b { color: var(--teal); }

/* ── technology ────────────────────────────────────────────────── */
.tech {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s7);
  background: var(--navy-deep); color: var(--mineral); padding: var(--s8) var(--gutter);
  align-items: center;
}
.tech__media img { width: 100%; max-width: 400px; margin-inline: auto; aspect-ratio: 332 / 433; object-fit: cover; }
.tech__list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5) var(--s6); }
.tech__list dt { font-family: var(--display); font-size: 28px; line-height: 1.3; margin-bottom: var(--s1); }
.tech__list dd { margin: 0; color: var(--mist); font-size: 18px; line-height: 1.75; }
.tech__list > div { border-top: 1px solid var(--line-dark); padding-top: var(--s3); }
@media (max-width: 900px) {
  .tech { grid-template-columns: 1fr; gap: var(--s6); }
  .tech__media img { max-width: 300px; }
  .tech__list { grid-template-columns: 1fr; }
}

/* ── the logo's line ───────────────────────────────────────────── */
.mark { background: var(--mineral); padding: var(--s8) var(--gutter); }
.mark__pin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s7); align-items: center; min-height: 70svh; }
.mark__svg { width: min(100%, 520px); justify-self: center; color: var(--teal-ink); overflow: visible; }
.mark__svg path { fill: currentColor; }
.mark__notes { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s4); }
.mark__notes li { color: var(--muted); padding-inline-start: var(--s4); border-inline-start: 2px solid var(--line-light); transition: color 0.4s var(--ease), border-color 0.4s var(--ease); }
.mark__notes b { display: block; font-family: var(--display); font-size: 28px; color: var(--ink); line-height: 1.3; }
.mark__notes li.is-on { border-color: var(--teal); color: var(--ink); }
.mark__src { font-size: 15px; color: var(--muted); }
@media (max-width: 900px) { .mark__pin { grid-template-columns: 1fr; gap: var(--s6); } .mark__svg { width: min(70vw, 360px); } }

/* ── doctors ───────────────────────────────────────────────────── */
.docs { padding: var(--s7) 0 var(--s8); background: var(--mineral-2); }
.lead-doc { display: grid; grid-template-columns: auto 1fr; gap: var(--s6); align-items: start; padding: 0 var(--gutter) var(--s6); max-width: 1100px; }
.lead-doc img { width: 140px; height: 140px; object-fit: cover; border-radius: 50%; filter: saturate(0.85) contrast(1.04); }
.lead-doc__role { color: var(--teal-ink); font-size: 20px; }
.facts { margin: var(--s3) 0 var(--s4); padding-inline-start: 1.1em; color: var(--muted); }
.team { list-style: none; margin: 0; padding: var(--s5) var(--gutter) 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5) var(--s6); border-top: 1px solid var(--line-light); }
.team li { display: grid; grid-template-columns: 76px 1fr; gap: var(--s4); align-items: start; }
.team img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; filter: saturate(0.85); }
.team h3 { font-family: var(--display); font-size: 26px; line-height: 1.3; }
.team p { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 0; }
@media (max-width: 980px) { .team { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .team { grid-template-columns: 1fr; }
  .lead-doc { grid-template-columns: 1fr; gap: var(--s4); }
  .lead-doc img { width: 120px; height: 120px; }
}

/* ── instalments ───────────────────────────────────────────────── */
.pay { padding: var(--s7) var(--gutter); background: var(--teal); color: var(--navy-deep); }
.pay .h2 { margin-bottom: var(--s3); }
.pay .lede { color: var(--navy); max-width: 52ch; }

/* ── visit ─────────────────────────────────────────────────────── */
.visit { display: grid; grid-template-columns: 3fr 2fr; gap: var(--s7); padding: var(--s8) var(--gutter); background: var(--navy); color: var(--mineral); }
.visit__addr { font-style: normal; font-family: var(--display); font-size: clamp(28px, 2.6vw, 36px); line-height: 1.45; margin-bottom: var(--s4); }
.visit__phone a { font-size: 30px; font-weight: 700; text-decoration: none; color: var(--teal); unicode-bidi: isolate; }
.visit__hours { margin: var(--s4) 0 var(--s5); color: var(--mist); }
.visit__hours-line { margin: 0; }
.visit__hours-line--off { opacity: 0.6; }
.visit__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); }
.visit__me { border-inline-start: 1px solid var(--line-dark); padding-inline-start: var(--s6); align-self: start; }
.visit__me p { color: var(--mist); }
@media (max-width: 900px) { .visit { grid-template-columns: 1fr; gap: var(--s6); } .visit__me { border: 0; padding: var(--s5) 0 0; border-top: 1px solid var(--line-dark); } }

/* ── footer ────────────────────────────────────────────────────── */
.foot { background: var(--navy-deep); color: var(--mist); padding: var(--s7) var(--gutter) calc(var(--s6) + 64px); }
.foot__line { font-family: var(--display); color: var(--mineral); font-size: clamp(40px, 6vw, 88px); line-height: 1.2; margin-bottom: var(--s6); }
.foot__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s6); padding: var(--s4) 0; border-top: 1px solid var(--line-dark); }
.foot__row a { text-decoration: none; }
.foot__row .brand { color: var(--mineral); }
.foot__legal { font-size: 13px; line-height: 1.6; opacity: 0.75; max-width: 90ch; margin-top: var(--s3); }

/* ── phone dock ────────────────────────────────────────────────── */
.dock { display: none; }
@media (max-width: 820px) {
  .dock {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr; position: fixed; inset: auto 0 0 0; z-index: 30;
    background: rgba(11, 40, 64, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line-dark); padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(110%); transition: transform 0.45s var(--ease);
  }
  .dock.is-on { transform: none; }
  .dock a { display: grid; place-items: center; min-height: 58px; color: var(--mineral); text-decoration: none; font-weight: 700; font-size: 17px; }
  .dock__main { background: var(--teal); color: var(--navy-deep) !important; }
}

/* ── reveals (motion only; set up by main.js) ──────────────────── */
.word { display: inline-block; }

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