/* ============================================================
   Ahmad Alsaffan · portfolio
   Dark, cinematic, one accent. Radius locked at 0 (pills exempt).
   ============================================================ */

:root {
  --bg: #0A0A0C;
  --bg-2: #111114;
  --text: #EDEDF0;
  --muted: #8A8A93;
  --accent: #FF2E63;
  --hair: rgba(255, 255, 255, 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Rubik carries the Arabic and Cyrillic glyphs Space Grotesk lacks. */
  --font-display: "Space Grotesk", "Rubik", sans-serif;
  --font-mono: "JetBrains Mono", "Rubik", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #000; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

img, video { max-width: 100%; display: block; }

a { color: var(--text); text-decoration: none; }

/* Underline draws left to right on hover */
.nav-links a, .contact-links a {
  position: relative;
}
.nav-links a::after, .contact-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.nav-links a:hover::after, .contact-links a:hover::after,
.nav-links a:focus-visible::after, .contact-links a:focus-visible::after {
  transform: scaleX(1);
}

/* ---------- film grain ---------- */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: 0.04;
  z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- preloader ---------- */
#preloader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.5rem, 4vw, 3rem);
}
html.preload #preloader { display: flex; }
html.preload body { overflow: hidden; }

.pre-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  color: var(--text);
  min-height: 1.2em;
}
.pre-name b { font-weight: 400; opacity: 0; display: inline-block; }
.pre-counter {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: clamp(3rem, 10vw, 7rem);
  color: var(--accent);
  line-height: 1;
}

/* ---------- custom cursor ---------- */
.cursor-dot, .cursor-ring { display: none; }

@media (hover: hover) and (pointer: fine) {
  html.motion .cursor-dot {
    display: block;
    position: fixed;
    top: 0; left: 0;
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1001;
    transform: translate(-50%, -50%);
  }
  html.motion .cursor-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0;
    width: 36px; height: 36px;
    border: 1px solid rgba(255, 46, 99, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1001;
    transform: translate(-50%, -50%);
    transition: width 0.35s var(--ease), height 0.35s var(--ease),
                background-color 0.35s var(--ease);
  }
  html.motion .cursor-ring.is-label {
    width: 72px; height: 72px;
    background: rgba(255, 46, 99, 0.12);
    backdrop-filter: blur(2px);
  }
  .cursor-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.25s var(--ease);
  }
  .cursor-ring.is-label .cursor-label { opacity: 1; }

  html.motion:not(.cursor-live) .cursor-dot,
  html.motion:not(.cursor-live) .cursor-ring { opacity: 0; }

  /* Custom cursor replaces the native one only when JS confirms it's running. */
  html.cursor-on, html.cursor-on * { cursor: none !important; }
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 0.55rem 0.6rem;
  padding-inline-start: 1.15rem;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
}
.nav.is-hidden { transform: translate(-50%, -160%); opacity: 0; }

