/* ==========================================================================
   Mohammed Maharm — portfolio
   Apple-style foundations: system type with size-specific tracking,
   translucent chrome, instant press feedback, springs for anything you touch.
   ========================================================================== */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --sheet: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hairline: rgba(0, 0, 0, 0.1);
  --chip: rgba(0, 0, 0, 0.05);
  --accent: #0066cc;
  --accent-fill: #0071e3;
  --accent-fill-hover: #0077ed;
  --accent-tint: rgba(0, 113, 227, 0.1);
  --nav-bg: rgba(251, 251, 253, 0.72);
  --behind: #000;
  --shadow-shot: 0 2px 6px rgba(0, 0, 0, 0.06), 0 20px 50px rgba(0, 0, 0, 0.14);
  --focus: 0 0 0 3px rgba(0, 113, 227, 0.55);

  --gutter: 16px;
  --max: 1120px;
  --radius-tile: 28px;
  --ease-out: cubic-bezier(0.22, 0.75, 0.2, 1);

  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;

  --feature-bg: #ffffff;
  --feature-glow: rgba(225, 29, 72, 0.10);
  --feature-eyebrow: #d70f4b;
  --feature-shot: 0 0 0 1px var(--hairline), 0 30px 70px rgba(0, 0, 0, 0.18);

  color-scheme: light dark;
}

/* Dark colours: from the system setting, unless the visitor picked a theme
   with the switch in the nav bar (stored as data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #161617;
    --sheet: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --hairline: rgba(255, 255, 255, 0.14);
    --chip: rgba(255, 255, 255, 0.09);
    --accent: #2997ff;
    --accent-tint: rgba(41, 151, 255, 0.16);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --shadow-shot: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 50px rgba(0, 0, 0, 0.55);
    --focus: 0 0 0 3px rgba(41, 151, 255, 0.6);
    --feature-bg: #0b0b0e;
    --feature-glow: rgba(225, 29, 72, 0.32);
    --feature-eyebrow: #ff6b81;
    --feature-shot: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 30px 80px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #161617;
    --sheet: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --hairline: rgba(255, 255, 255, 0.14);
    --chip: rgba(255, 255, 255, 0.09);
    --accent: #2997ff;
    --accent-tint: rgba(41, 151, 255, 0.16);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --shadow-shot: 0 2px 6px rgba(0, 0, 0, 0.4), 0 20px 50px rgba(0, 0, 0, 0.55);
    --focus: 0 0 0 3px rgba(41, 151, 255, 0.6);
    --feature-bg: #0b0b0e;
    --feature-glow: rgba(225, 29, 72, 0.32);
    --feature-eyebrow: #ff6b81;
    --feature-shot: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 30px 80px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  transition: background-color 0s;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 1.0625rem;            /* 17px body, Apple's reading size */
  line-height: 1.5;
  letter-spacing: -0.006em;
  color: var(--text);
  background: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

.page {
  background: var(--bg);
  min-height: 100vh;
  transform-origin: 50% 50%;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
ul, ol { margin: 0; padding: 0; list-style: none; }
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.86em;
  letter-spacing: 0;
  padding: 0.08em 0.36em;
  border-radius: 6px;
  background: var(--chip);
}
mark { color: inherit; }
button { font: inherit; color: inherit; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 12px; }

.wrap {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent-fill);
  color: #fff;
}
.skip:focus-visible { top: 10px; }

/* ---------- Reveal on scroll (only when JS is running) ----------
   Uses the individual `translate` property so it never fights the
   `scale` used for press feedback. */

.reveal {
  --rd: calc(var(--d, 0) * 70ms);
  transition:
    opacity 0.9s var(--ease-out) var(--rd),
    translate 0.9s var(--ease-out) var(--rd),
    scale var(--press, 0.32s) var(--ease-out);
}
.js .reveal:not(.in) { opacity: 0; translate: 0 28px; }

/* ---------- Press feedback: instant on pointer-down, gentle on release ---------- */

