:root {
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --pill-bg: rgba(0, 0, 0, 0.42);
  --pill-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Hero / grid */
.hero {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.hero.dragging { cursor: grabbing; }

.grid {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #111;
  will-change: transform;
  /* contain layout/paint helps the compositor */
  contain: layout paint size style;
}

.tile img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* ---------- Initial entrance animation ---------- */
/* Tiles created during the first render carry `.entering`. They start
   slightly above their final spot and invisible. Adding `.entered`
   triggers an eased fade + settle, delayed per-tile via --enter-delay
   so the wave sweeps from top-left to bottom-right. */
.tile.entering img {
  opacity: 0;
  transform: translateY(-22px);
  transition: opacity 700ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--enter-delay, 0ms),
              transform 800ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--enter-delay, 0ms);
}
.tile.entering.entered img {
  opacity: 1;
  transform: translateY(0);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -6px);
  opacity: 0;
  transition: opacity 700ms ease-out 150ms,
              transform 800ms cubic-bezier(0.2, 0.7, 0.2, 1) 150ms;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none; /* children re-enable */
}
body.loaded .navbar {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px 10px 20px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  color: var(--fg);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand {
  font-weight: 500;
  white-space: nowrap;
}

.burger {
  background: transparent;
  border: 0;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  cursor: pointer;
}
.burger:hover { background: rgba(255,255,255,0.06); }
.burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 220ms ease, opacity 180ms ease;
}
.navbar.open .burger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.navbar.open .burger span:nth-child(2) { opacity: 0; }
.navbar.open .burger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.menu {
  pointer-events: none;
  margin-top: 10px;
  min-width: 200px;
  padding: 8px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 18px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.7,.2,1);
}
.navbar.open .menu {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.menu a {
  display: block;
  padding: 10px 14px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  border-radius: 12px;
  letter-spacing: 0.01em;
  transition: background 140ms ease;
}
.menu a:hover { background: rgba(255,255,255,0.07); }

@media (max-width: 540px) {
  .pill { font-size: 13px; padding: 9px 12px 9px 16px; gap: 12px; }
}

/* ============================================================
   Detail / project view
   ============================================================ */
:root {
  --detail-margin: 32px;
  --detail-card-bg: #151515;
  --detail-divider: #404040;
  --detail-body: #C7C7C7;
  --ease-elegant: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.detail {
  position: fixed;
  inset: 0;
  z-index: 5; /* below navbar (z=10), above hero */
  display: none;
  pointer-events: none;
}
.detail.open { display: block; pointer-events: auto; }

/* Left card — flush to top/left/bottom of the viewport */
.detail-card {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 2; /* sits above the image during the wipe transition */
  /* width set inline by JS so it leaves a margin-sized gap before the image */
  background: var(--detail-card-bg);
  border-radius: 0;
  padding: 84px 88px;
  overflow: hidden;
  opacity: 0; /* the card surface itself fades in first */
  transition: opacity 360ms ease;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: #ffffff;
}
.detail.text-in .detail-card { opacity: 1; }

/* Children stagger in one-by-one on top of the card */
.detail-title,
.detail-section,
.detail-cta {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 520ms ease, transform 600ms var(--ease-elegant);
}
.detail.text-in .detail-title,
.detail.text-in .detail-section,
.detail.text-in .detail-cta {
  opacity: 1;
  transform: translateY(0);
}
.detail.text-in .detail-title                     { transition-delay: 120ms; }
.detail.text-in .detail-section:nth-of-type(1)    { transition-delay: 260ms; }
.detail.text-in .detail-section:nth-of-type(2)    { transition-delay: 380ms; }
.detail.text-in .detail-section:nth-of-type(3)    { transition-delay: 500ms; }
.detail.text-in .detail-cta                       { transition-delay: 640ms; }

/* On close, drop all stagger so the card empties fast and in sync */
.detail.closing .detail-title,
.detail.closing .detail-section,
.detail.closing .detail-cta,
.detail.closing .detail-card {
  transition: opacity 220ms ease, transform 260ms var(--ease-elegant) !important;
  transition-delay: 0ms !important;
}

/* ---------- Prev / next project navigation ---------- */
.detail-nav {
  position: fixed;
  /* `right` + `bottom` set inline so it pins to the original card's
     bottom-right corner (mirroring the CTA's left/bottom inset). */
  bottom: 56px;
  display: inline-flex;
  gap: 10px;
  z-index: 3;          /* above the wipe-card */
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 520ms ease, transform 600ms var(--ease-elegant);
}
.detail.text-in .detail-nav {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 760ms; /* lands just after the CTA */
}
.detail-nav-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease;
}
.detail-nav-btn:hover { background: rgba(0,0,0,0.55); }
.detail-nav-btn:disabled { opacity: 0.5; cursor: default; }
.detail-nav-btn svg { width: 14px; height: 14px; display: block; }

/* While switching, the CTA + nav stay anchored and visible throughout
   the wipe. The card surface stays opaque so it can act as the wipe. */
.detail.switching .detail-cta,
.detail.switching .detail-nav {
  opacity: 1 !important;
  transform: translateY(0) !important;
  transition: none !important;
  pointer-events: auto !important;
}
.detail.switching .detail-card { opacity: 1 !important; }

.detail.contact-wiping .detail-card {
  opacity: 1 !important;
  overflow: hidden;
}
.detail.contact-wiping .detail-title,
.detail.contact-wiping .detail-section,
.detail.contact-wiping .detail-cta {
  opacity: 0 !important;
  transform: translateY(-8px) !important;
  transition: opacity 240ms ease, transform 280ms var(--ease-elegant) !important;
  transition-delay: 0ms !important;
}
.detail.contact-wiping .detail-close,
.detail.contact-wiping .detail-nav {
  opacity: 0 !important;
  transform: translateY(10px) !important;
  pointer-events: none !important;
  transition:
    opacity 220ms ease,
    transform 360ms var(--ease-elegant) !important;
}

/* Fade-out sub-phase: title + sections clear fast and together so the
   text is gone by the time the card has fully covered the screen. The
   fade-in afterwards reuses the default stagger from `.detail.text-in`. */
.detail.switching.switch-out .detail-title,
.detail.switching.switch-out .detail-section {
  transition: opacity 240ms ease, transform 280ms var(--ease-elegant) !important;
  transition-delay: 0ms !important;
}

.detail-title {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-weight: 400;
  color: #ffffff;
  font-size: clamp(56px, 7vw, 104px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 56px;
}

.detail-section {
  max-width: 420px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--detail-divider);
}
.detail-section:last-of-type {
  border-bottom: 1px solid var(--detail-divider);
}

.detail-label {
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #ffffff;
  margin-bottom: 14px;
  letter-spacing: 0.005em;
}

.detail-body {
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  color: var(--detail-body);
  margin: 0;
}

.detail-cta {
  position: absolute;
  left: 88px;     /* matches card horizontal padding */
  bottom: 56px;
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--fg);
  text-decoration: none;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}
