/* ==========================================================================
   moatazsamy.com — base
   Tokens, reset, type, buttons, header, footer, cursor.
   ========================================================================== */

/* The six chameleon tokens. Registering them as colours is what lets the browser
   interpolate them, so one transition on :root moves every surface together. */
@property --bg        { syntax: '<color>'; inherits: true; initial-value: #0A0A0A; }
@property --fg        { syntax: '<color>'; inherits: true; initial-value: #FAFAFA; }
@property --accent    { syntax: '<color>'; inherits: true; initial-value: #FAFAFA; }
@property --on-accent { syntax: '<color>'; inherits: true; initial-value: #0A0A0A; }
@property --muted     { syntax: '<color>'; inherits: true; initial-value: #9F9F9F; }
@property --line-c    { syntax: '<color>'; inherits: true; initial-value: #3A3A3A; }

:root {
  --bg: #0A0A0A;
  --fg: #FAFAFA;
  --accent: #FAFAFA;
  --on-accent: #0A0A0A;
  --muted: #9F9F9F;
  --line-c: #3A3A3A;

  --font: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  /* Set by js/theme.js while a project is in view. */
  --display: var(--font);
  --display-weight: 600;
  --display-stretch: 100%;

  --shift: 600ms;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --gut: 16px;
  --max: 1320px;
  --header-h: 60px;
  --radius: 14px;

  transition:
    --bg var(--shift) var(--ease), --fg var(--shift) var(--ease),
    --accent var(--shift) var(--ease), --on-accent var(--shift) var(--ease),
    --muted var(--shift) var(--ease), --line-c var(--shift) var(--ease);
  color-scheme: dark;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (min-width: 768px) {
  :root { --gut: 32px; --header-h: 68px; }
}
@media (min-width: 1440px) {
  :root { --gut: 60px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

h1, h2, h3 { font-weight: 500; letter-spacing: -0.03em; line-height: 1.02; text-wrap: balance; }
h2 { font-size: clamp(2.25rem, 6.4vw, 4.5rem); }

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

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- buttons, tags ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 52px; padding: 0 1.5em;
  border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 1rem; line-height: 1; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease-out), opacity .25s;
}
.btn--small { min-height: 40px; padding: 0 1.1em; font-size: .875rem; }
.btn__arrow { display: inline-block; transition: transform .25s var(--ease-out); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn:active { transform: scale(.97); }
@media (hover: hover) {
  .btn:hover .btn__arrow { transform: translateX(4px); }
}

.tag {
  display: inline-flex; align-items: center;
  padding: .42em .8em; border: 1px solid var(--fg); border-radius: 999px;
  font-size: .6875rem; font-weight: 600; letter-spacing: .09em; line-height: 1; text-transform: uppercase; white-space: nowrap;
}

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 var(--gut);
  background: var(--bg);
}
.wordmark {
  display: flex; align-items: center;
  height: 28px; margin-right: auto;
  font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch);
  font-size: 1.125rem; line-height: 28px; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap;
}
.wordmark span { display: block; transition: opacity .18s linear; }
.wordmark.is-swapping span { opacity: 0; }

.site-nav { display: none; gap: 28px; }
.site-nav a { font-size: .9375rem; font-weight: 500; text-decoration: none; padding: 10px 0; }
@media (hover: hover) {
  .site-nav a { background: linear-gradient(currentColor, currentColor) 0 calc(100% - 6px) / 100% 1px no-repeat; background-size: 0 1px; transition: background-size .3s var(--ease-out); }
  .site-nav a:hover { background-size: 100% 1px; }
}
@media (min-width: 620px) {
  .site-nav { display: flex; }
}

/* ---------- footer ---------- */
.site-footer {
  padding: clamp(56px, 10vw, 120px) var(--gut) calc(32px + env(safe-area-inset-bottom));
  max-width: calc(var(--max) + var(--gut) * 2); margin: 0 auto;
}
.site-footer__links { display: grid; border-top: 1px solid var(--line-c); }
.site-footer__links li {
  display: grid; gap: 4px; padding: 20px 0;
  border-bottom: 1px solid var(--line-c);
}
.site-footer__k { font-size: .75rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.site-footer__links a {
  font-size: clamp(1.25rem, 4.6vw, 2rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2;
  text-decoration: none; overflow-wrap: anywhere;
}
@media (hover: hover) {
  .site-footer__links a:hover { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
}
.site-footer__fine { margin-top: 28px; max-width: 60ch; font-size: .875rem; color: var(--muted); }
.site-footer__fine--note { margin-top: 8px; }
@media (min-width: 768px) {
  .site-footer__links { grid-template-columns: repeat(2, 1fr); }
  .site-footer__links li { padding: 28px 24px 28px 0; border-bottom: 0; }
  .site-footer__links a { font-size: clamp(1.125rem, 2vw, 1.625rem); }
}

/* ---------- cursor (fine pointers only, enabled by js/cursor.js) ---------- */
.cursor { display: none; }
.has-cursor, .has-cursor * { cursor: none !important; }
.has-cursor input[type='text'], .has-cursor input[type='tel'] { cursor: text !important; }
.has-cursor .cursor {
  display: block; position: fixed; top: 0; left: 0; z-index: 90;
  width: 0; height: 0; pointer-events: none;
  opacity: 0; transition: opacity .2s linear;
}
.has-cursor .cursor.is-visible { opacity: 1; }
.cursor__dot {
  position: absolute; top: -40px; left: -40px; width: 80px; height: 80px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px var(--bg);
  transform: scale(.15);
  transition: transform .32s var(--ease-out), background-color .2s linear, box-shadow .2s linear;
}
.cursor__label {
  color: var(--on-accent); font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  opacity: 0; transition: opacity .15s linear;
}
/* Over links the dot opens into a ring, so it never covers the label underneath. */
.cursor.is-link .cursor__dot { transform: scale(.5); background: transparent; box-shadow: inset 0 0 0 4px #fff; }
/* Difference blending keeps the ring visible on any surface, including a button in the accent colour. */
.cursor.is-link { mix-blend-mode: difference; }
.cursor.is-label .cursor__dot { transform: scale(1); box-shadow: none; }
.cursor.is-label .cursor__label { opacity: 1; transition-delay: .08s; }
.cursor.is-text .cursor__dot { transform: scale(0); }
.cursor.is-down .cursor__dot { transform: scale(.1); }
.cursor.is-link.is-down .cursor__dot { transform: scale(.4); }
.cursor.is-label.is-down .cursor__dot { transform: scale(.9); }
/* Over the white fit check panel the dot uses that panel's colours. */
.cursor.on-light { --accent: #0A0A0A; --on-accent: #FAFAFA; --bg: #FAFAFA; }
