/* ==========================================================================
   Shadibyah.com holding page
   1. Fonts
   2. Tokens
   3. Base
   4. Paper
   5. Scenery: figures, birds, horizon
   6. Ornaments
   7. Content
   8. Reveal
   9. Responsive
  10. Reduced motion
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/cormorant-garamond-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/cormorant-garamond-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Mulish';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/mulish-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Mulish';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/mulish-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 2. Tokens --------------------------------------------------------------- */

:root {
  --cream: #fbf1e2;
  --cream-lift: #fdf8ee;
  --cream-deep: #f2ddbe;
  --card: rgba(253, 248, 239, 0.62);
  --maroon: #6b211c;
  --maroon-deep: #4e1512;
  --terracotta: #c4601c;
  --gold: #c08a2e;
  --ink: #6c5443;
  --ink-soft: #8b7461;
  --hairline: rgba(107, 33, 28, 0.16);
  --gold-line: rgba(192, 138, 46, 0.42);

  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Mulish', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Reading column, and the gap from page centre to the inner edge of the
     flanking sketches. Both shrink together at the tablet breakpoint. */
  --column: 32rem;
  --cards: 44rem;
  --flank: 19rem;
  --figure-w: clamp(7rem, 11vw, 11.5rem);
  --page-pad: clamp(1.1rem, 4vw, 2rem);
}

/* 3. Base ----------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

p {
  margin: 0;
}

.filter-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  padding: clamp(2.5rem, 7vw, 4.5rem) var(--page-pad) 0;
}

/* 4. Paper ---------------------------------------------------------------- */

.paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(80% 50% at 50% -8%, #fdf9f0 0%, rgba(253, 249, 240, 0) 65%),
    radial-gradient(45% 55% at 0% 32%, rgba(226, 181, 137, 0.34) 0%, rgba(226, 181, 137, 0) 70%),
    radial-gradient(45% 55% at 100% 32%, rgba(226, 181, 137, 0.34) 0%, rgba(226, 181, 137, 0) 70%),
    radial-gradient(90% 45% at 50% 108%, var(--cream-deep) 0%, rgba(242, 221, 190, 0) 72%),
    var(--cream);
}

/* Fibrous paper grain. Kept as an inline turbulence sheet so the page carries
   no extra image request. */
.paper::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.4;
  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='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)' opacity='0.35'/%3E%3C/svg%3E");
}

/* 5. Scenery -------------------------------------------------------------- */

.stage {
  position: relative;
}

.scenery {
  position: absolute;
  inset: -2% 0 -4%;
  pointer-events: none;
}

.figure {
  position: absolute;
  width: var(--figure-w);
  opacity: 0;
  transform: translate3d(0, var(--parallax, 0px), 0);
  will-change: transform;
}

.js .figure.is-in {
  opacity: var(--fig-op, 0.9);
  transition: opacity 1.4s ease var(--fig-delay, 0s);
}

html:not(.js) .figure {
  opacity: var(--fig-op, 0.9);
}

.figure__rise {
  display: block;
  transform: translateY(18px);
}

.js .figure.is-in .figure__rise {
  transform: none;
  transition: transform 1.4s cubic-bezier(0.22, 0.7, 0.3, 1) var(--fig-delay, 0s);
}

/* Breathing plus the displacement boil is what keeps a still sketch from
   reading as a pasted-on cutout. */
