/* =====================================================================
   TEMAI 7 | shell.css
   owner task: code-shell
   scope: loader, navigation (desktop Top/Scrolled, phone bar, full-screen menu), dock, footer, toast, announcement bar
   Figma: Nav/Desktop 65:347, Nav/Phone 65:644, footer board 03-site-footer.png, loader 08-loader-*.png.
   Uses tokens.css and the primitives of base.css only. Logical properties (RTL first).
   Animate transform, opacity, clip-path, filter only.
   ===================================================================== */

/* page ground under everything: --announce-h is the height of a visible announcement bar */
html { --announce-h: 0px; }
html:has(#announce:not([hidden])) { --announce-h: 40px; }

/* ---------- 1. loader (bible 9: at most 2.2 s: 1.4 s of drawing + 0.7 s wipe) ---------- */
.loader {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; align-content: center;
  background: var(--color-bg-base); color: var(--color-text-primary);
  clip-path: inset(0);
  transition: clip-path 700ms var(--ease-inout);
  animation: loader-failsafe 0s linear 7s forwards;          /* if every script fails the layer still leaves */
}
html.no-loader .loader { display: none; }
.loader.is-out { clip-path: inset(0 0 100% 0); pointer-events: none; }
@keyframes loader-failsafe { to { visibility: hidden; pointer-events: none; } }

.loader__mark { width: min(50vw, 600px); min-width: 240px; direction: ltr; }
.loader__bar { display: block; height: 4px; margin-block-end: clamp(20px, 3.4vw, 48px); background: var(--color-brand-red); border-radius: 1px; transform-origin: left center; animation: loader-bar 500ms var(--ease-inout) both; }
[dir="rtl"] .loader__bar { transform-origin: right center; }
@keyframes loader-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.loader__word { width: 100%; height: auto; color: var(--color-text-primary); }
.lw { fill: currentColor; transform: translateY(28px); animation: lw-up 640ms var(--ease-out) calc(260ms + var(--i) * var(--stagger)) both; }
@keyframes lw-up { from { transform: translateY(28px); } to { transform: translateY(0); } }
.loader__by { display: flex; align-items: center; justify-content: center; gap: var(--space-20); margin-block-start: clamp(20px, 3.4vw, 48px); direction: inherit; animation: loader-fade 520ms var(--ease-out) 760ms both; }
.loader__by span { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 2.6vw, 32px); line-height: 1.4; color: var(--color-text-secondary); }
.loader__by i { display: block; width: clamp(28px, 4vw, 48px); height: 1px; background: var(--color-line-strong); transform-origin: center; animation: loader-line 520ms var(--ease-out) 760ms both; }
@keyframes loader-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes loader-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.loader__foot { position: absolute; inset-inline: clamp(24px, 6.7vw, 96px); bottom: clamp(24px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); flex-wrap: wrap; animation: loader-fade 520ms var(--ease-out) 300ms both; }
.loader__ruler { order: -1; flex: 1 0 100%; opacity: 0.7; }
.loader__skip { position: relative; min-height: 44px; padding-inline: var(--space-4); font-size: var(--fs-label-m); line-height: var(--lh-label-m); font-weight: 500; color: var(--color-text-primary); }
.loader__skip:hover { color: var(--color-metal-steel); }
.loader__skip:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.loader__pct { font-family: var(--font-code); font-size: var(--fs-code-m); line-height: var(--lh-code-m); font-weight: 500; letter-spacing: var(--ls-code); color: var(--color-text-muted); direction: ltr; font-variant-numeric: tabular-nums; }

/* ---------- 2. announcement bar ---------- */
.announce {
  position: relative; z-index: 1001; display: flex; align-items: center; justify-content: center; gap: var(--space-12);
  min-height: 40px; padding: var(--space-8) var(--page-margin);
  background: var(--color-surface-1); border-block-end: 1px solid var(--color-line-hair);
  font-size: var(--fs-label-m); line-height: var(--lh-label-m); font-weight: var(--fw-label-m); color: var(--color-text-primary); text-align: center;
}
.announce::before { content: ""; flex: none; width: 16px; height: 4px; border-radius: 1px; background: var(--color-brand-red); }

/* ---------- 3. header: Top (transparent over the hero) and Scrolled (glass) ---------- */
.top {
  position: fixed; inset-inline: 0; top: 0; z-index: 1000; height: var(--nav-h);
  container-type: inline-size;
  transform: translateY(var(--announce-h));
  transition: transform var(--dur-base) var(--ease-out);
}
.top.is-stuck { transform: none; }
.top::before {                                                 /* Blur/Glass, 72 high on desktop */
  content: ""; position: absolute; inset-inline: 0; top: 0; bottom: 16px; z-index: -1;
  background: rgba(10, 11, 12, 0.93); border-block-end: 1px solid var(--color-line-hair);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass));
  opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
}
.top.is-stuck::before { opacity: 1; }
@media (max-width: 959px) { .top::before { bottom: 0; } }
.top__in {
  --pad: max(var(--page-margin), calc((100cqw - var(--content-max)) / 2));
  height: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: var(--space-24);
  padding-inline: var(--pad);
  transition: transform var(--dur-base) var(--ease-out);
}
@media (min-width: 960px) { .top.is-stuck .top__in { transform: translateY(-8px); } }

