:root {
  --bg: #F7F6F4;
  --ink: #242424;
  --muted: #AFAEAD;
  --edge-x: clamp(40px, 6.3vw, 128px);
  --edge-y: clamp(36px, 6.8vh, 86px);
  --rail-w: clamp(220px, 18vw, 330px);
  --number-indent: clamp(70px, 4.55vw, 90px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.contact-page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

.contact-brand {
  position: fixed;
  z-index: 30;
  left: var(--edge-x);
  bottom: var(--edge-y);
  width: clamp(210px, 18vw, 342px);
  line-height: 0;
}
.contact-brand img { display: block; width: 100%; height: auto; }

.contact-rail {
  position: fixed;
  z-index: 40;
  inset: 0 0 0 auto;
  width: var(--rail-w);
  height: 100svh;
  pointer-events: none;
}

.rail-toggle {
  position: absolute;
  top: var(--edge-y);
  right: var(--edge-x);
  width: 56px;
  height: 56px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  display: grid;
  place-items: center;
}
.rail-toggle__glyph {
  position: relative;
  width: 56px;
  height: 56px;
  transition: transform 260ms cubic-bezier(.22,.61,.36,1), opacity 180ms ease;
}
.rail-toggle__glyph::before,
.rail-toggle__glyph::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}
.rail-toggle__glyph::before { width: 54px; height: 1.35px; }
.rail-toggle__glyph::after  { width: 1.35px; height: 54px; }
.rail-toggle.is-open .rail-toggle__glyph { transform: rotate(45deg); }

.contact-nav {
  position: absolute;
  top: clamp(170px, 15vh, 196px);
  right: var(--edge-x);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(10px, 1vh, 16px);
  pointer-events: none;
}
.contact-nav a {
  font-size: clamp(21px, 1.55vw, 33px);
  line-height: 1.08;
  font-weight: 300;
  letter-spacing: .015em;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(38px);
  transition: opacity 180ms ease-out, transform 260ms cubic-bezier(.22,.61,.36,1), color 150ms ease;
  transition-delay: calc(var(--i) * 72ms);
}
.contact-nav.is-open { pointer-events: auto; }
.contact-nav.is-open a { opacity: 1; transform: translateX(0); }
.contact-nav:not(.is-open) a { transition-delay: 0ms; transition-duration: 110ms; }
.contact-nav a.is-current { color: var(--muted); }
.contact-nav a:hover { color: var(--muted); }

.contact-language {
  position: absolute;
  right: var(--edge-x);
  bottom: var(--edge-y);
  display: flex;
  gap: .42em;
  align-items: center;
  font-size: clamp(10px, .68vw, 14px);
  line-height: 1;
  letter-spacing: .03em;
  color: var(--muted);
  pointer-events: auto;
}
.contact-language a:hover { color: var(--ink); }

.contact-content {
  position: relative;
  min-height: 100svh;
  padding: 0 var(--rail-w) 0 var(--edge-x);
}

.contact-identity {
  position: absolute;
  left: calc(var(--edge-x) + var(--number-indent));
  top: clamp(205px, 31.5vh, 320px);
  max-width: min(560px, 43vw);
}
.contact-identity h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(23px, 1.55vw, 32px);
  line-height: 1;
  font-weight: 300;
  letter-spacing: -.025em;
}
.contact-role,
.contact-address {
  margin: 0;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: -.01em;
}
.contact-role {
  margin-top: 8px;
  font-size: clamp(12px, .83vw, 17px);
  line-height: 1.15;
}
.contact-address {
  margin-top: clamp(44px, 5.3vh, 68px);
  font-size: clamp(12px, .83vw, 17px);
  line-height: 1.25;
}