/* Tiles get their scale transition from .reveal, so the two never overwrite each other. */
.btn, .game .phone, .sheet-close, .nav-cta {
  transition: scale var(--press, 0.32s) var(--ease-out), background-color 0.2s, color 0.2s;
}
.btn:active, .sheet-close:active, .nav-cta:active { --press: 0.08s; scale: 0.96; }
.tile:active { --press: 0.08s; scale: 0.985; }
.game:active .phone { --press: 0.08s; scale: 0.96; }

/* ---------- Navigation: translucent material, edge appears only over content ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.nav::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--hairline);
  opacity: 0;
  transition: opacity 0.25s;
}
.nav.scrolled::after { opacity: 1; }

.nav-inner {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin-inline: auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  margin-right: auto;
}
.nav-name:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  display: block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.875rem;
  letter-spacing: 0.005em;
  color: var(--text-2);
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="true"] { color: var(--text); background: var(--chip); }
.nav-cta {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-fill);
  color: #fff;
}
.nav-cta:hover { background: var(--accent-fill-hover); text-decoration: none; }

@media (max-width: 560px) {
  .nav-inner { gap: 8px; }
  .nav-cta { display: none; }
  .nav-links a { padding: 6px 8px; }
  .nav-name { font-size: 1rem; }
}
@media (max-width: 360px) {
  .nav-name { font-size: 0.9375rem; }
  .nav-links a { padding: 6px 6px; font-size: 0.8125rem; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 0;
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-fill { background: var(--accent-fill); color: #fff; }
.btn-fill:hover { background: var(--accent-fill-hover); }
.btn-tinted { background: var(--accent-tint); color: var(--accent); }
.btn-plain { color: var(--accent); padding-inline: 10px; }
.btn-plain:hover { text-decoration: underline; }
.btn-large { min-height: 52px; padding: 14px 28px; font-size: 1.1875rem; }

/* ---------- Hero ---------- */

.hero {
  padding: clamp(56px, 10vw, 128px) 0 clamp(64px, 9vw, 112px);
  text-align: center;
}
.avatar {
  width: 112px;
  height: 112px;
  margin: 0 auto 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--chip);
  box-shadow: 0 0 0 1px var(--hairline), 0 12px 32px rgba(0, 0, 0, 0.16);
}
.hero-hello {
  font-family: var(--font-display);
  font-size: clamp(1.3125rem, 1.05rem + 1vw, 1.75rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text-2);
  margin-bottom: 14px;
}
.hero-title {
  max-width: 15ch;
  margin: 0 auto;
  font-size: clamp(2.625rem, 1.4rem + 5.6vw, 5.75rem);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: -0.038em;     /* large display text wants negative tracking */
  text-wrap: balance;
}
.hero-lede {
  max-width: 36rem;
  margin: 28px auto 0;
  font-size: clamp(1.1875rem, 1.05rem + 0.55vw, 1.5rem);
  line-height: 1.42;
  letter-spacing: -0.014em;
  color: var(--text-2);
  text-wrap: pretty;
}
.hero-actions {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 16px;
}

/* ---------- Stats ---------- */

.stats { padding-bottom: clamp(56px, 8vw, 96px); }
.stats-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding: 28px 20px 0 0;
}
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--hairline); }
.stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.stat dt {
  font-size: 0.9375rem;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--text-2);
  max-width: 14em;
}
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); border-top: 0; }
  .stat, .stat + .stat { padding: 22px 16px 22px 0; border-left: 0; border-top: 1px solid var(--hairline); }
  .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--hairline); }
}

/* ---------- Sections ---------- */