.nav-logo {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.nav-links { display: flex; gap: 1.4rem; }
.nav-links a { font-size: 0.9rem; color: var(--muted); transition: color 0.3s var(--ease); }
.nav-links a:hover { color: var(--text); }

.lang { display: flex; gap: 0.15rem; }
.lang button {
  background: none;
  border: none;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  transition: color 0.3s var(--ease);
}
.lang button:hover { color: var(--text); }
.lang button.active { color: var(--accent); }
.lang-mm { margin-top: 2.2rem; }
.lang-mm button { font-size: 0.9rem; padding: 0.4rem 0.7rem 0.4rem 0; }

.btn-pill {
  display: inline-block;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background-color 0.3s var(--ease);
}
.btn-pill:hover { background: #ff4d78; }
.btn-pill:active { transform: scale(0.98); }
.nav-cta { padding: 0.5rem 1.1rem; font-size: 0.85rem; }

.nav-burger {
  display: none;
  width: 38px; height: 38px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}
.nav-burger span {
  position: absolute;
  left: 8px; right: 8px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.4s var(--ease), top 0.4s var(--ease);
}
.nav-burger span:nth-child(1) { top: 15px; }
.nav-burger span:nth-child(2) { top: 22px; }
.nav-burger.open span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.nav-burger.open span:nth-child(2) { top: 18px; transform: rotate(-45deg); }

/* ---------- mobile menu ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s var(--ease), visibility 0s linear 0.5s;
}
.mobile-menu.open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s var(--ease);
}
.mobile-menu nav { display: flex; flex-direction: column; gap: 0.4rem; }
.mobile-menu a {
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow: hidden;
  display: block;
}
.mobile-menu a span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.7s var(--ease);
}
.mobile-menu.open a span { transform: translateY(0); }
.mobile-menu.open a:nth-child(1) span { transition-delay: 0.08s; }
.mobile-menu.open a:nth-child(2) span { transition-delay: 0.16s; }
.mobile-menu.open a:nth-child(3) span { transition-delay: 0.24s; }
.mobile-menu.open a:nth-child(4) span { transition-delay: 0.32s; }
.mm-cta span { color: var(--accent); }
.mm-foot {
  position: absolute;
  bottom: 2rem; inset-inline-start: 2rem;
  color: var(--muted);
}

/* ---------- hero ---------- */
.hero {
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.5rem, 4vw, 4rem);
  overflow: hidden;
}

.code-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  will-change: transform;
}
.code-field span {
  position: absolute;
  white-space: nowrap;
  color: var(--text);
  opacity: 0.03;
}

.hero-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  width: 100%;
}
/* Keep the meta line clear of the scroll cue's column. */
@media (min-width: 768px) {
  .hero-inner { padding-inline-end: 5.5rem; }
}

.hero-name h1 {
  font-size: clamp(3rem, 9vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-transform: uppercase;
}
.hero-line { display: block; overflow: hidden; padding-bottom: 0.05em; }
.hero-chars { display: inline-block; }
.hero-chars b { display: inline-block; font-weight: 700; }
/* Before JS splits the name into letters, hide the whole line inside its mask. */
html.motion:not(.hero-done) .hero-chars { transform: translateY(115%); }

.hero-tag {
  margin-top: 1.4rem;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  color: var(--muted);
}
.hero-tag em {
  font-style: italic;
  color: var(--accent);
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  padding-bottom: 0.4rem;
}
.hero-meta .mono { color: var(--muted); }

html.motion .hero-fade { opacity: 0; transform: translateY(18px); }
html.motion.hero-done .hero-fade {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--ease) 0.55s, transform 0.8s var(--ease) 0.55s;
}
html.motion .nav { opacity: 0; }
html.motion.hero-done .nav { opacity: 1; transition: opacity 0.8s var(--ease) 0.8s, transform 0.6s var(--ease); }

.scroll-cue {
  position: absolute;
  inset-inline-end: clamp(1.5rem, 4vw, 4rem);
  bottom: clamp(1.5rem, 4vw, 4rem);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}
@media (min-width: 768px) { .scroll-cue { display: flex; } }
.cue-line {
  width: 1px; height: 56px;
  background: var(--hair);
  position: relative;
  overflow: hidden;
  display: block;
}
.cue-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  display: block;
}

/* ---------- work ---------- */
.work { position: relative; background: var(--bg); }

.slate {
  color: var(--muted);
  padding: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 4vw, 4rem) 0;
}

/* Inside the pinned section the slate overlays the panels,
   so the pinned height stays exactly one viewport. */
.work .slate {
  position: absolute;
  top: clamp(1.6rem, 4vw, 2.4rem);
  inset-inline-start: clamp(1.5rem, 4vw, 4rem);
  padding: 0;
  z-index: 5;
}

.work-viewport { position: relative; overflow: hidden; }

.work-track { display: block; }

html.motion .work-track { will-change: transform; }