.detail-cta:hover { background: rgba(0,0,0,0.55); }

/* Right-side image stage. The .detail-image element is positioned
   absolutely with inline left/top/width/height set by JS (FLIP). */
.detail-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1; /* image + close sit below the wipe-card */
}
.detail-image {
  position: fixed;
  overflow: hidden;
  border-radius: 6px;
  background: #111;
  /* will-change reduces flicker during the WAAPI animation */
  will-change: left, top, width, height;
  contain: layout paint size style;
}
.detail-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Close button — nested at the top-right corner of the right-side image */
.detail-close {
  position: fixed;
  top: calc(var(--detail-margin) + 14px);
  right: calc(var(--detail-margin) + 14px);
  width: 38px;
  height: 38px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-radius: 999px;
  cursor: pointer;
  z-index: 11; /* above navbar so it's always reachable */
  display: none;
  opacity: 0;
  transition: opacity 360ms ease, background 160ms ease;
}
.detail.open .detail-close { display: inline-flex; pointer-events: auto; }
.detail.text-in .detail-close { opacity: 1; }
.detail-close:hover { background: rgba(0,0,0,0.55); }
.detail-close span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 1.5px;
  background: var(--fg);
  border-radius: 2px;
  transform-origin: center;
}
.detail-close span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.detail-close span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }

/* Hide grid scrolling/cursor while detail is open */
.hero.detail-active { cursor: default; pointer-events: none; }

/* ============================================================
   Contact overlay
   ============================================================ */
