/* ============================================================
   King David Media
   Framed split-screen — terracotta frame, ivory panels,
   deep navy ink, statue as the standing visual.
   ============================================================ */

:root {
  --frame:   #C33A20;
  --frame-d: #A32E17;
  --ivory:   #F7F3EA;
  --ivory-2: #EFE9DC;
  --ink:     #16143F;
  --ink-60:  rgba(22, 20, 63, .62);
  --ink-38:  rgba(22, 20, 63, .38);
  --ink-14:  rgba(22, 20, 63, .14);
  --dark:    #131134;
  --gold:    #D8A657;

  --f-black: "Grenze Gotisch", Georgia, serif;
  --f-serif: "Bodoni Moda", Georgia, serif;
  --f-sans:  "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fw:   clamp(9px, 1.15vw, 18px);
  --pad:  clamp(1.35rem, 3.6vw, 3.6rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  padding: var(--fw);
  background: var(--frame);
  color: var(--ink);
  font-family: var(--f-sans);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

::selection { background: var(--ink); color: var(--ivory); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- frame + grain ---------- */
.frame {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  border: var(--fw) solid var(--frame);
}
/* Static, and only above the mobile breakpoint. A fixed full-screen multiply
   layer is one of the more expensive things you can ask a phone to composite
   on every scroll frame, and it buys very little at this opacity. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 950;
  pointer-events: none;
  opacity: .2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}
@media (max-width: 900px) { .grain { display: none; } }

/* ============================================================
   STAGE
   ============================================================ */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--fw);
  min-height: calc(100vh - (var(--fw) * 2));
}

/* --- brand block --- */
.stage__brand {
  grid-column: 1; grid-row: 1;
  background: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(.85rem, 1.6vw, 1.4rem) var(--pad);
  animation: fadeUp .8s var(--ease) both;
}
.brand { display: flex; align-items: baseline; gap: .45rem; }
.brand__name {
  font-family: var(--f-black);
  font-size: clamp(1.15rem, 1.9vw, 1.6rem);
  line-height: 1;
  letter-spacing: .01em;
}
.brand__sub {
  font-family: var(--f-mono);
  font-size: .62rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-60);
}
.brand__glyph {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  gap: 4px;
}
.brand__glyph i {
  width: 7px; height: 7px;
  background: var(--ink);
  transform: rotate(45deg);
  transition: transform .5s var(--ease), background .5s var(--ease);
}
.brand__glyph i:nth-child(2),
.brand__glyph i:nth-child(3) { background: var(--frame); }
.stage__brand:hover .brand__glyph i { transform: rotate(135deg); }

/* --- nav over the image --- */
.stage__nav {
  grid-column: 2; grid-row: 1;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: clamp(.8rem, 2vw, 2rem);
  padding: 0 0 0 clamp(1rem, 3vw, 2.6rem);
  animation: fadeUp .8s .06s var(--ease) both;
}
.nav__cta {
  margin-left: auto;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 clamp(1rem, 2.4vw, 2rem);
  background: var(--ivory);
  color: var(--ink) !important;
  font-family: var(--f-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-shadow: none !important;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.nav__cta:hover { background: var(--ink); color: var(--ivory) !important; }

/* --- left card --- */
.stage__card {
  grid-column: 1; grid-row: 2;
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  animation: fadeUp .9s .1s var(--ease) both;
}
.card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(1.1rem, 2.4vh, 1.8rem);
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad);
}
.dots { display: flex; gap: 7px; }
.dots i { width: 7px; height: 7px; background: var(--ink); }
.dots i:nth-child(2) { background: var(--frame); }