.contact-phone {
  position: absolute;
  left: var(--edge-x);
  top: clamp(395px, 49vh, 500px);
  display: flex;
  align-items: baseline;
  color: var(--ink);
  font-size: clamp(64px, 7.25vw, 116px);
  line-height: .88;
  font-weight: 200;
  letter-spacing: -.052em;
  white-space: nowrap;
  transition: opacity 220ms ease;
}
.contact-phone__plus {
  display: inline-block;
  flex: 0 0 var(--number-indent);
  width: var(--number-indent);
  font-weight: 200;
  letter-spacing: 0;
}
.contact-phone__number { display: inline-block; }
@media (hover: hover) and (pointer: fine) {
  .contact-phone:hover { opacity: .56; }
}
.contact-phone:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 10px;
}

@media (max-width: 1180px) {
  :root {
    --edge-x: 42px;
    --rail-w: 220px;
    --number-indent: 62px;
  }
  .contact-brand { width: 260px; }
  .contact-phone { font-size: clamp(56px, 7vw, 86px); }
  .contact-identity { max-width: 470px; }
}

@media (max-width: 800px) {
  :root {
    --edge-x: 24px;
    --edge-y: 30px;
    --number-indent: 44px;
  }
  .contact-page { overflow: auto; }
  .contact-brand {
    position: absolute;
    width: min(52vw, 260px);
    bottom: auto;
    top: 30px;
  }
  .contact-rail { width: 100%; height: auto; inset: 0 0 auto 0; }
  .rail-toggle { top: 28px; right: 24px; width: 50px; height: 50px; }
  .rail-toggle__glyph { width: 44px; height: 44px; }
  .rail-toggle__glyph::before { width: 42px; }
  .rail-toggle__glyph::after { height: 42px; }
  .contact-nav { top: 92px; right: 24px; gap: 8px; padding: 14px 0; }
  .contact-nav a { font-size: 22px; }
  .contact-language { position: fixed; right: 24px; bottom: 24px; font-size: 11px; }

  .contact-content {
    min-height: 100svh;
    padding: 0 24px 130px;
  }
  .contact-identity {
    position: relative;
    left: 0;
    top: auto;
    padding-top: 190px;
    max-width: 82vw;
  }
  .contact-identity h1 { font-size: 26px; }
  .contact-role, .contact-address { font-size: 13px; }
  .contact-address { margin-top: 42px; }
  .contact-phone {
    position: relative;
    left: 0;
    top: auto;
    margin-top: 72px;
    font-size: clamp(42px, 10vw, 72px);
    line-height: .98;
    white-space: normal;
  }
  .contact-phone__plus { flex-basis: var(--number-indent); width: var(--number-indent); }
}