@media (min-width: 768px) {
  html.motion .work-track {
    display: flex;
    width: max-content;
  }
  html.motion .panel { width: 100vw; height: 100vh; flex-shrink: 0; }
}

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5rem;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 5vw, 6rem);
  border-top: 1px solid var(--hair);
}

@media (min-width: 768px) {
  .panel { flex-direction: row; align-items: center; gap: clamp(2rem, 5vw, 6rem); border-top: none; }
  .panel-a .panel-copy { flex: 0 1 480px; }
  .panel-a .panel-media { flex: 0 1 660px; }
  .panel-b .panel-media { flex: 0 1 640px; }
  .panel-b .panel-copy { flex: 0 1 480px; }
  .panel-c { justify-content: flex-start; }
  .panel-c .panel-copy { flex: 0 1 440px; }
  .panel-c .panel-media { flex: 1 1 55%; max-width: 760px; }
}
/* Stacked on mobile: the picture always leads. */
@media (max-width: 767px) {
  .panel-media { order: -1; }
}

.panel:nth-child(even) { background: var(--bg-2); }

.panel-index {
  position: absolute;
  top: clamp(4rem, 10vh, 7rem);
  left: clamp(1rem, 3vw, 3rem);
  font-size: clamp(6rem, 18vw, 16rem);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(237, 237, 240, 0.14);
  pointer-events: none;
  user-select: none;
}

.panel-copy { position: relative; z-index: 2; }

.panel-title {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: uppercase;
}
.panel-title em { font-style: italic; color: var(--accent); }
/* Arabic names inside Latin titles: no italics, no tracking, a little smaller. */
.panel-title em[lang="ar"] {
  font-style: normal;
  letter-spacing: 0;
  font-size: 0.72em;
  font-family: "Rubik", sans-serif;
  margin-inline-start: 0.15em;
}

.panel-pitch {
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  max-width: 46ch;
}

.panel-feats {
  list-style: none;
  margin-top: 1.4rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.panel-feats li { padding-inline-start: 1.1rem; position: relative; }
.panel-feats li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0; top: 0.5em;
  width: 5px; height: 1px;
  background: var(--accent);
}

.panel-status { margin-top: 1.4rem; color: var(--accent); }

.panel-tags {
  margin-top: 1.5rem;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.9;
}
.panel-status + .panel-tags { margin-top: 0.5rem; }

.panel-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.8rem; margin-top: 1.6rem; }
.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.2rem;
  transition: color 0.3s var(--ease);
}
.panel-link:hover { color: var(--accent); }
.panel-link i { font-size: 1rem; }

.panel-media { position: relative; z-index: 2; }

.frame {
  position: relative;
  border: 1px solid var(--hair);
  background: #000;
}
html.motion .frame { will-change: transform; }
.frame video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.frame > img { width: 100%; height: auto; }
.frame figcaption {
  position: absolute;
  inset-inline-start: 0.8rem;
  bottom: 0.7rem;
  color: rgba(237, 237, 240, 0.75);
  background: rgba(10, 10, 12, 0.6);
  padding: 0.25rem 0.5rem;
}

/* Two phone screens side by side, offset like a contact sheet. */
.frame.phones {
  border: none;
  background: none;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(0.8rem, 2vw, 1.6rem);
}
.frame.phones img {
  width: auto;
  height: min(66vh, 600px);
  border: 1px solid var(--hair);
}
.frame.phones img:last-child { margin-top: clamp(1.5rem, 6vh, 3.5rem); }
@media (max-width: 767px) {
  .frame.phones img { height: auto; width: calc(50% - 0.4rem); }
}