.contact-overlay {
  --contact-form-delay: 442ms;
  --contact-form-y: 8px;
  --contact-item-y: 10px;
  position: fixed;
  inset: 0;
  z-index: 30;
  display: block;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--detail-card-bg);
  transition: opacity 260ms ease, visibility 0s linear 260ms;
}
.contact-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms ease, visibility 0s;
}
.contact-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: radial-gradient(circle at 50% 42%, black, transparent 72%);
  opacity: 0;
  transition: opacity 560ms ease;
}
.contact-overlay.revealed::before { opacity: 0.08; }
.contact-curtain {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--detail-card-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}
.contact-overlay.open .contact-curtain { opacity: 1; }
.contact-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: max(96px, calc(56px + env(safe-area-inset-top))) 0 max(64px, calc(40px + env(safe-area-inset-bottom)));
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1fr);
  gap: clamp(48px, 7vw, 112px);
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 360ms ease,
    transform 520ms var(--ease-elegant);
}
.contact-overlay.revealed .contact-shell {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.contact-copy {
  max-width: 560px;
}
.contact-kicker {
  margin: 0 0 22px;
  color: rgba(255,255,255,0.68);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.contact-title {
  margin: 0;
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-weight: 400;
  color: #fff;
  font-size: clamp(56px, 8vw, 118px);
  line-height: 0.96;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.contact-lead {
  max-width: 500px;
  margin: 30px 0 0;
  color: rgba(255,255,255,0.72);
  font-size: 15px;
  line-height: 1.7;
}
.contact-direct,
.contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 30px;
  color: rgba(255,255,255,0.72);
  font-size: 14px;
}
.contact-direct a,
.contact-socials a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.28);
  transition: border-color 160ms ease, color 160ms ease;
}
.contact-direct a:hover,
.contact-socials a:hover {
  color: rgba(255,255,255,0.78);
  border-color: rgba(255,255,255,0.58);
}
.contact-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--detail-divider);
  border-radius: 8px;
  background: rgba(20,20,20,0.96);
  opacity: 0;
  transform: translateY(var(--contact-form-y));
  transition:
    opacity 420ms ease,
    transform 500ms var(--ease-elegant);
  transition-delay: 0ms;
}
.contact-overlay.revealed .contact-form {
  opacity: 1;
  transform: translateY(0);
  transition-delay: var(--contact-form-delay);
}
.contact-field {
  position: relative;
  display: grid;
  gap: 9px;
  min-width: 0;
}
.contact-field-wide { grid-column: 1 / -1; }
.contact-field span {
  color: rgba(255,255,255,0.82);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-transform: none;
}
.contact-field input,
.contact-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--detail-divider);
  border-radius: 7px;
  background: #1b1b1b;
  color: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  padding: 12px 13px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.contact-field-date input {
  cursor: pointer;
  position: relative;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3.25' y='4.25' width='9.5' height='8.5' rx='1.25' stroke='%23f2f2f2' stroke-opacity='0.72' stroke-width='1.5'/%3E%3Cpath d='M5 2.75V5.25M11 2.75V5.25M3.5 6.75H12.5' stroke='%23f2f2f2' stroke-opacity='0.72' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px 16px;
}
.contact-field-date input[readonly] {
  opacity: 1;
  -webkit-text-fill-color: #fff;
}
.contact-field-date.is-open input {
  border-color: rgba(255,255,255,0.72);
  background-color: #202020;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.date-picker {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  width: min(100%, 336px);
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: #111;
  box-shadow:
    0 22px 54px rgba(0,0,0,0.46),
    inset 0 1px 0 rgba(255,255,255,0.06);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity 150ms ease,
    transform 170ms var(--ease-elegant);
}
.date-picker[hidden] {
  display: none;
}
.date-picker.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.contact-field-date.is-open {
  z-index: 25;
}
.date-picker-header {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.date-picker-title {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.9);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  text-transform: capitalize;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}
.date-picker-title::after {
  content: "";
  width: 5px;
  height: 5px;
  margin-top: -2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.72;
  transform: rotate(45deg);
}
.date-picker.is-years .date-picker-title::after {
  margin-top: 2px;
  transform: rotate(225deg);
}
.date-picker-nav,
.date-picker-day,
.date-picker-year {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}
.date-picker-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-color: rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.06);
  font-size: 22px;
  line-height: 1;
}
.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.date-picker-weekdays {
  gap: 4px;
  margin-bottom: 6px;
  color: rgba(255,255,255,0.44);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}
