:root {
  --bg: #0d0d0d;
  --text: #f5f5f5;
  --text-muted: #cfcfcf;
  --divider: #f5f5f5;
  --video-fill: #4a4703;
  --video-border: #c7db55;
  --button-fill: #dcdcdc;
  --button-border: #9a9a2b;
  --button-text: #1a1a1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* No iOS grey tap box: the logo frames are hit-tested in JS, so it would land on
     a large container instead of the frame. */
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

.hero {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 48px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.title-graphic {
  position: relative;
  width: 100%;
  aspect-ratio: 1763 / 528;
}

.title-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.title-layer-surlignage {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.4s ease;
  transform-origin: 75.3% 57.85%;
}

.title-layer-surlignage.is-idle {
  animation: surlignage-idle 6s ease-in-out infinite;
}

@keyframes surlignage-idle {
  0%, 100% {
    transform: perspective(500px) rotateX(0deg) rotateY(0deg) scale(1);
  }
  50% {
    transform: perspective(500px) rotateX(-4deg) rotateY(6deg) scale(1.01);
  }
}

.title-hover-zone {
  position: absolute;
  left: 54.9%;
  top: 44.1%;
  width: 40.8%;
  height: 27.5%;
  cursor: pointer;
}

.video-block {
  aspect-ratio: 16 / 9;
  background: var(--video-fill);
  border: 2px solid var(--video-border);
  border-radius: 24px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.video-card[data-youtube-url] {
  cursor: pointer;
}

@media (hover: hover) {
  .video-block:hover {
    box-shadow: 0 0 12px 1px var(--video-border);
  }
}

.video-block.is-active {
  box-shadow: 0 0 12px 1px var(--video-border);
}

.video-card.tiltable {
  position: relative;
  z-index: 1;
  perspective: 500px;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.video-card.tiltable.is-idle {
  animation: surlignage-idle 6s ease-in-out infinite;
}

.video-card.tiltable .video-block {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 10px 1px rgba(255, 255, 255, 0.18);
  transition: box-shadow 0.3s ease;
}

.video-frame-wrap {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.4s ease;
}

.video-backdrop-group {
  position: absolute;
  bottom: 27%;
  left: 50%;
  height: 150%;
  aspect-ratio: 1 / 1;
  transform: translateX(-50%) translateZ(-60px);
  transition: transform 0.4s ease;
  z-index: 0;
  pointer-events: auto;
}

.video-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

@media (hover: hover) {
  .video-card.tiltable:hover {
    z-index: 2;
  }

  .video-card.tiltable:hover .video-block {
    box-shadow: 0 0 14px 2px rgba(255, 255, 255, 0.3);
  }

  .video-backdrop-group:hover {
    transform: translateX(-50%) translateZ(-60px) translateY(-25%);
  }

  .video-card.no-tilt:hover {
    transform: scale(0.97);
  }
}

/* Touch equivalent of the hover lift: set on tap, cleared by the next touch. */
.video-backdrop-group.is-raised,
.video-backdrop-group.is-peeking {
  transform: translateX(-50%) translateZ(-60px) translateY(-25%);
}

.video-card.tiltable .video-block.is-active {
  box-shadow: 0 0 14px 2px rgba(255, 255, 255, 0.3);
}

/* Long press on touch: no iOS callout / text selection interrupting the press. */
@media (hover: none) {
  .video-card {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

.video-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 2;
}

.video-block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
}

@media (hover: hover) {
  .video-card.tiltable:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .video-card.tiltable:hover .video-block::after {
    opacity: 1;
  }
}

.video-card.tiltable .video-block.is-active .video-play-icon {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.video-card.tiltable .video-block.is-active::after {
  opacity: 1;
}

.project-count {
  margin: 0;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.cta-button {
  display: block;
  width: 100%;
  padding: 16px;
  text-align: center;
  background: var(--button-fill);
  border: 2px solid var(--button-border);
  border-radius: 8px;
  color: var(--button-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.4s ease, filter 0.15s ease;
}

@media (hover: hover) {
  .cta-button:hover {
    filter: brightness(0.95);
  }
}

.cta-button.is-active {
  filter: brightness(0.95);
}

.portfolio {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.portfolio-title-graphic {
  position: relative;
  width: 50%;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}

@media (max-width: 640px) {
  .portfolio-title-graphic {
    width: 95%;
    margin-bottom: 48px;
  }
}

.portfolio-title-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.portfolio-title-layer.tiltable {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.4s ease;
}

.portfolio-title-layer.tiltable.is-idle {
  animation: surlignage-idle 6s ease-in-out infinite;
}

.goutte-hover-zone {
  position: absolute;
  cursor: pointer;
}

.goutte-hover-1 {
  left: 89.58%;
  top: 21.85%;
  width: 5.62%;
  height: 10.37%;
}

.goutte-hover-2 {
  left: 8.33%;
  top: 65.56%;
  width: 6.46%;
  height: 8.89%;
}

.goutte-hover-3 {
  left: 91.04%;
  top: 40.37%;
  width: 6.88%;
  height: 8.52%;
}

.goutte-hover-4 {
  left: 2.08%;
  top: 47.04%;
  width: 6.88%;
  height: 8.52%;
}

.portfolio-section-title {
  margin: 0 0 16px;
  font-size: 1.2rem;
  font-weight: 600;
  position: relative;
  top: -40px;
}

.portfolio-section:has(.portfolio-grid-4) {
  margin-top: 40px;
}

.portfolio-section,
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
  pointer-events: none;
}

.portfolio-section.is-revealed,
.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.portfolio-section:not(.is-revealed) .timeline-trigger,
.reveal-on-scroll:not(.is-revealed) .timeline-trigger {
  pointer-events: none;
}

.hero-header.reveal-on-scroll {
  transition-delay: 0s;
}

.hero-logo.reveal-on-scroll {
  transition-delay: 0.25s;
}

.hero .video-block,
.hero .video-block:hover {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.hero-logo {
  position: relative;
  width: 50%;
  align-self: center;
  margin-top: 18%;
  margin-bottom: 17%;
}

.logo-side-image {
  position: absolute;
  top: 50%;
  width: 90%;
  height: auto;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.logo-side-image--left {
  right: calc(100% - 120px);
  top: calc(50% - 30px);
}

.logo-side-image--right {
  left: calc(100% - 120px);
  top: calc(50% - 80px);
}

@media (max-width: 640px) {
  .logo-side-image--left {
    right: calc(100% - 55px);
  }

  .logo-side-image--right {
    left: calc(100% - 55px);
  }
}

.logo-frame {
  position: absolute;
  width: calc(80% / 1.1);
  aspect-ratio: 16 / 9;
  background: #c4c4c4;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 10px 1px rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  /* Not hidden so the badge can overflow; the video is rounded itself. */
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}

/* Set by logo-follow.js (frames have pointer-events: none, so no :hover). */
.logo-frame.is-hovered {
  box-shadow: 0 0 20px 4px rgba(255, 255, 255, 0.45);
}

.logo-frame-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 15px;
}

.logo-frame-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  /* % margin is relative to the frame width, so it scales with the badge. */
  margin-bottom: 7%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .logo-frame-label {
    font-size: 0.65rem;
  }
}

/* Shown over the video when the frame is clicked (see logo-frame-caption.js). */
.logo-frame-caption {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 15px;
  color: #fff;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.35;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.logo-frame.is-captioned .logo-frame-caption {
  opacity: 1;
}

/* Mobile: the caption is shown full screen instead of inside the frame. */
.caption-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.caption-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* The overlay itself stays transparent (it only catches the closing tap); the card is the text. */
.caption-overlay-text {
  max-width: 320px;
  margin: 0;
  padding: 24px 28px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  text-align: center;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 300;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .logo-frame-caption {
    font-size: 0.6rem;
    padding: 6%;
  }
}

.logo-frame-badge {
  position: absolute;
  top: 0;
  left: 50%;
  width: 22%;
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 1;
  user-select: none;
}

/* Left of the "personal branding" frame but not inside it, so it stays still.
   Mirrors .logo-frame--top: same top, then down half the frame height
   (72.73% wide × 9/16 ÷ 2 = 20.45% of the width; % margins use the width). */
.hero-halal-icon {
  position: absolute;
  top: -73%;
  left: -35%;
  width: 38.67%;
  height: auto;
  margin-top: 20.45%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.hero-halal-icon img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

/* Radar rings: sized to the badge's disc (~75% of the PNG, which has transparent padding),
   growing and fading out behind it; the two rings are offset by half a cycle. */
.hero-halal-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 75%;
  aspect-ratio: 1 / 1;
  border: 2px solid rgba(255, 196, 0, 0.9);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: halal-radar 5s ease-out infinite;
}

.hero-halal-pulse:nth-child(2) {
  animation-delay: 2.5s;
}

@keyframes halal-radar {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.9);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-halal-pulse {
    animation: none;
  }
}

.logo-frame--left {
  left: -46%;
  top: 78%;
}

.logo-frame--right {
  right: -46%;
  top: calc(78% - 40px);
}

.logo-frame--top {
  left: 50%;
  top: -73%;
  transform: translateX(-50%);
}

.project-count.reveal-on-scroll {
  transition-delay: 0.5s;
}

.cta-button.reveal-on-scroll {
  transition-delay: 0.6s;
}

.portfolio-section--staggered {
  opacity: 1;
  transform: none;
  transition: none;
}

.portfolio-header.reveal-on-scroll {
  transition-delay: 0s;
}

.portfolio-section--staggered .video-card.reveal-on-scroll:nth-child(1) {
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
  transition-delay: 0.2s;
}

.portfolio-section--staggered .video-card.reveal-on-scroll:nth-child(2) {
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
  transition-delay: 0.4s;
}

.portfolio-section--staggered .video-card.reveal-on-scroll:nth-child(3) {
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
  transition-delay: 0.6s;
}

.portfolio-divider.reveal-on-scroll {
  transition-delay: 0.8s;
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-section,
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.portfolio-divider {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: -162px auto -132px;
}

.portfolio-note {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-muted);
}

.portfolio-note.reveal-on-scroll {
  transition-delay: 0.9s;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  row-gap: 60px;
}

.portfolio-grid-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
  row-gap: 60px;
}

.portfolio-grid-4 .video-block {
  background: rgba(255, 255, 255, 0.08);
}

.portfolio-grid .video-block {
  border-radius: 16px;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.video-caption {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
  overflow-wrap: break-word;
}

/* Live YouTube view count above the caption, with a line between them (portfolio-view-counts.js). */
.video-views {
  align-self: center;
  width: 60%;
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.75;
  text-align: center;
}

@media (max-width: 640px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 72px;
  }

  .portfolio-section-title {
    font-size: 1.9rem;
    margin-bottom: 56px;
  }

  /* The image's transparent padding is 22.5% (top) and 18.3% (bottom) of its width;
     fixed px margins overshoot on narrow screens and overlap the last card. */
  /* Slightly larger: spans the full screen width by eating the 16px body gutters. */
  .portfolio-divider {
    width: calc(100% + 32px);
    max-width: none;
    margin: calc(-0.225 * (100% + 32px)) -16px calc(-0.183 * (100% + 32px));
  }
}

.timeline-trigger {
  cursor: pointer;
}

.timeline-unavailable {
  opacity: 0.5;
  pointer-events: none;
}

.timeline-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.timeline-modal[hidden] {
  display: none;
}

.timeline-modal.is-open {
  opacity: 1;
}

.timeline-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.timeline-modal-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #ffffff;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 0 24px 2px rgba(199, 219, 85, 0.25);
  padding: 16px;
  transform: scale(0.85);
  transition: transform 0.25s ease;
}

.timeline-modal.is-open .timeline-modal-content {
  transform: scale(1);
}

.timeline-modal-viewport {
  overflow: hidden;
  border-radius: 6px;
}

.timeline-modal-image {
  display: block;
  max-width: min(90vw, 1000px);
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  cursor: zoom-in;
  transform: scale(1);
  transform-origin: 50% 50%;
  transition: transform 0.2s ease;
}

.timeline-modal-image.is-zoomed {
  cursor: zoom-out;
  transform: scale(2.4);
  transition: transform 0.2s ease;
}

.timeline-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--button-border);
  background: var(--button-fill);
  color: var(--button-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

@media (hover: hover) {
  .timeline-modal-close:hover {
    transform: scale(0.9);
  }
}

.timeline-modal-caption {
  max-width: min(90vw, 680px);
  margin: 10px auto 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
}

.timeline-modal-caption:empty {
  display: none;
}

.timeline-modal-description {
  max-width: min(94vw, 940px);
  margin: 10px auto 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
  text-align: center;
}

.timeline-modal-description:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}

.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  animation: scroll-hint-float 2.6s ease-in-out infinite;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.scroll-hint-box {
  padding: 14px 30px;
  background: rgba(13, 13, 13, 0.75);
  border: 1px solid var(--video-border);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.scroll-hint p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
}

.scroll-hint-arrow {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: scroll-hint-arrow-bounce 1.3s ease-in-out infinite;
}

@keyframes scroll-hint-arrow-bounce {
  0%, 100% {
    transform: translateY(-3px);
    opacity: 0.6;
  }
  50% {
    transform: translateY(4px);
    opacity: 1;
  }
}

.scroll-hint.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  animation: none;
  pointer-events: none;
}

@keyframes scroll-hint-float {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint,
  .scroll-hint-arrow {
    animation: none;
  }
}

@media (max-width: 480px) {
  .scroll-hint {
    gap: 8px;
  }

  .scroll-hint-box {
    padding: 10px 16px;
  }

  .scroll-hint p {
    font-size: 0.75rem;
  }

  .scroll-hint-arrow {
    font-size: 1.2rem;
  }
}

/* Floating two-way switch between the home page and the portfolio (page-switch.js). */
.page-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 90;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 190px;
  height: 42px;
  padding: 4px;
  background: rgba(13, 13, 13, 0.75);
  border: 1px solid var(--video-border);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  animation: page-switch-float 3s ease-in-out infinite;
}

.page-switch-knob {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: #f5d800;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(245, 216, 0, 0.45);
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}

.page-switch-label {
  position: relative;
  text-align: center;
  transition: color 0.35s ease;
}

/* Knob sits on the current page; .is-flipping moves it to the destination. */
.page-switch[data-side="right"] .page-switch-knob,
.page-switch[data-side="left"].is-flipping .page-switch-knob {
  transform: translateX(100%);
}

.page-switch[data-side="right"].is-flipping .page-switch-knob {
  transform: translateX(0);
}

.page-switch[data-side="left"]:not(.is-flipping) .page-switch-label:nth-child(2),
.page-switch[data-side="left"].is-flipping .page-switch-label:nth-child(3),
.page-switch[data-side="right"]:not(.is-flipping) .page-switch-label:nth-child(3),
.page-switch[data-side="right"].is-flipping .page-switch-label:nth-child(2) {
  color: var(--button-text);
}

@media (hover: hover) {
  .page-switch:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 12px rgba(199, 219, 85, 0.35);
  }
}

