/* Base: reset, RTL, safe areas, the stage (phone-width, centred on desktop over a
   blurred darkened copy of the current scene), screen host and transitions. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh);
  color: var(--text);
  background: var(--espresso);
  direction: rtl;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.3;
  font-weight: 800;
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.35;
  font-weight: 800;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.4;
  font-weight: 700;
}

a {
  color: var(--cocoa);
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.cdc-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- The stage ---- */
.cdc-backdrop {
  display: none;
}

/* The stage does not scroll; its screen host does. The HUD (mute button, bubble
   dock) sits above the host and stays put while a screen scrolls. */
.cdc-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ivory);
  isolation: isolate;
}

.cdc-screen-host {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* One screen; it fills at least the stage height. A full scene or paper page that is a
   direct child grows to fill it (flex), so it never leaves an empty band at the bottom. */
.cdc-screen {
  position: relative;
  min-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.cdc-screen > * {
  flex-shrink: 0;
}

.cdc-screen > .cdc-paper,
.cdc-screen > .cdc-scene--full {
  flex: 1 0 auto;
}

.cdc-screen-host > .cdc-screen.is-leaving {
  position: absolute;
  inset: 0 0 auto 0;
  pointer-events: none;
}

@media (min-width: 900px) {
  .cdc-backdrop {
    display: block;
    position: fixed;
    inset: -40px;
    background-color: var(--cocoa-deep);
    background-image: var(--backdrop, linear-gradient(160deg, #8fb8c9, #f1dcc0));
    background-size: cover;
    background-position: center;
    filter: blur(28px) brightness(0.5) saturate(1.05);
    transform: scale(1.06);
    transition: background-image var(--t-slow) var(--ease);
  }

  .cdc-stage {
    width: var(--stage-w);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

}

/* Scrollbar inside the stage: thin and warm */
.cdc-screen-host {
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 76, 70, 0.4) transparent;
}

/* ---- Fallback pages ---- */
.cdc-noscript,
.cdc-notfound {
  padding: 48px 24px;
  text-align: center;
}

.cdc-notfound {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