.date-picker-grid {
  gap: 4px;
}
.date-picker-years {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 0 2px;
}
.date-picker-gap,
.date-picker-day {
  min-width: 0;
  aspect-ratio: 1;
}
.date-picker-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.82);
  font-size: 13px;
}
.date-picker-year {
  min-height: 42px;
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.035);
  color: rgba(255,255,255,0.82);
  font-size: 13px;
}
.date-picker-title:hover,
.date-picker-nav:hover,
.date-picker-day:hover,
.date-picker-year:hover {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.1);
}
.date-picker-nav:active,
.date-picker-day:active,
.date-picker-year:active {
  transform: scale(0.96);
}
.date-picker-day.is-today {
  border-color: rgba(255,255,255,0.28);
}
.date-picker-year.is-current {
  border-color: rgba(255,255,255,0.28);
}
.date-picker-day.is-selected,
.date-picker-year.is-selected {
  border-color: rgba(255,255,255,0.92);
  background: #f2f2f2;
  color: #111;
}
.date-picker-title:focus-visible,
.date-picker-nav:focus-visible,
.date-picker-day:focus-visible,
.date-picker-year:focus-visible {
  outline: 2px solid rgba(255,255,255,0.72);
  outline-offset: 2px;
}
.contact-field textarea {
  resize: vertical;
  min-height: 128px;
}
.contact-field input[type="number"]::-webkit-outer-spin-button,
.contact-field input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.contact-field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.contact-field input:focus,
.contact-field textarea:focus {
  border-color: rgba(255,255,255,0.72);
  background-color: #202020;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.contact-field input[aria-invalid="true"],
.contact-field textarea[aria-invalid="true"] {
  border-color: rgba(255,130,130,0.72);
}
.contact-error {
  min-height: 16px;
  color: #ffb4b4;
  font-size: 12px;
  line-height: 1.25;
}
.contact-error:empty {
  display: none;
}
.contact-submit {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 24px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: var(--pill-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--fg);
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.contact-submit:hover { background: rgba(0,0,0,0.55); border-color: rgba(255,255,255,0.16); }
.contact-submit:active { transform: translateY(1px) scale(0.99); }
.contact-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.16);
}
.contact-close {
  position: fixed;
  top: calc(var(--detail-margin) + 14px);
  right: calc(var(--detail-margin) + 14px);
  z-index: 35;
  width: 38px;
  height: 38px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: var(--pill-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 260ms ease, transform 320ms var(--ease-elegant), background 160ms ease;
}
.contact-overlay.revealed .contact-close {
  opacity: 1;
  transform: scale(1);
}
.contact-close:hover { background: rgba(0,0,0,0.58); }
.contact-close span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--fg);
  transform-origin: center;
}
.contact-close span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.contact-close span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }
[data-contact-animate] {
  opacity: 0;
  transform: translateY(var(--contact-item-y));
  transition:
    opacity 520ms ease,
    transform 600ms var(--ease-elegant);
}
.contact-overlay.revealed [data-contact-animate] {
  opacity: 1;
  transform: translateY(0);
}
body.contact-open .navbar {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
}
body.contact-open .hero:not(.detail-active) .grid {
  opacity: 0.18;
  transform: translate3d(0, -14px, 0) scale(0.985);
  filter: blur(3px);
  transition: opacity 620ms ease, transform 760ms var(--ease-elegant), filter 760ms ease;
}

@media (max-width: 900px) {
  .detail-card { padding: 56px 40px; }
  .detail-title { margin-bottom: 36px; }
  .detail-cta { left: 40px; bottom: 40px; }

  .contact-shell {
    width: min(100% - 40px, 720px);
    grid-template-columns: 1fr;
    gap: 34px;
    align-items: start;
    padding-top: max(78px, calc(46px + env(safe-area-inset-top)));
  }

  .contact-title {
    font-size: clamp(46px, 13vw, 78px);
  }

  .contact-lead {
    margin-top: 22px;
  }
}