@media (max-width: 520px) {
  .contact-phone { font-size: 43px; letter-spacing: -.045em; }
  .contact-phone__number { max-width: calc(100vw - 86px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}


/* ================================================================
   MOBILE CONTACT — mockup v1
   ================================================================ */
@media (max-width: 800px) {
  :root {
    --mobile-contact-edge: clamp(22px, 6.35vw, 28px);
    --mobile-contact-toggle-size: 50px;
    --mobile-contact-toggle-top: calc(env(safe-area-inset-top, 0px) + 58px);
  }

  html, body {
    min-height: 100%;
    background: var(--bg);
  }

  .contact-page {
    min-height: 100svh;
    overflow: hidden;
    background: var(--bg);
  }

  /* Header follows the same visual language as the other mobile pages. */
  .contact-brand {
    position: fixed;
    z-index: 42;
    left: var(--mobile-contact-edge);
    top: calc(
      var(--mobile-contact-toggle-top)
      + (var(--mobile-contact-toggle-size) / 2)
    );
    bottom: auto;
    width: min(35vw, 154px);
    transform: translateY(-50%);
  }

  .contact-rail {
    position: fixed;
    z-index: 41;
    inset: 0;
    width: 100%;
    height: 100svh;
    pointer-events: none;
  }

  .rail-toggle {
    position: absolute;
    top: var(--mobile-contact-toggle-top);
    right: var(--mobile-contact-edge);
    width: var(--mobile-contact-toggle-size);
    height: var(--mobile-contact-toggle-size);
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }

  .rail-toggle__glyph {
    width: 44px;
    height: 44px;
  }

  .rail-toggle__glyph::before {
    width: 43px;
    height: 1.25px;
  }

  .rail-toggle__glyph::after {
    width: 1.25px;
    height: 43px;
  }

  .contact-nav {
    top: calc(env(safe-area-inset-top, 0px) + 170px);
    right: var(--mobile-contact-edge);
    gap: clamp(14px, 1.75svh, 18px);
    padding: 0;
    align-items: flex-end;
  }

  .contact-nav a {
    font-size: clamp(19px, 5.15vw, 23px);
    line-height: 1;
    letter-spacing: .01em;
    transform: translateX(30px);
    transition:
      opacity 360ms ease-out,
      transform 520ms cubic-bezier(.22,.61,.36,1),
      color 150ms ease;
    transition-delay: calc(var(--i) * 125ms);
  }

  .contact-nav:not(.is-open) a {
    transition-delay: 0ms;
    transition-duration: 130ms;
  }

  .contact-language {
    display: none;
  }

  /* Important: content is entirely independent of menu state.
     Opening/closing the menu never moves name/address/phone. */
  .contact-content {
    position: relative;
    min-height: 100svh;
    padding: 0;
  }

  .contact-identity {
    position: absolute;
    left: calc(var(--mobile-contact-edge) + 14px);
    top: 51.5svh;
    width: min(74vw, 325px);
    max-width: none;
    padding: 0;
  }

  .contact-identity h1 {
    margin: 0;
    font-size: clamp(22px, 5.65vw, 25px);
    line-height: 1;
    font-weight: 300;
    letter-spacing: -.025em;
  }

  .contact-role {
    margin-top: 7px;
    font-size: clamp(9px, 2.35vw, 10.5px);
    line-height: 1.15;
  }

  .contact-address {
    margin-top: clamp(34px, 4.6svh, 44px);
    font-size: clamp(9px, 2.25vw, 10.2px);
    line-height: 1.22;
    white-space: nowrap;
  }

  .contact-phone {
    position: absolute;
    left: var(--mobile-contact-edge);
    top: 68.7svh;
    margin: 0;
    display: flex;
    align-items: baseline;
    font-size: clamp(35px, 9.15vw, 41px);
    line-height: .95;
    font-weight: 200;
    letter-spacing: -.047em;
    white-space: nowrap;
  }

  .contact-phone__plus {
    flex: 0 0 auto;
    width: auto;
    margin-right: 2px;
  }

  .contact-phone__number {
    max-width: none;
  }

  /* Staggered page-entry: top to bottom, tick-tick-tick. */
  body.contact-entering .contact-identity h1,
  body.contact-entering .contact-role,
  body.contact-entering .contact-address,
  body.contact-entering .contact-phone {
    opacity: 0;
    transform: translateY(-12px);
  }

  body.contact-entering.contact-enter .contact-identity h1,
  body.contact-entering.contact-enter .contact-role,
  body.contact-entering.contact-enter .contact-address,
  body.contact-entering.contact-enter .contact-phone {
    opacity: 1;
    transform: translateY(0);
    transition:
      opacity 330ms ease-out,
      transform 470ms cubic-bezier(.22,.61,.36,1);
  }

  body.contact-entering.contact-enter .contact-identity h1 {
    transition-delay: 150ms;
  }

  body.contact-entering.contact-enter .contact-role {
    transition-delay: 260ms;
  }

  body.contact-entering.contact-enter .contact-address {
    transition-delay: 390ms;
  }

  body.contact-entering.contact-enter .contact-phone {
    transition-delay: 540ms;
  }
}

@media (max-width: 390px) {
  .contact-brand {
    width: min(36vw, 140px);
  }

  .contact-identity {
    left: calc(var(--mobile-contact-edge) + 10px);
  }

  .contact-phone {
    font-size: 35px;
  }
}


/* ================================================================
   MOBILE CONTACT — v2 phone fit
   ================================================================ */
@media (max-width: 800px) {
  .contact-phone {
    /* JS fits this precisely to viewport width; this is only a safe fallback. */
    font-size: clamp(39px, 10.6vw, 49px);
    width: max-content;
    max-width: none;
  }
}

@media (max-width: 390px) {
  .contact-phone {
    font-size: 39px;
  }
}


/* ================================================================
   TABLET LANGUAGE ALIGNMENT
   iPad Pro / Air / Mini, portrait + landscape only.
   Desktop and phones are untouched.
   ================================================================ */
@media (min-width: 700px) and (max-width: 1366px) and (pointer: coarse) {
  .contact-language {
    display: flex !important;
    bottom: var(--tablet-language-bottom) !important;
  }
}


/* ================================================================
   TABLET TR/EN — FIXED PROJECTS-PAGE POSITION
   iPad Pro / Air / Mini, portrait + landscape.
   Desktop and phones untouched.
   ================================================================ */
@media (min-width: 700px) and (max-width: 1366px) {
  .contact-language {
    display: flex !important;
    position: fixed !important;
    z-index: 55;
    top: auto !important;
    transform: none !important;
  }
}

/* mini + Air portrait */
@media (min-width: 700px) and (max-width: 900px) and (orientation: portrait) {
  .contact-language {
    right: clamp(28px, 3.7vw, 34px) !important;
    bottom: calc(clamp(30px, 4.1vh, 38px) * .9) !important;
  }
}

/* mini landscape */
@media (min-width: 700px) and (max-width: 1060px) and (orientation: landscape) {
  .contact-language {
    right: var(--edge-x) !important;
    bottom: calc(var(--edge-y) * .7) !important;
  }
}

/* Air landscape */
@media (min-width: 1061px) and (max-width: 1200px) and (orientation: landscape) {
  .contact-language {
    right: var(--edge-x) !important;
    bottom: var(--edge-y) !important;
  }
}

/* Pro portrait */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .contact-language {
    right: var(--edge-x) !important;
    bottom: calc(var(--edge-y) * .6) !important;
  }
}

/* Pro landscape */
@media (min-width: 1201px) and (max-width: 1366px) and (orientation: landscape) {
  .contact-language {
    right: var(--edge-x) !important;
    bottom: var(--edge-y) !important;
  }
}


/* ================================================================
   GLOBAL TABLET LOGO CONSISTENCY v1
   Exact logo size + position copied from the approved Projects page.
   Applies only to iPad Mini / Air / Pro, portrait + landscape.
   Desktop and phone layouts are untouched.
   ================================================================ */

/* iPad Mini — portrait */
@media (min-width: 700px) and (max-width: 790px) and (orientation: portrait) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: calc(clamp(28px, 3.7vw, 34px) * 1.62) !important;
    bottom: calc(clamp(30px, 4.1vh, 38px) * .9) !important;
    width: clamp(112px, 15.4vw, 126px) !important;
    transform: none !important;
  }
}