/* Decivio clip switcher */
.clips { display: flex; gap: 0.4rem; margin-top: 0.8rem; }
.clip {
  font: inherit;
  background: none;
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.clip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
.clip:active { transform: scale(0.98); }
.clip.is-active { background: var(--accent); border-color: var(--accent); color: #000; }

.work-progress {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--hair);
}
@media (min-width: 768px) {
  html.motion .work-progress { display: block; }
}
.work-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- about ---------- */
.about {
  background: var(--bg-2);
  padding: clamp(5rem, 14vh, 9rem) clamp(1.5rem, 4vw, 4rem);
  border-top: 1px solid var(--hair);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  max-width: 1200px;
}
@media (min-width: 900px) {
  .about-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: start; }
}

.kinetic {
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  max-width: 24ch;
}
.kinetic em { font-style: italic; color: var(--accent); }
.kinetic .kw { display: inline-block; }

.about-side {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 340px;
}

.portrait {
  border: 1px solid var(--hair);
  overflow: hidden;
}
.portrait img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: scale(1.08); /* headroom so the scrubbed drift never shows edges */
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.6s var(--ease);
}
/* The one place color is allowed back in: meeting the person. */
.portrait:hover img { filter: grayscale(0) contrast(1); }

.about-card {
  border-inline-start: 1px solid var(--hair);
  padding-inline-start: 1.5rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  line-height: 1.9;
}

/* ---------- stack ---------- */
.stack {
  padding: clamp(5rem, 14vh, 9rem) 0;
  overflow: hidden;
  border-top: 1px solid var(--hair);
}

.marquee { display: flex; flex-direction: column; gap: 0.5rem; }
.marquee-row { overflow: hidden; white-space: nowrap; }
.marquee-inner {
  display: inline-flex;
  will-change: transform;
}
.marquee-inner span {
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px rgba(237, 237, 240, 0.3);
  white-space: nowrap;
}
.marquee-row:nth-child(2) .marquee-inner span {
  -webkit-text-stroke-color: rgba(255, 46, 99, 0.35);
}

.skills {
  margin: clamp(3.5rem, 8vh, 6rem) clamp(1.5rem, 4vw, 4rem) 0;
  max-width: 1000px;
}
.skill-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--hair);
}
.skill-row:last-child { border-bottom: 1px solid var(--hair); }
@media (min-width: 768px) {
  .skill-row { grid-template-columns: 220px 1fr; gap: 2rem; }
}
.skill-row .mono { color: var(--muted); padding-top: 0.2rem; }
.skill-row p:last-child { color: var(--text); font-size: 1rem; }

/* ---------- beyond ---------- */
.beyond {
  background: var(--bg-2);
  border-top: 1px solid var(--hair);
  padding-bottom: clamp(5rem, 12vh, 8rem);
}

.shelf {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin-top: 2.5rem;
  padding: 0 clamp(1.5rem, 4vw, 4rem);
  scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }

.shelf-card {
  flex: 0 0 min(78vw, 320px);
  scroll-snap-align: start;
  border: 1px solid var(--hair);
  padding: 1.6rem 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--bg);
  transition: border-color 0.4s var(--ease);
}
.shelf-card:hover { border-color: rgba(255, 46, 99, 0.5); }
.shelf-index { color: var(--accent); }
.shelf-card h4 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.shelf-card p { color: var(--muted); font-size: 0.95rem; flex-grow: 1; }
.shelf-tag { color: var(--muted); }

/* ---------- contact ---------- */
.contact {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(6rem, 16vh, 10rem) clamp(1.5rem, 4vw, 4rem) 1.5rem;
  border-top: 1px solid var(--hair);
}