.figure__art {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
  animation: breathe var(--breath, 6s) ease-in-out var(--breath-delay, 0s) infinite alternate;
  filter: url(#boil-1);
}

.figure--b .figure__art { filter: url(#boil-2); }
.figure--c .figure__art { filter: url(#boil-3); }
.figure--d .figure__art { filter: url(#boil-2); }

@keyframes breathe {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.011) translateY(-2px); }
}

.figure--a {
  right: calc(50% + var(--flank));
  top: 3%;
  --fig-op: 0.92;
  --fig-delay: 0.1s;
  --breath: 6.4s;
}

.figure--b {
  left: calc(50% + var(--flank));
  top: 2%;
  --fig-op: 0.86;
  --fig-delay: 0.25s;
  --breath: 7.1s;
  --breath-delay: -1.8s;
}

.figure--c {
  right: calc(50% + var(--flank));
  top: 44%;
  --fig-op: 0.88;
  --fig-delay: 0.4s;
  --breath: 5.6s;
  --breath-delay: -3.1s;
}

.figure--d {
  left: calc(50% + var(--flank));
  top: 45%;
  --fig-op: 0.82;
  --fig-delay: 0.55s;
  --breath: 6.8s;
  --breath-delay: -0.9s;
}

/* Birds ------------------------------------------------------------------- */

.birds {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Travel, bob and flap are split across three nested elements so each can run
   on its own clock without the transforms fighting one another. */
.bird {
  position: absolute;
  top: var(--top, 20%);
  left: 0;
  opacity: var(--op, 0.4);
  will-change: transform;
  animation: bird-cross var(--dur, 26s) linear var(--delay, 0s) infinite;
}

@keyframes bird-cross {
  from { transform: translateX(-14vw); }
  to   { transform: translateX(114vw); }
}

.bird__bob {
  display: block;
  animation: bird-bob var(--bob, 5.5s) ease-in-out var(--delay, 0s) infinite alternate;
}

@keyframes bird-bob {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(var(--lift, 22px) * -1)); }
}

.bird__glyph {
  display: block;
  width: calc(26px * var(--scale, 1));
  height: auto;
  overflow: visible;
}

.bird__wing {
  transform-origin: 0 0;
  animation: flap-left var(--flap, 0.7s) ease-in-out var(--delay, 0s) infinite;
}

.bird__wing--r {
  animation-name: flap-right;
}

.bird__wing path {
  fill: none;
  stroke: var(--maroon);
  stroke-width: 1.5;
  stroke-linecap: round;
}

@keyframes flap-left {
  0%, 100% { transform: rotate(-22deg); }
  50%      { transform: rotate(26deg); }
}

@keyframes flap-right {
  0%, 100% { transform: rotate(22deg); }
  50%      { transform: rotate(-26deg); }
}

/* Horizon ----------------------------------------------------------------- */

/* Bleeds to the window edge by cancelling the page gutter. Using 100vw here
   instead would add a full viewport of layout overflow, which a transform
   cannot claw back.

   The padding is open sky: it is the only place the birds fly, so it has to be
   part of this box rather than empty page above it. */
.horizon {
  position: relative;
  overflow: hidden;
  margin: clamp(1rem, 3vw, 2rem) calc(var(--page-pad) * -1) 0;
  padding-top: clamp(2.5rem, 8vw, 6rem);
}

.horizon__scene {
  position: relative;
}

/* Faded back so the temples read as distant scenery rather than a photograph,
   with the last few percent dissolved to hide the drawing's hard ground line. */
.horizon__skyline {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.72;
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
}

.horizon__mist {
  position: absolute;
  left: -30%;
  width: 160%;
  bottom: 0;
  height: 30%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(251, 241, 226, 0) 0%,
    rgba(251, 241, 226, 0.34) 22%,
    rgba(251, 241, 226, 0) 44%,
    rgba(251, 241, 226, 0) 62%,
    rgba(251, 241, 226, 0.28) 80%,
    rgba(251, 241, 226, 0) 100%
  );
  animation: drift 52s linear infinite;
}

.horizon__mist--far {
  bottom: 16%;
  height: 22%;
  opacity: 0.55;
  animation-duration: 78s;
  animation-direction: reverse;
}

@keyframes drift {
  from { transform: translateX(-12%); }
  to   { transform: translateX(12%); }
}

/* 6. Ornaments ------------------------------------------------------------ */

.draw {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fleuron {
  display: block;
  width: clamp(3rem, 8vw, 4.1rem);
  height: auto;
  margin: 0 auto;
}

.fleuron .draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.js .is-in .fleuron .draw,
html:not(.js) .fleuron .draw {
  animation: stroke-in 1.6s ease forwards;
}

.fleuron .draw:nth-child(2) { animation-delay: 0.15s; }
.fleuron .draw:nth-child(3) { animation-delay: 0.3s; }
.fleuron .draw:nth-child(4) { animation-delay: 0.45s; }
.fleuron .draw:nth-child(5) { animation-delay: 0.6s; }

@keyframes stroke-in {
  to { stroke-dashoffset: 0; }
}

.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.85rem auto 0;
  width: min(14rem, 60%);
}

.rule__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

.rule__gem {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
}

.mandala {
  display: block;
  width: clamp(3.2rem, 9vw, 4.4rem);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.mandala__spin {
  transform-origin: 0 0;
  animation: spin 96s linear infinite;
}

.mandala__petals .draw,
.mandala__petals use {
  fill: rgba(192, 138, 46, 0.16);
  stroke: var(--gold);
  stroke-width: 1.2;
}

.mandala__petals--short .draw,
.mandala__petals--short use {
  fill: rgba(192, 138, 46, 0.28);
}

.mandala__core {
  fill: var(--gold);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.95rem;
  margin-top: clamp(1.6rem, 4vw, 2.4rem);
}

.dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--terracotta);
  opacity: 0.45;
  animation: pulse 2.7s ease-in-out infinite;
}

.dots span:nth-child(2) { animation-delay: 0.3s; }
.dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes pulse {
  0%, 100% { opacity: 0.28; transform: scale(0.85); }
  40%      { opacity: 0.85; transform: scale(1); }
}

/* 7. Content -------------------------------------------------------------- */

.masthead__crest {
  margin: 0 0 clamp(0.6rem, 2vw, 1rem);
}

.masthead__logo {
  margin: 0;
  font-size: 0;
  line-height: 0;
}

.masthead__logo img {
  width: clamp(11.5rem, 38vw, 17.5rem);
  height: auto;
}

.masthead__tagline {
  margin: clamp(0.9rem, 2.6vw, 1.3rem) auto 0;
  max-width: 26rem;
  font-size: clamp(0.95rem, 2.6vw, 1.08rem);
  line-height: 1.7;
  color: var(--ink);
}

.hero {
  margin-top: clamp(2.75rem, 8vw, 4.75rem);
}

.hero__mandala {
  margin: 0 0 clamp(1.4rem, 4vw, 2.2rem);
}

.hero__heading {
  margin: 0 auto;
  max-width: var(--column);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.85rem, 6vw, 3.05rem);
  line-height: 1.2;
  letter-spacing: 0.005em;
  color: var(--maroon);
}

.hero__copy {
  margin: clamp(1.3rem, 3.5vw, 1.9rem) auto 0;
  max-width: min(var(--column), 27rem);
  font-size: clamp(0.94rem, 2.5vw, 1.04rem);
  line-height: 2;
  color: var(--ink);
}

.communities {
  margin-top: clamp(3rem, 9vw, 5rem);
}

.communities__heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.7rem, 2.5vw, 1.15rem);
  margin: 0 auto;
  max-width: var(--cards);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 4vw, 1.72rem);
  letter-spacing: 0.015em;
  color: var(--maroon);
}

