/* =========================================================
   IFTEKHAR HYDER: base design system
   Concept: a printed portfolio. Warm paper, near-black ink, one
   vermilion accent and a cobalt for links/secondary marks. Big
   editorial serif headlines, a quiet sans for everything else.
   Real screenshots do the talking, so the chrome stays calm.

   Colours are RGB channels so tints can be written as
   rgb(var(--x-rgb) / alpha) and still follow the theme.
   Contrast pairs are checked by scripts/check-contrast.mjs.
   ========================================================= */

:root,
[data-theme="light"]{
  color-scheme: light;

  --bg-rgb:        244 241 234;  /* #F4F1EA paper */
  --bg-2-rgb:      236 231 220;  /* #ECE7DC */
  --surface-rgb:   251 249 244;  /* #FBF9F4 */
  --surface-2-rgb: 255 255 255;

  --text-rgb:       22 21 19;    /* #161513 ink */
  --text-dim-rgb:   74 71 64;    /* #4A4740 */
  --text-faint-rgb: 106 102 93;  /* #6A665D */

  --auto-rgb:  180 52 14;        /* #B4340E vermilion (accent) */
  --web-rgb:   43 66 196;        /* #2B42C4 cobalt (secondary) */
  --on-auto:   #FFFFFF;
  --danger:    #B42318;

  --shadow-rgb: 60 45 25;
  --shadow-alpha: .18;
}

[data-theme="dark"]{
  color-scheme: dark;

  --bg-rgb:        20 19 17;     /* #141311 */
  --bg-2-rgb:      26 25 23;     /* #1A1917 */
  --surface-rgb:   32 31 28;     /* #201F1C */
  --surface-2-rgb: 40 38 34;     /* #282622 */

  --text-rgb:       241 238 230; /* #F1EEE6 */
  --text-dim-rgb:   187 182 170; /* #BBB6AA */
  --text-faint-rgb: 148 143 131; /* #948F83 */

  --auto-rgb:  255 122 77;       /* #FF7A4D */
  --web-rgb:   150 166 255;      /* #96A6FF */
  --on-auto:   #1E0B04;
  --danger:    #FF7A7A;

  --shadow-rgb: 0 0 0;
  --shadow-alpha: .55;
}

:root{
  --bg:         rgb(var(--bg-rgb));
  --bg-2:       rgb(var(--bg-2-rgb));
  --surface:    rgb(var(--surface-rgb));
  --surface-2:  rgb(var(--surface-2-rgb));
  --text:       rgb(var(--text-rgb));
  --text-dim:   rgb(var(--text-dim-rgb));
  --text-faint: rgb(var(--text-faint-rgb));
  --auto:       rgb(var(--auto-rgb));
  --web:        rgb(var(--web-rgb));
  --line:        rgb(var(--text-rgb) / .12);
  --line-strong: rgb(var(--text-rgb) / .24);
  --ring:        rgb(var(--auto-rgb));

  /* --- Type --- */
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body:    "Geist", "Segoe UI", system-ui, sans-serif;

  /* --- Fluid scale --- */
  --step--2: clamp(0.76rem, 0.74rem + 0.1vw, 0.82rem);
  --step--1: clamp(0.88rem, 0.85rem + 0.15vw, 0.96rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.25rem, 1.12rem + 0.6vw, 1.6rem);
  --step-2:  clamp(1.7rem, 1.4rem + 1.4vw, 2.5rem);
  --step-3:  clamp(2.4rem, 1.7rem + 3.2vw, 4.4rem);
  --step-4:  clamp(3rem, 1.9rem + 5.4vw, 6.6rem);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-soft:  0 40px 70px -40px rgb(var(--shadow-rgb) / var(--shadow-alpha));
  --shadow-tight: 0 14px 30px -20px rgb(var(--shadow-rgb) / var(--shadow-alpha));

  --maxw: 1240px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --header-h: 72px;

  --ease: cubic-bezier(.16,1,.3,1);
  --spring: cubic-bezier(.34,1.4,.64,1);
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

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

html{
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  background: var(--bg);
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 400ms var(--ease), color 400ms var(--ease);
}

img{ max-width: 100%; display: block; height: auto; }
a{ color: inherit; text-decoration: none; }
ul, ol{ margin: 0; padding: 0; list-style: none; }
button{ font: inherit; cursor: pointer; color: inherit; }

h1, h2, h3, h4{
  color: var(--text);
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1, h2{
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
}
h3, h4{
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
h1{ font-size: var(--step-4); }
h2{ font-size: var(--step-3); }
h3{ font-size: var(--step-1); }
h4{ font-size: var(--step-0); }

h1 em, h2 em{ font-style: italic; color: var(--auto); }

p{ margin: 0 0 1em; text-wrap: pretty; color: var(--text-dim); }
strong, b{ color: var(--text); font-weight: 600; }

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

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

.container{
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Section rhythm ---------- */
.section{ padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.section-alt{ background: var(--bg-2); }

.section-head{
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: .5rem 2rem;
  margin-bottom: clamp(2rem, 4vw, 3.2rem);
}
.section-head h2{ margin: 0; }
.section-head p{ margin: 0; max-width: 40ch; font-size: var(--step--1); }

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: .85em 1.5em;
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--step--1);
  border: 1px solid transparent;
  transition: background 300ms var(--ease), color 300ms var(--ease),
              border-color 300ms var(--ease), transform 300ms var(--ease);
  white-space: nowrap;
}
.btn svg{ width: 16px; height: 16px; flex: none; transition: transform 380ms var(--spring); }
.btn:hover svg{ transform: translateX(3px); }

.btn-primary{ background: var(--text); color: var(--bg); }
.btn-primary:hover{ background: var(--auto); color: var(--on-auto); }

.btn-ghost{ background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover{ border-color: var(--text); }

.btn-sm{ padding: .6em 1.1em; font-size: var(--step--2); }

/* ---------- Chips ---------- */
.chips{ display: flex; flex-wrap: wrap; gap: .45rem; }
.chips li{
  font-size: var(--step--2);
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35em .85em;
}

/* ---------- Reveal (main.js IntersectionObserver path) ----------
   Hidden only when the head script turned motion on; a CSS
   failsafe fades things in if scripts never boot. */
html.js-motion .reveal{
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
}
html.js-motion .reveal.in-view{ opacity: 1; transform: none; }
html.js-motion:not(.motion-ready) .reveal,
html.js-motion:not(.motion-ready) .hero [data-hero],
html.js-motion:not(.motion-ready) .hero [data-split]{
  opacity: 0;
  animation: revealFailsafe .6s ease 2.5s forwards;
}
@keyframes revealFailsafe{ to{ opacity: 1; transform: none; } }

.skip-link{
  position: absolute; left: -999px; top: auto;
  background: var(--text); color: var(--bg);
  padding: .8em 1.4em; z-index: 400;
  border-radius: 0 0 10px 0; font-weight: 700;
}
.skip-link:focus{ left: 0; top: 0; }