.hero__title {
  font-size: clamp(1.7rem, 3.25vw, 3.25rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: .012em;
  text-transform: uppercase;
}
.hero__title em {
  display: block;
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.18em;
  line-height: .98;
  letter-spacing: -.01em;
  text-transform: none;
  margin: .04em 0;
}
.t-line {
  display: block;
  animation: riseIn 1s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* --- CTA --- */
.cta {
  display: inline-block;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: .4rem;
  padding: 1.05rem clamp(1.6rem, 3vw, 2.6rem);
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--f-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  animation: riseIn 1s var(--ease) both;
  animation-delay: var(--d, 0s);
}
.cta span { position: relative; z-index: 2; transition: color .45s var(--ease); }
.cta::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: var(--frame);
  transform: translateY(101%);
  transition: transform .45s var(--ease);
}
.cta:hover::before { transform: none; }
.cta--light { background: var(--ivory); color: var(--ink); animation: none; }
.cta--light:hover span { color: var(--ivory); }

/* --- right visual --- */
.stage__visual {
  grid-column: 2; grid-row: 1 / span 2;
  position: relative;
  overflow: hidden;
  background: var(--dark);
  z-index: 0;
  animation: revealImg 1.2s .12s var(--ease) both;
}
@keyframes revealImg {
  from { opacity: 0; clip-path: inset(0 0 22% 0); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}
/* The frame never moves. The only per-frame work in here is four transforms —
   three swaying fronds and the sky — all of it on the compositor. */
.stage__img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 34%;
  /* mirrored so the figure faces into the wind */
  transform: scaleX(-1) scale(1.06);
}

/* --- swaying fronds ---
   Each .sway clips to the corner its branch enters from, and carries a soft
   radial mask that reaches zero alpha before the clip edge — so the boundary
   between moving and still is never visible. The image inside is sized to
   reproduce the full visual exactly (100/W and 100/H of the wrapper), which
   means transform-origin percentages on it read as percentages of the frame.
   The mask stays on the wrapper and the rotation on the image: rotating the
   wrapper would drag the mask edge along and give the trick away. */
.sway {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
/* The pivot box is sized to match the whole visual, so its transform-origin
   percentages read as percentages of the frame. It carries the rotation only —
   the mirror and scale live on the image with a centred origin, because a
   pivot-cornered origin would flip the image out of the frame entirely. */
.sway__pivot { position: absolute; }
.sway__img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  /* the global reset caps images at 100% of their container; harmless here but
     the pivot above is several times wider than the box that clips it */
  max-width: none;
  object-fit: cover;
  object-position: center 34%;
  transform: scaleX(-1) scale(1.06);
  will-change: transform;
}

/* A — tall fronds entering top-left, hinged on the left edge.
   Kept deliberately tight: the aqueduct sits at about 21% across and 29% down,
   and a hard architectural edge shifting even two pixels gives the trick away.
   This mask fades out at roughly 18% across and 27% down, short of it. */
.sway--a { top: 0; left: 0; width: 24%; height: 32%;
  -webkit-mask-image: radial-gradient(ellipse 52% 52% at 22% 34%, #000 34%, rgba(0,0,0,0) 100%);
          mask-image: radial-gradient(ellipse 52% 52% at 22% 34%, #000 34%, rgba(0,0,0,0) 100%);
}
.sway--a .sway__pivot {
  top: 0; left: 0; width: 416.6667%; height: 312.5%;
  transform-origin: 0% 20%;
  animation: swayA 6.5s ease-in-out -1.4s infinite alternate;
}

/* B — fronds entering top-right, hinged on the right edge */
.sway--b { top: 0; right: 0; width: 32%; height: 48%;
  -webkit-mask-image: radial-gradient(ellipse 58% 58% at 74% 32%, #000 36%, rgba(0,0,0,0) 100%);
          mask-image: radial-gradient(ellipse 58% 58% at 74% 32%, #000 36%, rgba(0,0,0,0) 100%);
}
.sway--b .sway__pivot {
  top: 0; right: 0; width: 312.5%; height: 208.3333%;
  transform-origin: 100% 28%;
  animation: swayB 8.2s ease-in-out -3.1s infinite alternate;
}

/* C — broad leaves, bottom-right, hinged in the corner */
.sway--c { bottom: 0; right: 0; width: 38%; height: 42%;
  -webkit-mask-image: radial-gradient(ellipse 58% 58% at 72% 70%, #000 36%, rgba(0,0,0,0) 100%);
          mask-image: radial-gradient(ellipse 58% 58% at 72% 70%, #000 36%, rgba(0,0,0,0) 100%);
}
.sway--c .sway__pivot {
  bottom: 0; right: 0; width: 263.1579%; height: 238.0952%;
  transform-origin: 100% 100%;
  animation: swayC 9.7s ease-in-out -5.3s infinite alternate;
}

@keyframes swayA {
  from { transform: rotate(-0.80deg) translate3d(-2px, 0, 0); }
  to   { transform: rotate( 0.80deg) translate3d( 2px, 0, 0); }
}
@keyframes swayB {
  from { transform: rotate(-0.70deg) translate3d(-2px, 0, 0); }
  to   { transform: rotate( 0.70deg) translate3d( 2px, 0, 0); }
}
@keyframes swayC {
  from { transform: rotate(-0.55deg) translate3d(-1px, 0, 0); }
  to   { transform: rotate( 0.55deg) translate3d( 1px, 0, 0); }
}

/* --- drifting cloud layer, travelling left --- */
.sky {
  position: absolute;
  top: 0; left: 0;
  width: 200%;
  height: 48%;
  z-index: 1;
  pointer-events: none;
  opacity: .72;
  mix-blend-mode: screen;
  background-repeat: repeat-x;
  background-size: 25% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='500'%3E%3Cfilter id='c' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0042 0.011' numOctaves='4' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 2.3 0 0 0 -1.1'/%3E%3C/filter%3E%3Crect width='800' height='500' filter='url(%23c)'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.95) 0%, rgba(0,0,0,.7) 42%, transparent 100%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,.95) 0%, rgba(0,0,0,.7) 42%, transparent 100%);
  animation: skyDrift 58s linear infinite;
  will-change: transform;
}
@keyframes skyDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
.stage__visual::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 22%;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(12, 10, 34, .45), rgba(12, 10, 34, 0));
  pointer-events: none;
}

/* ============================================================
   CLOSING PANEL
   ============================================================ */
.closing {
  margin-top: var(--fw);
  background: var(--dark);
  color: var(--ivory);
  text-align: center;
  padding: clamp(4rem, 12vw, 9rem) var(--pad);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.closing__line {
  font-size: clamp(1.85rem, 4.4vw, 4rem);
  font-weight: 500;
  line-height: 1.06;
  text-transform: uppercase;
  letter-spacing: .01em;
}
.closing__line em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.14em;
  text-transform: none;
  letter-spacing: -.01em;
}
.disciplines {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem clamp(1rem, 2.4vw, 2.2rem);
  margin-top: clamp(2.4rem, 5vw, 3.6rem);
  padding-top: 1.6rem;
  border-top: 1px solid rgba(247, 243, 234, .22);
  font-family: var(--f-mono);
  font-size: .68rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: rgba(247, 243, 234, .62);
}
.closing .cta { margin-top: clamp(2.4rem, 5vw, 3.6rem); }

/* --- footer --- */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  padding: clamp(1rem, 2.4vw, 1.6rem) 0 .2rem;
  font-family: var(--f-mono);
  font-size: .6rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(247, 243, 234, .82);
}

/* ---------- scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
[data-reveal].is-visible { opacity: 1; transform: none; }
.disciplines { transition-delay: .12s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1040px) {
  .stage { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .stage__brand { grid-column: 1; grid-row: 1; }
  .stage__nav {
    grid-column: 1; grid-row: 2;
    background: var(--ink);
    padding: 0 0 0 var(--pad);
    min-height: 52px;
  }
  .stage__card { grid-column: 1; grid-row: 3; }
  .stage__visual { grid-column: 1; grid-row: 4; min-height: clamp(420px, 66vh, 620px); }
  /* The stacked layout crops the square photo the other way — full height, a
     narrow slice of width — so features land elsewhere. Here the aqueduct rides
     up to about 24% down at the left, so zone A has to pull in above it. */
  .sway--a { width: 18%; height: 22%;
    -webkit-mask-image: radial-gradient(ellipse 52% 52% at 24% 36%, #000 34%, rgba(0,0,0,0) 100%);
            mask-image: radial-gradient(ellipse 52% 52% at 24% 36%, #000 34%, rgba(0,0,0,0) 100%);
  }
  .sway--a .sway__pivot { width: 555.5556%; height: 454.5455%; transform-origin: 0% 14%; }
  .card__body { padding-block: clamp(3rem, 9vw, 5rem); }
}
@media (max-width: 640px) {
  .stage__nav { padding-left: 0; }
  .nav__cta { margin: 0; width: 100%; }
  .hero__title { font-size: clamp(1.6rem, 8vw, 2.4rem); }
  .footer { justify-content: flex-start; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .sway, .sky { display: none; }
  [data-reveal] { opacity: 1; transform: none; }
}
