/* ==========================================================================
   Haisham design system: components
   Requires tokens.css. Class names use the `hd-` prefix.
   Each block notes where it comes from on haisham.design.
   ========================================================================== */

/* ---------- Typography ---------- */

.hd-display { font-family: var(--font-display); }

/* Small uppercase label with a square marker. "Chapter 03", "Case 02 / 05", section kickers. */
.hd-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}
.hd-eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--pa, var(--accent));  /* a square, not a circle */
  flex-shrink: 0;
}

/* Headline for a landing page. Two lines: plain, then the second line in the accent. */
.hd-hero {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-hero);
  line-height: 0.92;
  letter-spacing: -0.045em;
  max-width: 12ch;
}
.hd-hero em { font-style: normal; color: var(--accent); }

/* Giant title over a full-bleed image */
.hd-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-display);
  line-height: 0.86;
  letter-spacing: -0.05em;
}

/* Section heading ("Selected Works"). Phones: one line, sized to the screen. */
.hd-h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-section);
  line-height: 0.92;
  letter-spacing: -0.045em;
}
@media (max-width: 759px) {
  .hd-h2 { font-size: clamp(28px, 12vw, 48px); white-space: nowrap; }
  .hd-br { display: none; }  /* <br class="hd-br"> breaks a heading on wide screens only */
}

/* Heading inside a section, lighter than .hd-h2 */
.hd-h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-chapter);
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* One big statement paragraph */
.hd-lead {
  margin: 0;
  max-width: 1100px;
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}

/* Body copy under a heading. Keep it to about half the page width. */
.hd-body {
  margin: 14px 0 0;
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--muted);
  max-width: max(560px, 55%);
  text-wrap: pretty;
}

/* "Label over value" pairs: Client / Year / Discipline */
.hd-label {
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}
.hd-value { font-family: var(--font-display); font-size: 18px; line-height: 1.4; }

/* Big number with a small caption: the "15+ years" figures */
.hd-stat-num { font-family: var(--font-display); font-weight: 700; font-size: 44px; letter-spacing: -0.03em; }
.hd-stat-cap { font-size: var(--fs-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-top: 6px; }

/* ---------- Layout ---------- */

.hd-section { padding: var(--section-y) var(--pad); }

/* Heading with its short description sitting beside it, not pushed to the far edge */
.hd-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 24px clamp(32px, 5vw, 96px);
  margin-bottom: 64px;
}

/* A row of cards: as many 420px+ columns as fit; offset the second column for a staggered feel */
.hd-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 48px clamp(24px, 4vw, 64px);
  align-items: start;
}
.hd-card-grid > :nth-child(even) { padding-top: 160px; }
@media (max-width: 759px) { .hd-card-grid > :nth-child(even) { padding-top: 0; } }

/* A row of facts, ruled above */
.hd-spec-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

/* ---------- Buttons and chips (everything is a pill) ---------- */

/* Quiet pill: navigation, filters */
.hd-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r-pill);
  font: 500 14px var(--font-body);
  color: var(--muted);
  background: var(--chip);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.hd-pill:hover { color: var(--fg); background: var(--chip-hover); }

/* Primary action: brand blue, white text */
.hd-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-pill);
  font: 600 14px var(--font-body);
  color: var(--on-brand);
  background: var(--brand);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast) ease;
}
.hd-cta:hover { background: var(--brand-hover); color: var(--on-brand); }
.hd-cta-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; }

/* The one large closing action (an email address, "Start a project") */
.hd-cta-xl {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 22px 36px;
  border-radius: var(--r-pill);
  font: 500 clamp(20px, 2.4vw, 30px) var(--font-display);
  letter-spacing: -0.01em;
  color: var(--on-brand);
  background: var(--brand);
  transition: background-color var(--t-fast) ease;
}
.hd-cta-xl:hover { background: var(--brand-hover); }

/* Outlined link: "Read the issue ↗". Inverts on hover. */
.hd-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  transition: background-color var(--t-base) ease, color var(--t-base) ease;
}
.hd-link:hover { background: var(--fg); color: var(--bg); }

/* Choice chip: lifts and takes the accent on hover */
.hd-chip {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  background: var(--chip);
  transition: background-color var(--t-base) ease, border-color var(--t-base) ease, transform var(--t-base) ease;
}
.hd-chip:hover,
.hd-chip:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Tag over an image: outline, no fill */
.hd-tag {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--r-pill);
  font-size: 13px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Round icon button (theme toggle) */
.hd-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--fg);
  background: var(--chip-hover);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background-color var(--t-fast) ease;
}
.hd-icon-btn:hover { background: var(--chip-strong); }

