/* ============================================================
   SUHAIB AL SMADI — 2026 Portfolio identity
   Josefin Sans · Roboto Condensed · grey palette · slate #2E4F4F
   ============================================================ */

:root {
  /* ---- Light theme (default): warm paper, ink and terracotta ---- */
  --bg:            #f6f1e8;
  --bg-1:          #efe8db;
  --bg-2:          #faf6ef;
  --panel:         #ece4d6;
  --panel-2:       #fbf8f2;
  --paper:         #fbf8f2;   /* sheets that model views sit on */
  --line:          rgba(58,44,32,0.13);
  --line-strong:   rgba(58,44,32,0.27);
  --text:          #2a221c;
  --text-dim:      #6b5f55;
  --text-faint:    #9a8d80;
  --accent:        #a3562f;   /* terracotta */
  --accent-bright: #bd6a3f;
  --accent-deep:   #7c3f20;
  --accent-soft:   rgba(163,86,47,0.1);
  --on-accent:     #fdf8f1;
  --grid-line:     rgba(58,44,32,0.05);
  --shadow:        rgba(58,40,24,0.28);

  /* ---- Type ---- */
  --sans: "Josefin Sans", "Futura", system-ui, sans-serif;
  --mono: "Roboto Condensed", "Arial Narrow", sans-serif;   /* labels & data */
  --arabic: "IBM Plex Sans Arabic", "Josefin Sans", sans-serif;
  --serif: "Josefin Sans", system-ui, sans-serif;
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --on-dark: #f5eee4;

  --maxw: 1440px;
  --gut: clamp(20px, 5vw, 80px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg:            #16120f;
  --bg-1:          #1b1612;
  --bg-2:          #1f1915;
  --panel:         #221b16;
  --panel-2:       #29211b;
  --paper:         #1a1511;
  --line:          rgba(255,236,214,0.1);
  --line-strong:   rgba(255,236,214,0.2);
  --text:          #f0e8dd;
  --text-dim:      #b3a698;
  --text-faint:    #7f7367;
  --accent:        #e09a6d;
  --accent-bright: #edb48d;
  --accent-deep:   #b8714a;
  --accent-soft:   rgba(224,154,109,0.13);
  --on-accent:     #1a1410;
  --grid-line:     rgba(255,236,214,0.045);
  --shadow:        rgba(0,0,0,0.5);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

[dir="rtl"] body, [dir="rtl"] .lang-ar { font-family: var(--arabic); font-weight: 400; }
[dir="rtl"] { letter-spacing: 0 !important; }

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

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-weight: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; max-width: 100%; }
strong, b { font-weight: 600; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   Layout helpers
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gut); width: 100%; }

/* Letter-spaced label — the portfolio's "P R O J E C T · 2 0 2 6" voice */
.eyebrow {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
[dir="rtl"] .eyebrow { letter-spacing: 0.04em; font-family: var(--arabic); }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; display: inline-block; flex-shrink: 0; }

.mono { font-family: var(--mono); font-weight: 400; }
[dir="rtl"] .mono { font-family: var(--arabic); }

/* Display type: Josefin Sans Light, with a Thin second voice */
.display {
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
[dir="rtl"] .display { letter-spacing: 0; line-height: 1.2; font-weight: 500; }

.serif { font-weight: 100; }
.about__titleline:nth-child(2), .bim__titleline:nth-child(2), .contact__titleline:nth-child(2),
.hero__line:not(:first-child), .footer__tline:last-child {
  font-weight: 100; color: var(--accent);
}
[dir="rtl"] .about__titleline:nth-child(2), [dir="rtl"] .bim__titleline:nth-child(2), [dir="rtl"] .contact__titleline:nth-child(2),
[dir="rtl"] .hero__line:not(:first-child), [dir="rtl"] .footer__tline:last-child { font-weight: 300; }

/* Masked word-by-word reveal (see SplitText / MaskTitle) */
.reveal.reveal--mask { opacity: 1; transform: none; display: block; }
.split__w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.06em 0.06em 0.16em 0; margin: -0.06em -0.06em -0.16em 0; }
.split__i { display: inline-block; transform: translate3d(0, 112%, 0); transition: transform 1.2s var(--ease); will-change: transform; }
.reveal.in .split__i { transform: none; }
.reveal.settled .split__i { transform: none; transition: none; will-change: auto; }
@media (prefers-reduced-motion: reduce) { .split__i { transform: none; transition: none; } }