.contact-title {
  font-size: clamp(3rem, 10vw, 8.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.contact-title em { font-style: italic; color: var(--accent); }

.contact-sub {
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: 44ch;
}

.email-link {
  position: relative;
  display: inline-block;
  margin-top: clamp(2rem, 5vh, 3.5rem);
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em;
  cursor: pointer;
  text-align: left;
  padding: 0 0 0.35rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.email-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.email-link:hover::after, .email-link:focus-visible::after { transform: scaleX(1); }

.email-copied {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  font-size: 1rem;
}
.email-link.copied .email-text { opacity: 0; transition: opacity 0.25s var(--ease); }
.email-link.copied .email-copied { opacity: 1; transition: opacity 0.25s var(--ease); }
.email-link .email-text { transition: opacity 0.25s var(--ease); }

.copy-hint { margin-top: 0.7rem; color: var(--muted); }

.btn-magnetic {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  align-self: flex-start;
  padding: 1rem 2.2rem;
  font-size: 1rem;
  will-change: transform;
}
/* GSAP drives this button's transform every frame; CSS must not transition it. */
html.motion .btn-magnetic { transition: background-color 0.3s var(--ease), opacity 0.8s var(--ease); }
html.motion .btn-magnetic.reveal { transform: none; }

.contact-links {
  display: flex;
  gap: 2rem;
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
  flex-wrap: wrap;
}
.contact-links a { color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; transition: color 0.3s var(--ease); }
.contact-links a:hover { color: var(--text); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  border-top: 1px solid var(--hair);
  padding-top: 1.2rem;
  margin-top: 4rem;
}

/* ---------- brand icons (Simple Icons, inlined as SVG so they work from file:// too) ---------- */
.ico {
  display: inline-block;
  flex: none;
  width: 1.1rem; height: 1.1rem;
  fill: currentColor;
}

/* Hero: the tool behind the daily work, with its spark turning slowly. */
.claude-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--text);
  transition: border-color 0.4s var(--ease), color 0.4s var(--ease);
}
.claude-badge:hover { border-color: rgba(255, 46, 99, 0.6); color: var(--accent); }
html.motion .ico-spin { animation: spark 14s linear infinite; }
html.motion .claude-badge:hover .ico-spin { animation-duration: 2.5s; }
@keyframes spark { to { transform: rotate(360deg); } }

.card-claude { display: flex; gap: 0.7rem; align-items: flex-start; }
.card-claude .ico { margin-top: 0.3rem; color: var(--text); }

/* Stack: the tools as marks, lighting up one by one. */
.logos {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 12 marks: 4 rows of 3 on phones */
  gap: 1px;
  margin: clamp(3rem, 7vh, 5rem) clamp(1.5rem, 4vw, 4rem) 0;
  max-width: 1000px;
  direction: ltr;
}
.logos li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.5rem 0.5rem 1.2rem;
  border: 1px solid var(--hair);
  color: var(--muted);
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: 0s, 0s, var(--d, 0s), var(--d, 0s);
}
@media (min-width: 768px) { .logos { grid-template-columns: repeat(6, minmax(0, 1fr)); } } /* 2 rows of 6 */
/* Outrank the generic .reveal transition so the stagger and hover both work. */
html.motion .logos li.reveal {
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: 0s, 0s, var(--d, 0s), var(--d, 0s);
}
.logos .ico { width: 1.7rem; height: 1.7rem; transition: transform 0.5s var(--ease); }
.logos li:hover { color: var(--text); border-color: rgba(255, 46, 99, 0.5); }
.logos li:hover .ico { transform: translateY(-4px) scale(1.08); color: var(--accent); }
.logos li:first-child { color: var(--text); }

/* Work panels: pointer light (desktop pointers only). */
@media (hover: hover) and (pointer: fine) {
  html.motion .panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 46, 99, 0.07), transparent 65%);
    opacity: 0;
    transition: opacity 0.6s var(--ease);
  }
  html.motion .panel:hover::before { opacity: 1; }
}

/* ---------- entrance reveals (motion only) ---------- */
html.motion .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
html.motion .reveal.in { opacity: 1; transform: none; }
html.motion .reveal:nth-child(2) { transition-delay: 0.08s; }
html.motion .reveal:nth-child(3) { transition-delay: 0.16s; }
html.motion .reveal:nth-child(4) { transition-delay: 0.24s; }
html.motion .reveal:nth-child(5) { transition-delay: 0.32s; }
html.motion .reveal:nth-child(6) { transition-delay: 0.4s; }

