/* ==========================================================================
   Components — buttons, header, photos and pieces reused across sections.
   ========================================================================== */

/* JS-only controls (e.g. language toggle) are hidden when JS is off */
html:not(.js) [data-requires-js] {
  display: none !important;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-pad-y: 0.95rem;
  --btn-pad-x: 1.9rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
}

.btn--gold {
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: 0 10px 30px -12px rgb(198 160 122 / 0.6);
}

/* Soft sheen that sweeps across the gold button on hover */
.btn--gold::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.btn--gold:hover {
  background: var(--kraft-light);
}
.btn--gold:hover::after {
  transform: translateX(120%);
}

.btn--ghost {
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Ghost button over photos: always light */
.btn--on-photo {
  border: 1px solid rgb(244 238 230 / 0.45);
  color: var(--on-photo);
  background: rgb(18 11 8 / 0.32);
}

.btn--on-photo:hover {
  border-color: var(--kraft);
  color: var(--kraft-light);
}

.btn--sm {
  --btn-pad-y: 0.6rem;
  --btn-pad-x: 1.2rem;
  font-size: var(--fs-xs);
}

/* Text link with an arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--accent);
}

.link-arrow svg {
  width: 1.1em;
  height: 1.1em;
  transition: transform var(--dur-fast) var(--ease-out);
}

/* The arrow points in reading direction: left in Arabic, right in English */
[dir="rtl"] .link-arrow svg {
  transform: scaleX(-1);
}
.link-arrow:hover svg {
  transform: translateX(4px);
}
[dir="rtl"] .link-arrow:hover svg {
  transform: scaleX(-1) translateX(4px);
}

/* Round icon button (language / theme) */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition:
    border-color var(--dur-fast),
    color var(--dur-fast),
    background-color var(--dur-fast);
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset-inline: 0;
  inset-block-start: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  color: var(--on-photo); /* light text over the hero */
  transition:
    background-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out),
    border-color var(--dur);
  border-block-end: 1px solid transparent;
}

/* Past the hero, the header gets a frosted background */
.site-header.is-scrolled {
  background: var(--header-bg);
  color: var(--text);
  border-block-end-color: var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header .icon-btn {
  color: inherit;
  border-color: rgb(244 238 230 / 0.25);
}
.site-header.is-scrolled .icon-btn {
  border-color: var(--line);
}

/* Thin gold line showing how far down the page you are */
.scroll-progress {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--kraft-deep), var(--kraft), var(--kraft-light));
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
}

[dir="rtl"] .scroll-progress {
  transform-origin: right;
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--mark);
  fill: currentColor;
}
/* Over the hero photo the header is transparent, so the mark stays gold in both themes */
.site-header:not(.is-scrolled) .brand__mark {
  color: var(--kraft);
}

.brand__word {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  direction: ltr;
}

.site-nav__list {
  display: flex;
  gap: var(--space-6);
}

.site-nav__link {
  position: relative;
  font-size: var(--fs-sm);
  font-weight: 400;
  white-space: nowrap;
  opacity: 0.85;
  padding-block: var(--space-2);
  transition:
    opacity var(--dur-fast),
    color var(--dur-fast);
}

.site-nav__link::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: 1px;
  background: var(--kraft);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease-out);
}

.site-nav__link:hover,
.site-nav__link[aria-current="true"] {
  opacity: 1;
}

.site-nav__link:hover::after,
.site-nav__link[aria-current="true"]::after {
  transform: scaleX(1);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Hamburger — mobile only */
.menu-toggle {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  display: none;
}

.menu-toggle span {
  position: absolute;
  inset-inline: 0.6rem;
  height: 1.5px;
  background: currentColor;
  transition:
    transform var(--dur) var(--ease-out),
    opacity var(--dur-fast);
}

.menu-toggle span:first-child {
  top: 1rem;
}
.menu-toggle span:last-child {
  top: 1.45rem;
}
.menu-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(0.225rem) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-0.225rem) rotate(-45deg);
}

/* Theme icon: moon in dark, sun in light */
.theme-icon--sun {
  display: none;
}
[data-theme-current="light"] .theme-icon--sun {
  display: block;
}
[data-theme-current="light"] .theme-icon--moon {
  display: none;
}

/* ---------- Photos ---------- */
/* Every cinematic photo gets a gradient shade; the color grade is baked into the file */
.photo {
  position: relative;
  overflow: hidden;
  background: var(--espresso-2);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo--soft img {
  filter: var(--grade-soft);
}

.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--photo-shade, linear-gradient(180deg, rgb(18 11 8 / 0) 40%, rgb(18 11 8 / 0.85) 100%));
}

/* ---------- Social links ---------- */
.socials {
  display: flex;
  gap: var(--space-3);
}

.socials a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-muted);
  transition:
    color var(--dur-fast),
    border-color var(--dur-fast),
    transform var(--dur-fast);
}