@keyframes page-switch-float {
  0%, 100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -4px;
  }
}

@media (max-width: 640px) {
  .page-switch {
    top: 12px;
    right: 12px;
    width: 160px;
    height: 36px;
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-switch {
    animation: none;
  }

  .page-switch-knob,
  .page-switch-label {
    transition: none;
  }
}

/* Window opened by clicking the halal logo (halal-radar.js); layout from ref/FentreHalalRef.png. */
.halal-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  /* Scrolls here (not in the card) so the close button can overhang the card's corner. */
  overflow-y: auto;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.halal-modal[hidden] {
  display: none;
}

.halal-modal.is-open {
  opacity: 1;
}

.halal-modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.85);
}

.halal-modal-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  width: 100%;
  max-width: 1100px;
  margin: auto; /* centres it, and stays reachable when taller than the screen */
  padding: 28px;
  background: #101113;
  border: 1px solid rgba(217, 217, 217, 0.6);
  border-radius: 28px;
  box-shadow: 0 0 24px 2px rgba(199, 219, 85, 0.25);
  transform: scale(0.85);
  transition: transform 0.25s ease;
}

.halal-modal.is-open .halal-modal-content {
  transform: scale(1);
}

.halal-modal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.halal-modal-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(217, 217, 217, 0.6);
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