/* ---------- responsive nav ---------- */
@media (max-width: 767px) {
  .nav {
    left: 1rem; right: 1rem;
    transform: none;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .nav.is-hidden { transform: translateY(-160%); }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-burger { display: block; }
  /* Phone reel: the slate sits in the flow, each index number gets its own
     strip above the frame, and the progress bar rides the bottom edge. */
  .work .slate { position: static; padding: 3rem clamp(1.5rem, 4vw, 4rem) 0.5rem; }
  .panel { padding-top: 7.25rem; gap: 2rem; overflow: hidden; }
  .panel-index { font-size: 5.5rem; top: 1.25rem; left: 1.25rem; -webkit-text-stroke-color: rgba(237, 237, 240, 0.22); }
  html.motion .work-progress {
    display: block;
    position: fixed;
    z-index: 800;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
  }
  html.motion .work-progress.is-on { opacity: 1; }
  .shelf-card { flex-basis: 78vw; }
  .footer { flex-direction: column; gap: 0.4rem; }
}

/* Short laptop screens: keep each film frame inside one viewport. */
@media (min-width: 768px) and (max-height: 760px) {
  .panel { padding-block: 4.5rem 2rem; }
  .panel-title { font-size: clamp(2rem, 3.6vw, 2.8rem); }
  .panel-pitch { margin-top: 0.8rem; font-size: 0.98rem; }
  .panel-feats { margin-top: 0.9rem; gap: 0.3rem; }
  .panel-status { margin-top: 0.9rem; }
  .panel-tags { margin-top: 0.9rem; line-height: 1.7; }
  .panel-links { margin-top: 1rem; }
  .frame.phones img { height: min(60vh, 600px); }
}

/* ---------- Arabic & RTL ---------- */

/* Arabic script joins letters; tracking and tight leading would break it. */
html[lang="ar"] body * { letter-spacing: 0 !important; }
html[lang="ar"] .hero-name h1 { line-height: 1.15; font-size: clamp(2.6rem, 8vw, 7rem); }
html[lang="ar"] .panel-title, html[lang="ar"] .contact-title { line-height: 1.2; }
html[lang="ar"] .kinetic { line-height: 1.6; }
html[lang="ar"] em { font-style: normal; } /* Arabic has no italics; the accent color carries the emphasis */

/* Keep the horizontal film strip and marquee math left-to-right;
   only the content inside panels flips. */
/* The viewport must be LTR too, or the max-content track anchors to the right edge and the strip opens on the last panel. */
html[dir="rtl"] .work-viewport, html[dir="rtl"] .work-track { direction: ltr; }
html[dir="rtl"] .panel { direction: rtl; }
html[dir="rtl"] .marquee-row { direction: ltr; }
html[dir="rtl"] .code-field { direction: ltr; }
html[dir="rtl"] .panel-tags, html[dir="rtl"] .shelf-tag { direction: ltr; text-align: right; }

/* Latin wordmarks keep their own reading order inside RTL lines,
   so "AS." and "Decivio." never turn into ".AS" and ".Decivio". */
.nav-logo, .footer > span:last-child { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .panel-title { direction: ltr; text-align: right; }
html[dir="rtl"] .email-link { text-align: right; }
html[dir="rtl"] .email-copied { left: auto; right: 0; }

/* Arrows and hover underlines follow the reading direction. */
html[dir="rtl"] .ph-arrow-up-right { transform: scaleX(-1); }
html[dir="rtl"] .nav-links a::after,
html[dir="rtl"] .contact-links a::after,
html[dir="rtl"] .email-link::after { left: auto; right: 0; transform-origin: right; }
html[dir="rtl"] .lang-mm button { padding: 0.4rem 0 0.4rem 0.7rem; }

/* ---------- reduced motion: everything readable, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .scroll-cue, .cursor-dot, .cursor-ring, #preloader { display: none !important; }
  .marquee-inner { transform: none !important; }
}