/* iPad Air — portrait */
@media (min-width: 791px) and (max-width: 900px) and (orientation: portrait) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: calc(clamp(28px, 3.7vw, 34px) * 1.2) !important;
    bottom: calc(clamp(30px, 4.1vh, 38px) * .9) !important;
    width: clamp(112px, 15.4vw, 126px) !important;
    transform: none !important;
  }
}

/* iPad Pro — portrait */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: calc(clamp(40px, 6.3vw, 128px) * 1.15) !important;
    bottom: calc(clamp(36px, 6.8vh, 86px) * .6) !important;
    width: 210px !important;
    transform: none !important;
  }
}

/* iPad Mini — landscape */
@media (min-width: 700px) and (max-width: 1060px) and (orientation: landscape) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: clamp(40px, 6.3vw, 128px) !important;
    bottom: calc(clamp(36px, 6.8vh, 86px) * .7) !important;
    width: 116px !important;
    transform: none !important;
  }
}

/* iPad Air — landscape */
@media (min-width: 1061px) and (max-width: 1200px) and (orientation: landscape) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: clamp(40px, 6.3vw, 128px) !important;
    bottom: clamp(36px, 6.8vh, 86px) !important;
    width: clamp(116px, 11.25vw, 133px) !important;
    transform: none !important;
  }
}