.section { padding: clamp(64px, 8vw, 112px) 0; }
.section-head { max-width: 46rem; margin-bottom: clamp(36px, 5vw, 56px); }
.eyebrow {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.006em;
  color: var(--text-2);
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(2.25rem, 1.45rem + 3.6vw, 4rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.section-lede {
  margin-top: 18px;
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.3125rem);
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ---------- Project tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 800px) {
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-top: clamp(36px, 5vw, 52px);
  border-radius: var(--radius-tile);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { text-decoration: none; }
.tile:focus-visible { border-radius: var(--radius-tile); }

.tile-copy { padding-inline: clamp(24px, 4vw, 48px); }
.tile-eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text-2);
  margin-bottom: 8px;
}
.tile-title {
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.026em;
  text-wrap: balance;
}
.tile-text {
  max-width: 26em;
  margin: 12px auto 0;
  font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text-2);
  text-wrap: pretty;
}
.tile-more {
  display: inline-block;
  margin-top: 14px;
  font-size: 1.0625rem;
  color: var(--accent);
}
.tile-more span { display: inline-block; transition: translate 0.3s var(--ease-out); }
@media (hover: hover) {
  .tile:hover .tile-more span { translate: 3px 0; }
  .tile:hover .tile-visual > * { translate: 0 -6px; }
}

.tile-visual {
  margin-top: auto;
  padding: clamp(28px, 4vw, 44px) clamp(20px, 4vw, 44px) 0;
  height: 340px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
/* Visuals run off the bottom edge of the tile, like a device peeking up */
.tile-visual > * { transition: translate 0.5s var(--ease-out); margin-bottom: -12px; }

.shot {
  width: 100%;
  height: calc(100% + 12px);
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  background: #0d0d10;
}
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

/* Featured tile: always dark, like a stage */
.tile-feature {
  grid-column: 1 / -1;
  min-height: 0;
  background:
    radial-gradient(60% 55% at 50% 100%, var(--feature-glow), transparent 70%),
    var(--feature-bg);
  color: var(--text);
}
.tile-feature .tile-eyebrow { color: var(--feature-eyebrow); }
.tile-feature .tile-title { font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem); }
.tile-feature .tile-text { color: var(--text-2); max-width: 30em; }
.tile-feature .tile-more { color: var(--accent); }
.tile-feature .tile-visual { height: clamp(260px, 44vw, 540px); padding-inline: clamp(16px, 6vw, 96px); }
.tile-feature .shot { box-shadow: var(--feature-shot); }
.tile-feature .shot img { object-position: 50% 42%; }