.brand { display: inline-flex; align-items: center; gap: var(--space-12); justify-self: start; min-height: 44px; border-radius: var(--radius-md); }
.brand:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
.brand__mark { width: 40px; height: 40px; flex: none; }
.brand__word { width: 80px; height: auto; aspect-ratio: 185.9 / 50; color: var(--color-text-primary); flex: none; }

.top__nav { display: flex; align-items: center; justify-self: center; gap: var(--space-8); }
.top__nav a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--space-16);
  font-size: var(--fs-label-l); line-height: var(--lh-label-l); font-weight: 500; color: var(--color-text-secondary);
  border-radius: var(--radius-md); transition: color var(--dur-fast) var(--ease-out);
}
.top__nav a::after {                                           /* the active-section red bar (16x2, like the language switch) */
  content: ""; position: absolute; inset-inline: 50% auto; bottom: 2px; width: 16px; height: 2px; margin-inline-start: -8px; border-radius: 1px;
  background: var(--color-brand-red); transform: scaleX(0); transition: transform var(--dur-base) var(--ease-out);
}
[dir="rtl"] .top__nav a::after { margin-inline-start: 0; margin-inline-end: -8px; }
.top__nav a:hover, .top__nav a.is-active { color: var(--color-text-primary); }
.top__nav a.is-active::after { transform: scaleX(1); }
.top__nav a:focus-visible { outline: var(--focus-ring); outline-offset: 0; }

.top__act { display: flex; align-items: center; justify-self: end; gap: var(--space-16); }
.top__book { white-space: nowrap; }
.top.is-stuck .top__book { --btn-bg: var(--color-brand-red-fill); --btn-fg: var(--color-text-on-red); --btn-bd: transparent; }
.top.is-stuck .top__book:hover { --btn-bg: var(--color-brand-red); box-shadow: 0 0 28px rgba(230, 50, 59, 0.35); }
.top.is-stuck .top__book:active { --btn-bg: var(--color-brand-red-press); box-shadow: none; }
.top__menu { display: none; }

/* phone and tablet: menu button + language switch on the end side, logo on the start side (Nav/Phone) */
@media (max-width: 959px) {
  .top__in { grid-template-columns: 1fr auto; }
  .top__nav, .top__book { display: none; }
  .top__menu { display: inline-flex; }
  .top__act { gap: var(--space-12); flex-direction: row-reverse; }
  .brand__mark { width: 38px; height: 38px; }
}
/* 320px phones: logo mark + language switch + menu button need the room of the wordmark (added by code-studio for the overflow test) */
@media (max-width: 359px) { .brand__word { display: none; } }