/* Surfaces that always sit on a dark image, whatever the theme */
.lb {
  --bg: #110d0a; --panel: #1c1611; --panel-2: #241c16;
  --text: var(--on-dark); --text-dim: rgba(242,244,243,0.74); --text-faint: rgba(242,244,243,0.5);
  --line: rgba(255,255,255,0.12); --line-strong: rgba(255,255,255,0.26);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px 15px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
  transition: color 0.45s var(--ease), border-color 0.45s var(--ease);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  isolation: isolate;
}
[dir="rtl"] .btn { letter-spacing: 0.02em; font-family: var(--arabic); }
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent);
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.55s var(--ease);
}
.btn:hover::before { transform: scaleY(1); }
.btn .arrow { transition: transform 0.4s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
[dir="rtl"] .btn .arrow { transform: scaleX(-1); }
[dir="rtl"] .btn:hover .arrow { transform: translateX(-4px) scaleX(-1); }
.btn:hover { border-color: var(--accent); color: var(--on-accent); }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary::before { background: var(--text); }
.btn--primary:hover { border-color: var(--text); color: var(--bg); }
.btn--ghost { border-color: transparent; color: var(--text-dim); padding-inline: 12px; }
.btn--ghost::before { display: none; }
.btn--ghost:hover { border-color: transparent; color: var(--accent); }

/* Status chip — "PRODUCTION · V2.0.0", "PROTOTYPE · MVP MODE" */
.chip {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); border: 1px solid currentColor; padding: 6px 11px 5px;
}
[dir="rtl"] .chip { letter-spacing: 0; font-family: var(--arabic); }

/* ============================================================
   Background wireframe grid (drifting)
   ============================================================ */
.gridbg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: gridDrift 60s linear infinite;
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 35%, transparent 95%);
  -webkit-mask-image: radial-gradient(120% 100% at 50% 0%, #000 35%, transparent 95%);
}
@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 64px 64px, 64px 64px; }
}
@media (prefers-reduced-motion: reduce) { .gridbg { animation: none; } }

/* ============================================================
   Reveal on scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal.settled { transition: none; opacity: 1; transform: none; will-change: auto; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Images inside a reveal open like a sheet being unrolled */
.reveal .ph--filled, .reveal .ph--art { clip-path: inset(0 0 100% 0); transition: clip-path 1.4s var(--ease-io); }
.reveal.in .ph--filled, .reveal.in .ph--art { clip-path: inset(0 0 0 0); }
.reveal.settled .ph--filled, .reveal.settled .ph--art { clip-path: none; }
@media (prefers-reduced-motion: reduce) { .reveal .ph--filled, .reveal .ph--art { clip-path: none; transition: none; } }

/* ============================================================
   Image slot
   ============================================================ */
.ph {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph__label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-faint); z-index: 2; text-align: center; padding: 0 12px; }
.ph__tick { position: absolute; width: 12px; height: 12px; border-color: var(--line-strong); z-index: 2; }
.ph__tick--tl { top: 10px; left: 10px; border-top: 1px solid; border-left: 1px solid; }
.ph__tick--tr { top: 10px; right: 10px; border-top: 1px solid; border-right: 1px solid; }
.ph__tick--bl { bottom: 10px; left: 10px; border-bottom: 1px solid; border-left: 1px solid; }
.ph__tick--br { bottom: 10px; right: 10px; border-bottom: 1px solid; border-right: 1px solid; }
.ph--filled, .ph--art { border-color: transparent; }
.ph--filled .ph__tick { opacity: 0; transition: opacity 0.4s var(--ease); border-color: var(--accent); }
button:hover .ph--filled .ph__tick { opacity: 1; }
.ph__pan { position: absolute; inset: 0; will-change: transform; }
.ph__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1s var(--ease), transform 1.4s var(--ease), filter 0.6s var(--ease);
  animation: imgFallback 0s 3s forwards; /* never leave an image invisible */
}
.ph__img.is-loaded { opacity: 1; }
@keyframes imgFallback { to { opacity: 1; } }