/* Mock: TRLearn dual-subtitle player */
.mock-player {
  width: min(100%, 460px);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  background: #0f0f12;
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  text-align: left;
}
.mp-video {
  position: relative;
  aspect-ratio: 2.35 / 1;
  background:
    radial-gradient(40% 60% at 72% 40%, rgba(255, 196, 120, 0.85), transparent 70%),
    linear-gradient(160deg, #2b2149 0%, #7a3b62 55%, #e08a5b 100%);
}
.mp-card {
  position: absolute;
  left: 18px;
  top: 18px;
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  color: #1d1d1f;
}
.mp-word { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.mp-root { font-size: 0.8125rem; color: #424245; letter-spacing: 0.005em; }
.mp-subs { padding: 16px 20px 12px; text-align: center; }
.mp-tr { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; color: #fff; }
.mp-tr mark { background: rgba(255, 214, 10, 0.22); color: #ffd60a; border-radius: 5px; padding: 0 3px; }
.mp-en { margin-top: 4px; font-size: 0.9375rem; color: #a1a1a6; }
.mp-bar { margin: 6px 20px 18px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.mp-bar span { display: block; width: 38%; height: 100%; border-radius: inherit; background: #fff; }

/* Mock: Pomodoro timer */
.mock-timer {
  width: min(100%, 360px);
  padding: 36px 24px 48px;
  border-radius: 20px 20px 0 0;
  background: #1c1c1e;
  color: #f5f5f7;
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
}
.mt-label { font-size: 0.9375rem; font-weight: 600; color: #ff6b57; letter-spacing: 0.01em; }
.mt-time {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.mt-buttons { margin-top: 24px; display: flex; justify-content: center; gap: 16px; }
.mt-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2c2c2e;
}
.mt-btn:first-child { background: #ff6b57; }
.mt-btn svg { width: 22px; height: 22px; fill: #fff; }

/* ---------- Games ---------- */

.games-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 8px max(var(--gutter), (100% - var(--max)) / 2) 24px;
  scroll-padding-inline: max(var(--gutter), (100% - var(--max)) / 2);
  scrollbar-width: none;
}
.games-scroller::-webkit-scrollbar { display: none; }

.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
  scroll-snap-align: center;
  -webkit-tap-highlight-color: transparent;
}
.game:focus-visible { border-radius: 24px; }
.game-name {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: 1.3125rem;
  font-weight: 600;
  letter-spacing: -0.016em;
}
.game-text { max-width: 15rem; font-size: 1rem; line-height: 1.4; color: var(--text-2); }
@media (hover: hover) {
  .game:hover .game-name { color: var(--accent); }
}

/* A KaiOS-style candybar phone: screen, speaker slot, D-pad ring */
.phone {
  position: relative;
  display: block;
  width: 232px;
  padding: 30px 14px 74px;
  border-radius: 36px 36px 30px 30px;
  background: linear-gradient(180deg, #2c2c30, #18181b);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 24px 50px rgba(0, 0, 0, 0.22);
}
.phone::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 50%;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 3px;
  background: #0a0a0c;
}
.phone::after {
  content: "";
  position: absolute;
  bottom: 18px;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 9px #222226, inset 0 0 0 11px rgba(255, 255, 255, 0.1);
}
.phone img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  image-rendering: auto;
  background: #000;
}

/* ---------- About ---------- */

.about-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
}
@media (max-width: 800px) {
  .about-body { grid-template-columns: minmax(0, 1fr); }
}
.about-text p {
  font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.4375rem);
  line-height: 1.5;
  letter-spacing: -0.014em;
  color: var(--text-2);
  text-wrap: pretty;
}
.about-text p + p { margin-top: 1em; }
.about-text p:first-child { color: var(--text); }

.side-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.006em;
  margin-bottom: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 0.9375rem;
  letter-spacing: 0;
}

.timeline { margin-top: clamp(56px, 8vw, 96px); }
.timeline ol { border-bottom: 1px solid var(--hairline); }
.timeline li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
}
.tl-year {
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Contact & footer ---------- */

.contact {
  padding: clamp(64px, 9vw, 128px) 0 clamp(80px, 10vw, 140px);
  text-align: center;
  background: var(--surface);
}
.contact-title {
  font-size: clamp(2.25rem, 1.45rem + 3.6vw, 4rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.032em;
}
.contact-text {
  max-width: 30rem;
  margin: 16px auto 32px;
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.3125rem);
  line-height: 1.45;
  color: var(--text-2);
}

.footer {
  padding: 20px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  font-size: 0.75rem;
  letter-spacing: 0.01em;     /* small text wants slightly positive tracking */
  color: var(--text-3);
}
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }

/* ---------- Sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(760px, 100%);
  max-height: calc(100dvh - 24px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: var(--sheet);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  transform: translate3d(0, 110%, 0);
  will-change: transform;
}
/* Extends the material below the screen so a bouncy settle never shows a gap */
.sheet::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 240px;
  background: inherit;
}
@media (min-width: 800px) {
  .sheet { max-height: calc(100dvh - 48px); border-radius: 26px 26px 0 0; }
}

.sheet-handle {
  position: relative;
  flex: none;
  padding: 8px clamp(20px, 4vw, 32px) 14px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.sheet-handle:active { cursor: grabbing; }
.sheet-handle::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--hairline);
  opacity: 0;
  transition: opacity 0.2s;
}
.sheet-handle.edge::after { opacity: 1; }
.grabber {
  display: block;
  width: 38px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 3px;
  background: var(--text-3);
  opacity: 0.45;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sheet-eyebrow { font-size: 0.875rem; font-weight: 600; color: var(--text-2); letter-spacing: 0.005em; }
.sheet-title {
  margin-top: 2px;
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.026em;
}
.sheet-title:focus-visible { box-shadow: none; }
.sheet-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text-2);
  cursor: pointer;
}
.sheet-close svg { width: 18px; height: 18px; fill: currentColor; }
.sheet-close:hover { color: var(--text); }
.sheet-close:focus-visible { border-radius: 50%; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px clamp(20px, 4vw, 32px) calc(36px + env(safe-area-inset-bottom));
}
.sheet-figure {
  margin: 0 0 24px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--chip);
  box-shadow: 0 0 0 1px var(--hairline);
}
.sheet-figure.dark { background: #0d0d10; }
.sheet-figure img { width: 100%; max-height: 380px; object-fit: cover; object-position: center top; }
.sheet-figure.phone-figure {
  display: flex;
  justify-content: center;
  padding: 28px 0;
  background: var(--chip);
  box-shadow: none;
}
.sheet-figure .phone { width: 200px; padding: 26px 12px 64px; }
.sheet-figure .phone::after { bottom: 14px; }

.sheet-lede {
  font-size: clamp(1.1875rem, 1.1rem + 0.3vw, 1.3125rem);
  line-height: 1.45;
  letter-spacing: -0.014em;
  text-wrap: pretty;
}
.sheet-body h3 {
  margin: 30px 0 12px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.006em;
}
.sheet-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text-2);
  text-wrap: pretty;
}
.sheet-list li + li { margin-top: 10px; }
.sheet-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.66em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.sheet-list strong { color: var(--text); font-weight: 600; }
.sheet-note { margin-top: 24px; font-size: 0.9375rem; color: var(--text-2); }
.sheet-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 560px) {
  .sheet-actions .btn { flex: 1 1 100%; }
}