/* iPad Pro — landscape */
@media (min-width: 1201px) and (max-width: 1366px) and (orientation: landscape) {
  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: clamp(40px, 6.3vw, 128px) !important;
    bottom: clamp(36px, 6.8vh, 86px) !important;
    width: clamp(210px, 18vw, 246px) !important;
    transform: none !important;
  }
}


/* ================================================================
   CONTACT — UNIVERSAL PAGE-ENTRY SEQUENCE
   Desktop + iPad + iPhone.
   ================================================================ */
body.contact-entering .contact-identity h1,
body.contact-entering .contact-role,
body.contact-entering .contact-address,
body.contact-entering .contact-phone {
  opacity: 0;
  translate: 0 -10px;
}

body.contact-entering.contact-enter .contact-identity h1,
body.contact-entering.contact-enter .contact-role,
body.contact-entering.contact-enter .contact-address,
body.contact-entering.contact-enter .contact-phone {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity 300ms ease-out,
    translate 420ms cubic-bezier(.22,.61,.36,1);
}

body.contact-entering.contact-enter .contact-identity h1 {
  transition-delay: 90ms;
}

body.contact-entering.contact-enter .contact-role {
  transition-delay: 200ms;
}

body.contact-entering.contact-enter .contact-address {
  transition-delay: 320ms;
}

body.contact-entering.contact-enter .contact-phone {
  transition-delay: 460ms;
}

@media (prefers-reduced-motion: reduce) {
  body.contact-entering .contact-identity h1,
  body.contact-entering .contact-role,
  body.contact-entering .contact-address,
  body.contact-entering .contact-phone {
    opacity: 1 !important;
    translate: none !important;
    transition: none !important;
  }
}


/* ================================================================
   IPHONE LANDSCAPE v1 — CONTACT
   ================================================================ */
@media (min-width: 700px) and (max-width: 1000px) and (max-height: 560px) and (orientation: landscape) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  .contact-page,
  .contact-content {
    height: 100svh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .contact-brand {
    position: fixed !important;
    top: auto !important;
    left: clamp(40px, 6.3vw, 128px) !important;
    bottom: calc(clamp(36px, 6.8vh, 86px) * .7) !important;
    width: 116px !important;
    transform: none !important;
  }

  /* Menu = Projects reference. */
  .rail-toggle {
    top: 30px !important;
    right: 34px !important;
    width: 52px !important;
    height: 52px !important;
  }

  .rail-toggle__glyph {
    width: 48px !important;
    height: 48px !important;
  }

  .rail-toggle__glyph::before {
    width: 46px !important;
    height: 1.2px !important;
  }

  .rail-toggle__glyph::after {
    width: 1.2px !important;
    height: 46px !important;
  }

  .contact-nav {
    top: 126px !important;
    right: 34px !important;
    gap: 9px !important;
    padding: 0 !important;
  }

  .contact-nav a {
    font-size: 20px !important;
    line-height: 1.08 !important;
    letter-spacing: .015em !important;
  }

  .contact-language {
    display: flex !important;
    position: fixed !important;
    top: auto !important;
    right: 42px !important;
    bottom: calc(clamp(36px, 6.8vh, 86px) * .7) !important;
    font-size: 10px !important;
    transform: none !important;
  }

  /* JS calculates these from the previous layout's own X values. */
  .contact-identity {
    top: var(--iphone-landscape-contact-identity-top, 82px) !important;
  }

  .contact-address {
    margin-top: var(--iphone-landscape-contact-address-gap, 31px) !important;
  }

  .contact-phone {
    top: var(--iphone-landscape-contact-phone-top, 310px) !important;
  }
}