.communities__wing {
  position: relative;
  width: clamp(1.7rem, 6vw, 2.9rem);
  height: 8px;
  flex: none;
  background: linear-gradient(90deg, transparent, var(--gold-line))
    center / 100% 1px no-repeat;
}

.communities__wing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.communities__heading .communities__wing:last-child {
  transform: scaleX(-1);
}

.cards {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.1rem, 3.5vw, 2.4rem);
  margin: clamp(1.6rem, 4.5vw, 2.4rem) auto 0;
  max-width: var(--cards);
}

.cards::before {
  content: '';
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 50%;
  width: 1px;
  transform: translateX(-0.5px);
  background: repeating-linear-gradient(
    to bottom,
    var(--gold-line) 0 4px,
    transparent 4px 11px
  );
}

.cards::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid var(--gold);
  background: var(--cream);
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.9rem, 2.6vw, 1.35rem);
  padding: clamp(1.5rem, 4vw, 2.4rem) clamp(1.1rem, 3vw, 1.9rem);
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  background: var(--card);
  transition: transform 0.4s cubic-bezier(0.22, 0.7, 0.3, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(192, 138, 46, 0.75);
  box-shadow: 0 14px 34px -22px rgba(78, 21, 18, 0.55);
}

.card__logo {
  width: clamp(8.5rem, 24vw, 11.5rem);
  height: auto;
}