/* While a sheet is up: the page steps back into the dark */
html.sheet-open { background: var(--behind); overflow: hidden; scroll-behavior: auto; }
html.sheet-open .page { border-radius: 14px; overflow: clip; will-change: transform; }

/* ---------- Accessibility preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal:not(.in) { translate: none; }
  .reveal { transition: opacity 0.4s ease; }
  .tile-visual > *, .tile-more span { transition: none; }
  .tile:hover .tile-visual > *, .tile:hover .tile-more span { translate: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mp-card { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --hairline: rgba(0, 0, 0, 0.4); --text-2: #3a3a3c; }
  .tile, .sheet { box-shadow: 0 0 0 1px var(--hairline); }
  .nav { background: var(--bg); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --hairline: rgba(255, 255, 255, 0.5); --text-2: #d1d1d6; }
}

/* ==========================================================================
   CV page (index.html): chemical engineering first, coding on coding.html
   ========================================================================== */

/* Keep the bar short on phones: Research, Projects and Coding stay. */
@media (max-width: 780px) { .nav-links .nav-opt { display: none; } }

/* Mock: simplified PTA process flow, read top to bottom */
.mock-pfd {
  width: min(100%, 300px);
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 22px 18px 30px;
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  font-size: 0.9375rem;
}
.mock-pfd span {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--hairline);
  font-weight: 500;
}
.mock-pfd i { width: 2px; height: 16px; background: var(--text-3); position: relative; }
.mock-pfd i::after {
  content: ""; position: absolute; left: -4px; bottom: -1px;
  border: 5px solid transparent; border-top-color: var(--text-3); border-bottom: 0;
}
.mock-pfd .pfd-out { background: var(--accent-fill); color: #fff; box-shadow: none; }

/* Mock: water droplet beading on a coated fabric */
.mock-drop {
  width: min(100%, 380px);
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  display: flex; align-items: center; justify-content: center;
}
.mock-drop svg { width: 100%; height: auto; display: block; }
.mock-drop .drop { fill: rgba(0, 113, 227, 0.22); stroke: var(--accent-fill); stroke-width: 2; }
.mock-drop .fabric { stroke: var(--text-2); stroke-width: 4; stroke-dasharray: 2 6; stroke-linecap: round; }
.mock-drop .shine { fill: rgba(255, 255, 255, 0.7); }
.mock-drop text { fill: var(--text); font: 600 15px var(--font-text); }

/* Skills grid */
.cv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 800px) { .cv-grid { grid-template-columns: minmax(0, 1fr); } }
.cv-block {
  padding: clamp(22px, 3vw, 32px);
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.lang-list li { padding: 12px 0; border-top: 1px solid var(--hairline); }
.lang-list li:first-child { border-top: 0; padding-top: 0; }
.lang-name { font-weight: 600; margin-right: 10px; }
.lang-level { color: var(--text-2); }
.lang-detail { display: block; margin-top: 4px; font-size: 0.875rem; color: var(--text-3); }

/* Education honors list: the shared timeline, without the big top margin */
.cv-list { margin-top: 0; }

/* Contact: one main button, then quiet links */
.contact-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
  margin-top: 24px; font-size: 1.0625rem;
}