/* ---------- 4. full-screen phone menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; overflow-y: auto;
  padding: 0 var(--page-margin) max(var(--space-24), env(safe-area-inset-bottom));
  background: var(--color-bg-base);
  clip-path: inset(0 0 100% 0); visibility: hidden;
  transition: clip-path 520ms var(--ease-inout), visibility 0s linear 520ms;
}
.menu.is-open { clip-path: inset(0); visibility: visible; transition-delay: 0s; }
.menu__bar { display: flex; align-items: center; justify-content: space-between; min-height: var(--nav-h); flex: none; }
.menu__nav { display: flex; flex-direction: column; margin-block: var(--space-24) var(--space-32); }
.menu__nav a {
  display: flex; align-items: baseline; gap: var(--space-16); min-height: 64px; padding-block: var(--space-12);
  border-block-end: 1px solid var(--color-line-hair);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-display-m); line-height: var(--lh-display-m); color: var(--color-text-primary);
  opacity: 0; transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out) calc(120ms + var(--i, 0) * 50ms), transform var(--dur-slow) var(--ease-out) calc(120ms + var(--i, 0) * 50ms), color var(--dur-fast) var(--ease-out);
}
.menu.is-open .menu__nav a { opacity: 1; transform: none; }
.menu__nav a i { font-family: var(--font-code); font-style: normal; font-weight: 500; font-size: var(--fs-code-s); line-height: var(--lh-code-s); letter-spacing: var(--ls-code); color: var(--color-text-muted); min-width: 24px; direction: ltr; }
.menu__nav a:hover { color: var(--color-brand-red); }
.menu__nav a:focus-visible { outline: var(--focus-ring); outline-offset: -2px; border-radius: var(--radius-md); }
.menu__act { display: flex; flex-direction: column; gap: var(--space-12); margin-block-start: auto; padding-block-start: var(--space-24); }
@media (min-width: 960px) { .menu { display: none; } }

/* ---------- 5. dock (phones): Book primary + WhatsApp icon button (Dock/Phone) ---------- */
.dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 950; display: flex; align-items: center; gap: var(--space-12);
  padding: var(--space-12) var(--page-margin) max(var(--space-12), env(safe-area-inset-bottom));
  background: rgba(14, 16, 18, 0.86); border-block-start: 1px solid var(--color-line-hair);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass));
  transform: translateY(0); transition: transform var(--dur-base) var(--ease-out);
}
.dock.is-hidden, html:not(.is-ready) .dock { transform: translateY(110%); pointer-events: none; }
.dock__book { flex: 1; }
.dock.is-quiet .dock__book { --btn-bg: var(--color-brand-graphite); --btn-fg: #f4f2ee; --btn-bd: rgba(255, 255, 255, 0.18); }       /* bible 17 T4: red only while no section button is red */
.dock__wa { flex: none; }
.dock__wa .ic { color: var(--color-channel-whatsapp); }
@media (min-width: 760px) { .dock { display: none; } }
html:lang(en) .dock__book .ic, html:lang(en) .hero__book .ic { display: none; }

/* ---------- 6. footer (Figma Footer, Desktop and Phone) ---------- */
.footer { container-type: inline-size; padding-block: var(--space-96) var(--space-32); background: var(--color-bg-base); overflow: clip; }
.footer__in {
  --pad: max(var(--page-margin), calc((100cqw - var(--content-max)) / 2));
  padding-inline: var(--pad);
  display: grid; grid-template-columns: minmax(0, 1.55fr) repeat(3, minmax(0, 1fr)); column-gap: var(--space-24); row-gap: var(--space-40);
}
.footer__intro { display: flex; flex-direction: column; gap: var(--space-16); max-width: 380px; }
.footer__line { color: var(--color-text-primary); text-wrap: balance; }
.footer__about { color: var(--color-text-secondary); max-width: 34ch; }
.footer__col { display: flex; flex-direction: column; align-items: flex-start; }
.footer__h { margin-block-end: var(--space-8); font-family: var(--font-text); font-weight: 500; font-size: var(--fs-label-s); line-height: var(--lh-label-s); color: var(--color-text-muted); }
.footer__col a {
  display: inline-flex; align-items: center; min-height: 40px; padding-block: var(--space-8);
  font-size: var(--fs-body-m); line-height: var(--lh-body-m); color: var(--color-text-secondary);
  transition: color var(--dur-fast) var(--ease-out);
}
.footer__col a:hover { color: var(--color-text-primary); }
.footer__col a:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-xs); }
.footer__ruler { grid-column: 1 / -1; margin-block-start: var(--space-16); }
/* the third moment: the outlined wordmark stands on the footer floor with a car on the horizon, cut by its lower third */
.footer__ghost { grid-column: 1 / -1; position: relative; isolation: isolate; padding-block-start: clamp(64px, 9cqw, 130px); margin-block: var(--space-16) var(--space-8); }
.footer__word { position: relative; z-index: 0; display: block; width: 100%; height: auto; aspect-ratio: 185 / 25.8; fill: none; stroke: color-mix(in srgb, var(--color-metal-steel) 46%, transparent); stroke-width: 0.22; stroke-linejoin: round; direction: ltr; }
.footer__pool { position: absolute; z-index: -1; inset-inline: 10%; bottom: -30px; height: 55%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.10), transparent); pointer-events: none; }
.footer__car { position: absolute; z-index: 1; left: 50%; bottom: -2px; width: min(42cqw, 600px); max-width: none; height: auto; translate: -50% 0; user-select: none; -webkit-user-drag: none; }
.footer__ghost::after { content: ""; position: absolute; z-index: 0; inset-inline: 0; bottom: -1px; border-block-end: 1px solid var(--color-line-hair); }
.footer__legal { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); flex-wrap: wrap; }
.footer__rights { color: var(--color-text-muted); }
@media (max-width: 1099px) {
  .footer { padding-block-start: var(--space-72); }
  .footer__in { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer__intro { grid-column: 1 / -1; max-width: 520px; }
}
@media (max-width: 759px) {
  .footer__in { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-32); }
  .footer__intro { margin-block-end: var(--space-24); }
  .footer__col:nth-of-type(3) { grid-column: 1 / -1; }
  .footer__word { stroke-width: 0.5; }
  .footer__car { width: 82cqw; }
  .footer__legal { flex-direction: column-reverse; align-items: flex-start; }
  .footer { padding-block-end: calc(var(--space-96) + env(safe-area-inset-bottom)); }          /* room for the dock */
}

/* ---------- 7. toast (#toast, script sets textContent and .is-on) ---------- */
#toast {
  position: fixed; z-index: 2500; left: 50%; bottom: calc(var(--space-24) + env(safe-area-inset-bottom)); max-width: min(92vw, 440px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  background: var(--color-surface-2); border-radius: var(--radius-md); box-shadow: var(--shadow-float);
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 759px) { #toast { bottom: calc(88px + env(safe-area-inset-bottom)); } }

/* ---------- 8. reduced motion: no loader animation, no slides (opacity only, 120 ms) ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader { display: none; }
  .top, .top__in, .menu__nav a { transition-duration: 120ms; }
  .menu__nav a { transform: none; }
}