@media (hover: hover) {
  .halal-modal-media:hover {
    transform: scale(1.04);
  }
}

.halal-modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.halal-modal-title {
  margin: 18px 0 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.halal-modal-text {
  max-width: 34ch;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.halal-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--button-border);
  background: var(--button-fill);
  color: var(--button-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .halal-modal {
    padding: 16px;
  }

  .halal-modal-content {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 20px;
    border-radius: 22px;
  }

  .halal-modal-media {
    border-radius: 16px;
  }

  .halal-modal-title {
    margin-top: 12px;
    font-size: 1.1rem;
  }

  .halal-modal-text {
    font-size: 0.85rem;
  }
}

/* Loading screen shown until the page's images are loaded (page-loader.js). */
.page-loader {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.page-loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #f5d800;
  border-radius: 50%;
  animation: page-loader-spin 0.9s linear infinite;
}

.page-loader-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

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

/* Footer link to the legal notice (home + portfolio). */
.site-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--text-muted);
  opacity: 0.7;
  text-decoration: none;
}

.site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Legal notice page (mentions-legales.html). */
.legal {
  width: 100%;
  max-width: 760px;
  line-height: 1.65;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.legal h1 {
  margin: 24px 0 4px;
  font-size: 2rem;
  color: var(--text);
}

.legal h2 {
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 1.15rem;
  color: var(--text);
}

.legal strong {
  color: var(--text);
  font-weight: 600;
}

.legal a {
  color: #f5d800;
}

.legal ul {
  padding-left: 20px;
}

.legal-date {
  margin-top: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.legal .legal-back {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.legal .legal-back:hover {
  color: var(--text);
}