/* ---------- Light / dark switch ---------- */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px;
  background: var(--chip); color: var(--text); cursor: pointer;
  transition: background-color 0.2s, scale 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { background: var(--hairline); }
.theme-toggle:active { scale: 0.92; }
.theme-toggle svg { width: 17px; height: 17px; fill: currentColor; }
.theme-toggle[data-mode="dark"] .i-sun,
.theme-toggle:not([data-mode="dark"]) .i-moon { display: none; }

/* Phone, city and birth year under the email button */
.contact-facts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px;
  margin-top: 18px; font-size: 1.0625rem; color: var(--text-2);
}
.contact-facts li + li::before { content: "·"; margin-right: 10px; color: var(--text-3); }

/* Instagram reels */
.reels {
  display: grid; gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 260px));
}
@media (max-width: 560px) { .reels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.reel { display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.reel:hover { text-decoration: none; }
.reel img {
  width: 100%; aspect-ratio: 9 / 14; object-fit: cover;
  border-radius: 18px; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  margin-bottom: 8px; transition: translate 0.4s var(--ease-out);
}
@media (hover: hover) { .reel:hover img { translate: 0 -4px; } }
.reel-title { font-weight: 600; font-size: 1.0625rem; line-height: 1.35; }
.reel-sub { font-size: 0.9375rem; color: var(--text-2); }
.reels-cta { margin-top: 32px; }

/* Wide (full-row) light tile, e.g. the water-potability project */
.tile-wide { grid-column: 1 / -1; }

/* Mock: stylised ROC curve for the water-potability tile */
.mock-roc {
  width: min(100%, 440px);
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-shot);
  padding: 8px 12px 0;
}
.mock-roc svg { width: 100%; height: auto; display: block; }
.mock-roc .axis { stroke: var(--text-3); stroke-width: 1.5; }
.mock-roc .chance { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 5 5; }
.mock-roc .curve { fill: none; stroke: var(--accent-fill); stroke-width: 3; stroke-linecap: round; }
.mock-roc .lbl { fill: var(--text-2); font: 12px var(--font-text); }
.mock-roc .lbl-strong { fill: var(--text); font: 600 14px var(--font-text); }

.cv-span { grid-column: 1 / -1; }
.cv-note { margin-top: 14px; font-size: 0.9375rem; color: var(--text-2); }

/* ==========================================================================
   Phone-only fixes (nothing here applies on a PC-width screen)
   ========================================================================== */
@media (max-width: 780px) {
  /* The bar must fit one line from 360px to 780px, or the page scrolls sideways. */
  .nav-inner { gap: 6px; }
  .nav-name { font-size: 0; flex: none; }
  .nav-name::after { content: "Mohammed"; font-size: 1rem; letter-spacing: -0.01em; }
  .nav-links { gap: 0; min-width: 0; }
  .nav-links a { padding: 9px 7px; }
  .nav-name { padding-block: 8px; }
  .theme-toggle { flex: none; width: 36px; height: 36px; }
}

/* Internship entries: title line, then date and a short description */
.tl-when { display: block; margin-top: 4px; font-size: 0.9375rem; color: var(--text-3); }
.tl-detail { display: block; margin-top: 8px; color: var(--text-2); max-width: 44rem; }

/* "Experience" joins the bar only where there is room for it */
@media (max-width: 900px) { .nav-links .nav-wide { display: none; } }
@media (max-width: 359px) { .nav-links a { padding-inline: 4px; } .nav-inner { gap: 4px; } }
/* Phones: year above each entry, so the text gets the full width */
@media (max-width: 600px) { .cv-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Convert to QR tile: a phone-width window aimed at the QR code */
[data-sheet="convertqr"] .shot { width: min(100%, 440px); }
[data-sheet="convertqr"] .shot img { object-position: 50% 66%; }