.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.socials svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ---------- Floating WhatsApp button ---------- */
.wa-float {
  position: fixed;
  inset-block-end: max(var(--space-5), env(safe-area-inset-bottom));
  inset-inline-start: var(--space-5);
  z-index: var(--z-float);
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: 0 14px 34px -10px rgb(0 0 0 / 0.55);
  transition:
    transform var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out),
    visibility 0s;
}

.wa-float svg {
  width: 1.6rem;
  height: 1.6rem;
}
.wa-float:hover {
  transform: scale(1.06);
}

/* Hidden while in the hero (it already has order buttons) */
.js .wa-float:not(.is-shown) {
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem) scale(0.9);
  pointer-events: none;
  transition-delay: 0s, 0s, var(--dur);
}

/* ---------- Back-to-top button ---------- */
/* Opposite corner to WhatsApp: inline-end flips with the language automatically */
.to-top {
  position: fixed;
  inset-block-end: max(var(--space-5), env(safe-area-inset-bottom));
  inset-inline-end: var(--space-5);
  z-index: var(--z-float);
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--accent);
  box-shadow: 0 14px 34px -14px rgb(0 0 0 / 0.55);
  transition:
    transform var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out),
    visibility 0s,
    color var(--dur-fast);
}

.to-top:hover {
  color: var(--accent-hover);
  transform: translateY(-3px);
}

.to-top > svg {
  grid-area: 1 / 1;
}

.to-top__ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* progress starts at 12 o'clock */
  fill: none;
  stroke-width: 1.5;
}

.to-top__track {
  stroke: var(--line);
}

.to-top__progress {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-dasharray: 1; /* pathLength="1" → 1 = the full circle */
  stroke-dashoffset: 1;
}

.to-top__icon {
  width: 1.15rem;
  height: 1.15rem;
}

.js .to-top:not(.is-shown) {
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem) scale(0.9);
  pointer-events: none;
  transition-delay: 0s, 0s, var(--dur), 0s;
}

/* ---------- Ornamental divider ---------- */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  color: var(--accent);
}

.ornament::before,
.ornament::after {
  content: "";
  width: 3.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.ornament svg {
  width: 1rem;
  height: 1.15rem;
}

/* ---------- Not-found page (404.html) — theme follows the device, no JS ---------- */
.not-found {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: var(--space-7) var(--gutter) var(--space-5);
  background: radial-gradient(circle at 50% 38%, var(--bg-raised) 0, var(--bg) 60%);
}

.not-found__brand {
  position: absolute;
  inset-block-start: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.not-found__brand:hover {
  color: var(--accent);
}

.not-found__content {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  max-width: 24rem;
  text-align: center;
  animation: not-found-rise var(--dur-reveal) var(--ease-out) both;
}

.not-found__code {
  display: flex;
  align-items: center;
  gap: 0.05em;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(6rem, 4rem + 10vw, 10rem);
  line-height: 1;
  color: var(--accent);
}

/* The 0 is an inline SVG cup seen from above (404.html); the steam fills its top fifth */
.not-found__cup {
  flex: none;
  width: 0.92em;
  height: auto;
  aspect-ratio: 120 / 150;
  margin-block-start: -0.25em;
}

.not-found__saucer,
.not-found__rim,
.not-found__handle {
  stroke: var(--accent);
}

.not-found__saucer {
  fill: var(--bg-raised);
  stroke-width: 3;
}

.not-found__rim {
  fill: var(--coffee-deep);
  stroke-width: 2;
}

.not-found__coffee {
  fill: var(--coffee);
  opacity: 0.7;
}

.not-found__handle {
  stroke-width: 6;
  stroke-linecap: round;
}

.not-found__steam path {
  fill: none;
  stroke: var(--accent-hover);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.not-found__steam {
  opacity: 0.55;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: steam-rise 3.6s ease-in-out infinite;
}

.not-found__steam:nth-of-type(2) {
  animation-delay: -1.2s;
}

.not-found__steam:nth-of-type(3) {
  animation-delay: -2.4s;
}

.not-found__title {
  margin-block-start: var(--space-4);
  font-size: var(--fs-lg);
  line-height: var(--leading-tight);
}

.not-found__text {
  max-width: 30ch;
  color: var(--text-muted);
}

.not-found__en {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  opacity: 0.8;
}

.not-found__actions {
  display: grid;
  gap: var(--space-3);
  width: min(100%, 15rem);
  margin-block-start: var(--space-4);
}

@keyframes not-found-rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
}

@keyframes steam-rise {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  30% {
    opacity: 0.7;
  }

  50% {
    transform: translate(2px, -2px);
  }

  100% {
    opacity: 0;
    transform: translate(-1px, -10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .not-found__content,
  .not-found__steam {
    animation: none;
  }
}