/* Software chip: a rounded square with a two-letter abbreviation, tinted per tool (see DESIGN.md) */
.hd-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  font: 700 16px var(--font-display);
  letter-spacing: -0.02em;
  transition: transform 0.3s var(--ease-pop);
}
.hd-tool:hover { transform: translateY(-3px) rotate(-6deg); }
.hd-tool--ai { background: #330000; color: #ff9a00; }
.hd-tool--ae { background: #00005b; color: #9999ff; }
.hd-tool--id { background: #49021f; color: #ff3366; }
.hd-tool--ps { background: #001e36; color: #31a8ff; }
.hd-tool--xd { background: #470137; color: #ff61f6; }
.hd-tool--fig { background: #1e1e24; color: #a259ff; }

/* ---------- Surfaces ---------- */

/* Frosted glass: the base of every card on the home page */
.hd-glass {
  background: color-mix(in srgb, var(--card) 52%, transparent);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-glass-edge);
}

/* Work card: glass, thin padding, the image inset with its own smaller radius */
.hd-card {
  display: block;
  padding: 12px 12px 22px;
  border-radius: 26px;
  color: var(--fg);
}
.hd-card-media { aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--card); }
.hd-card-media > img,
.hd-card-media > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) cubic-bezier(0.2, 0.7, 0.2, 1);
}
.hd-card:hover .hd-card-media > img,
.hd-card:hover .hd-card-media > video { transform: scale(1.06); }
.hd-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 20px 10px 0; }
.hd-card-title { margin: 0; font: 500 var(--fs-card-title) var(--font-display); letter-spacing: -0.02em; }
.hd-card-meta { margin: 6px 10px 0; font-size: var(--fs-caption); color: var(--dim); }

/* Solid media frame for a screenshot, photo or video */
.hd-media { border-radius: var(--r-lg); overflow: hidden; background: var(--card); }
.hd-media > img,
.hd-media > video { display: block; width: 100%; height: auto; }

/* Browser window around a website screenshot */
.hd-browser {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--card);
  box-shadow: var(--shadow-frame);
}
.hd-browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 44px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--card) 70%, var(--fg) 6%);
  border-bottom: 1px solid var(--line);
}
.hd-browser-dots { display: flex; gap: 7px; }
.hd-browser-dots i { width: 11px; height: 11px; border-radius: 50%; }
.hd-browser-dots i:nth-child(1) { background: #ff5f57; }
.hd-browser-dots i:nth-child(2) { background: #febc2e; }
.hd-browser-dots i:nth-child(3) { background: #28c840; }
.hd-browser-url {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 1 420px;
  min-width: 0;
  height: 28px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--chip);
  color: var(--muted);
  font: 500 13px var(--font-body);
  white-space: nowrap;
  overflow: hidden;
}

/* A dark, coloured "stage" panel for showing a product on its own brand colour. Set --stage-* per project. */
.hd-stage {
  --fg: #fff;
  --dim: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.2);
  position: relative;
  isolation: isolate;
  padding: clamp(24px, 4.5vw, 64px);
  border-radius: var(--r-xl);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, #1c1c26 0%, #0b0b10 100%);
}

/* ---------- Status ---------- */

/* "Available for new projects": a dot that pings */
.hd-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); }
.hd-status-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.hd-status-dot.is-booked { background: var(--warn); }
.hd-status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: hd-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes hd-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

/* ---------- Page furniture ---------- */

.hd-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px var(--pad);
}
@media (max-width: 640px) { .hd-header { padding-block: 20px; } }

/* Hide secondary items on small screens so a header never overflows: keep the logo, the one primary action and the theme toggle. */
@media (max-width: 640px) { .hd-hide-sm { display: none !important; } }
@media (max-width: 480px) { .hd-hide-xs { display: none !important; } }

.hd-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px var(--pad);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--dim);
}

/* A thin vertical progress line that fills as you scroll through a section (--rail: 0 to 1) */
.hd-rail { position: absolute; left: calc(var(--pad) * 0.42); top: 0; bottom: 0; width: 2px; background: color-mix(in srgb, var(--pa, var(--accent)) 18%, transparent); pointer-events: none; }
.hd-rail > i { position: absolute; inset: 0; background: linear-gradient(180deg, var(--pa, var(--accent)), #edd28c); transform-origin: top; transform: scaleY(var(--rail, 0)); }

/* Small hint that something can be scrolled or dragged */
.hd-hint { margin: 0; font-size: var(--fs-label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }

/* ---------- Lighter graphics (set <html data-fx="low"> on weak devices) ---------- */
/* Backdrop blurs repaint whatever scrolls behind them every frame; weak GPUs struggle. */
html[data-fx='low'] :is(.hd-glass, .hd-pill, .hd-icon-btn, .hd-tag) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html[data-fx='low'] .hd-glass { background: color-mix(in srgb, var(--card) 92%, transparent); }