.card__copy {
  max-width: 17rem;
  font-size: clamp(0.86rem, 2.3vw, 0.95rem);
  line-height: 1.85;
  color: var(--ink);
}

.btn {
  display: inline-block;
  margin-top: auto;
  padding: 0.72em 1.5em;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: clamp(0.8rem, 2.2vw, 0.9rem);
  font-weight: 600;
  line-height: 1.2;
  color: #fdf6ea;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.btn--terracotta { background: var(--terracotta); }
.btn--maroon     { background: var(--maroon); }

.btn:hover  { transform: translateY(-1px); }
.btn--terracotta:hover { background: #ad5216; }
.btn--maroon:hover     { background: var(--maroon-deep); }

.btn:focus-visible,
.social__link:focus-visible {
  outline: 2px solid var(--maroon);
  outline-offset: 3px;
}

.site-footer {
  padding: clamp(1.2rem, 4vw, 2rem) 0 clamp(2.2rem, 6vw, 3.2rem);
}

.site-footer__note {
  font-size: clamp(0.88rem, 2.4vw, 1rem);
  font-weight: 600;
  color: var(--maroon);
}

.social {
  display: flex;
  justify-content: center;
  gap: clamp(0.85rem, 3vw, 1.25rem);
  margin-top: clamp(1.1rem, 3vw, 1.6rem);
}

.social__link {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--maroon);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.social__link svg {
  width: 19px;
  height: 19px;
  fill: var(--cream-lift);
}

.social__link:hover {
  background: var(--terracotta);
  transform: translateY(-2px);
}

/* 8. Reveal --------------------------------------------------------------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 1s ease, transform 1s cubic-bezier(0.22, 0.7, 0.3, 1);
}

/* A card's hover lift shares the transform channel with its reveal, so it has
   to outrank the settled reveal state or the lift never happens. */
.js .card[data-reveal].is-in {
  transition: opacity 1s ease,
              transform 0.4s cubic-bezier(0.22, 0.7, 0.3, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}

.js .card[data-reveal].is-in:hover,
.js .card[data-reveal].is-in:focus-within {
  transform: translateY(-4px);
}

/* 9. Responsive ----------------------------------------------------------- */

@media (max-width: 1180px) {
  :root {
    --flank: 16.5rem;
    --figure-w: clamp(6.5rem, 12vw, 9.5rem);
  }
}

/* Below this the flanking sketches no longer fit beside the column, so they
   drop behind the copy as a faint watermark and the pair with the least
   silhouette overlap is kept. */
@media (max-width: 1023px) {
  .figure {
    --fig-op: 0.2;
    width: clamp(9rem, 34vw, 15rem);
  }

  .figure--a { right: auto; left: -2%; top: 5%; }
  .figure--d { left: auto; right: -2%; top: 38%; }
  .figure--b,
  .figure--c { display: none; }

  /* The boil is a full-size repaint several times a second; not worth the
     battery on a handheld. */
  .figure__art { filter: none; }
}

@media (max-width: 720px) {
  :root {
    --column: 22rem;
  }

  .hero__copy {
    line-height: 1.9;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
    max-width: 25rem;
  }

  .cards::before,
  .cards::after {
    display: none;
  }

  .communities__heading {
    gap: 0.55rem;
    line-height: 1.35;
  }

  .horizon {
    margin-top: clamp(2rem, 8vw, 3rem);
  }

  /* The panorama is wide and low; on a phone it needs to overspill sideways or
     the temples shrink to an unreadable smear. max-width has to be released or
     the global img cap silently holds it at 100% while the negative margin
     still drags it off-centre. */
  .horizon__skyline {
    width: 175%;
    max-width: none;
    margin-left: -37.5%;
  }
}

@media (max-width: 400px) {
  .communities__wing {
    display: none;
  }
}

/* 10. Reduced motion ------------------------------------------------------ */

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

  .figure__art {
    filter: none;
    animation: none;
  }

  .fleuron .draw {
    stroke-dashoffset: 0;
  }

  .dots span {
    opacity: 0.45;
  }

  .js [data-reveal],
  .js .figure {
    opacity: 1;
    transform: none;
  }

  .js .figure {
    opacity: var(--fig-op, 0.9);
  }

  .js .figure__rise {
    transform: none;
  }
}