/* Greyscale model views sit on white: crisp on paper, and a dark CAD viewport
   in dark mode */
.ph--grey { background: var(--paper); }
.ph--grey .ph__img { mix-blend-mode: multiply; }
.ph--grey .ph__pan, .ph--paper .ph__pan { background: var(--paper); }  /* the pan is its own blend group */
.ph--paper { background: var(--panel-2); }
.ph--contain .ph__img, .ph--paper .ph__img { object-fit: contain; padding: 6%; }
[data-theme="dark"] .ph--grey { background: var(--paper); }
[data-theme="dark"] .ph--grey .ph__img { filter: invert(1) sepia(0.3) brightness(0.86); mix-blend-mode: screen; }
[data-theme="dark"] .ph--paper .ph__img, [data-theme="dark"] .invert-dark { filter: invert(0.88) hue-rotate(180deg) sepia(0.3); }
/* Tool icons and drawings carry the slate of the printed portfolio; pull them warm */
.tool-icon, .ph--paper .ph__img { filter: sepia(0.55) saturate(1.3) hue-rotate(-12deg); }
.ph--paper .ph__img { mix-blend-mode: multiply; }
[data-theme="dark"] .ph--paper .ph__img { mix-blend-mode: normal; }

/* Caption under an image, portfolio style */
.figcap { display: flex; gap: 10px; align-items: baseline; margin-top: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.45; color: var(--text-dim); letter-spacing: 0.02em; }
.figcap__ai { flex-shrink: 0; font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: #8a5a1f; border: 1px solid rgba(138,90,31,0.45); padding: 3px 6px 2px; }
[data-theme="dark"] .figcap__ai { color: #d9a866; border-color: rgba(217,168,102,0.45); }
[dir="rtl"] .figcap__ai { letter-spacing: 0; }

/* ---- Drawn project covers (ProjectArt) ---- */
.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.art-bg { fill: var(--panel-2); }
.art-gridline { fill: none; stroke: var(--line); stroke-width: 0.5; }
.art-glow0 { stop-color: var(--accent); stop-opacity: 0.1; }
.art-glow1 { stop-color: var(--accent); stop-opacity: 0; }
.art-line { fill: none; stroke: var(--text-faint); stroke-width: 0.8; opacity: 0.75; }
.art-line--strong { stroke: var(--text-dim); stroke-width: 1.1; opacity: 0.8; }
.art-fill { fill: var(--line-strong); stroke: var(--text-dim); stroke-width: 0.6; }
.art-fill--accent { fill: var(--accent-soft); stroke: var(--accent); }
.art-dot { fill: var(--accent); }
.art-tag { fill: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; }
.art-code { fill: var(--text-faint); font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; }
.art-bar { fill: var(--accent); }
.art-bar--dim { fill: var(--line-strong); }
.art-big { fill: var(--text); font-family: var(--sans); font-weight: 200; font-size: 64px; letter-spacing: -0.02em; }
.art-label { fill: var(--text-dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }

/* ============================================================
   Section scaffolding
   ============================================================ */
.section { position: relative; z-index: 1; padding-block: clamp(80px, 11vw, 170px); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(40px, 5vw, 72px); }

.rule { height: 1px; background: var(--line); width: 100%; }

/* Number ticker baseline */
.tabnum { font-variant-numeric: tabular-nums; }

/* Calm motion mode (Tweak) */
body.soft-motion .gridbg { animation: none; }
body.soft-motion .reveal { transition-duration: 0.5s; transform: translateY(12px); }

/* utility */
.up { text-transform: uppercase; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