@media (max-width: 768px) {
  body.detail-open .navbar {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -10px);
  }

  .detail-card {
    left: 0;
    right: 0;
    top: 50vh;
    top: 50dvh;
    bottom: auto;
    height: 50vh;
    height: 50dvh;
    padding: 22px 22px calc(48px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .detail-title {
    font-size: clamp(34px, 9.5vw, 48px);
    line-height: 1;
    margin-bottom: 16px;
  }

  .detail-section {
    max-width: none;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .detail-label {
    font-size: 12.5px;
    margin-bottom: 7px;
  }

  .detail-body {
    font-size: 13px;
    line-height: 1.45;
  }

  .detail-cta {
    position: static;
    width: fit-content;
    margin-top: 2px;
    padding: 10px 18px;
  }

  .detail-nav {
    right: max(22px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    gap: 8px;
    z-index: 4;
  }

  .detail.text-in .detail-nav {
    transition-delay: 360ms;
  }

  .detail-nav-btn {
    width: 42px;
    height: 42px;
  }

  .detail-image {
    border-radius: 0;
  }

  .detail-image img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .detail-close {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }

  .contact-close {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }

  .contact-shell {
    width: calc(100% - 44px);
    min-height: auto;
    gap: 16px;
    padding-top: max(42px, calc(30px + env(safe-area-inset-top)));
    padding-bottom: max(28px, calc(18px + env(safe-area-inset-bottom)));
  }

  .contact-kicker {
    margin-bottom: 10px;
    font-size: 11px;
  }

  .contact-title {
    font-size: clamp(32px, 8.4vw, 44px);
    line-height: 1.02;
  }

  .contact-lead {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.45;
  }

  .contact-form {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--detail-divider);
    border-radius: 0;
    background: transparent;
  }

  .contact-field {
    gap: 6px;
  }

  .contact-field span {
    font-size: 12px;
  }

  .contact-field input,
  .contact-field textarea {
    min-height: 50px;
    font-size: 16px;
    line-height: 1.3;
    padding: 13px 12px;
    border-radius: 7px;
  }

  .contact-field-date input {
    padding-right: 42px;
  }

  .date-picker {
    top: calc(100% + 8px);
    width: 100%;
    padding: 12px;
  }

  .date-picker-day {
    min-height: 36px;
  }

  .contact-field textarea {
    min-height: 92px;
  }

  .contact-submit {
    width: 100%;
    min-height: 46px;
    margin-top: 2px;
  }

  .contact-direct,
  .contact-socials {
    margin-top: 10px;
    font-size: 13px;
    gap: 9px 14px;
  }
}

@media (max-height: 720px) and (max-width: 768px) {
  .contact-shell {
    gap: 12px;
    padding-top: max(34px, calc(22px + env(safe-area-inset-top)));
    padding-bottom: max(22px, calc(14px + env(safe-area-inset-bottom)));
  }

  .contact-kicker { margin-bottom: 8px; }
  .contact-title { font-size: clamp(30px, 8.2vw, 40px); }
  .contact-lead { margin-top: 9px; font-size: 12.5px; line-height: 1.38; }
  .contact-direct,
  .contact-socials { margin-top: 8px; }
  .contact-form { gap: 8px; padding-top: 10px; }
  .contact-field textarea { min-height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .contact-overlay {
    --contact-form-delay: 404ms;
    --contact-form-y: 6px;
    --contact-item-y: 6px;
  }

  .contact-overlay {
    transition: opacity 180ms ease, visibility 0s linear 180ms !important;
  }

  .contact-overlay.open {
    transition: opacity 180ms ease, visibility 0s !important;
  }

  .contact-curtain,
  body.contact-open .hero:not(.detail-active) .grid {
    transition: opacity 180ms ease !important;
  }

  .contact-close {
    transform: none !important;
    transition: opacity 180ms ease, background 160ms ease !important;
  }

  .contact-shell,
  .contact-form,
  [data-contact-animate] {
    transition-property: opacity, transform !important;
    transition-duration: 260ms, 300ms !important;
    transition-timing-function: ease, var(--ease-elegant) !important;
  }

  .date-picker {
    transform: none !important;
    transition: opacity 140ms ease !important;
  }

  .date-picker.open {
    transform: none !important;
  }

  .contact-shell,
  .contact-close,
  body.contact-open .hero:not(.detail-active) .grid {
    transform: none !important;
    filter: none !important;
  }
}
