/* ahmedhani.com styles
   Logical properties only (no left/right) so the Arabic RTL version can reuse this file. */

/* ---------- Fonts (self-hosted, latin subset, OFL) ---------- */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;

  /* Color: light */
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #14171A;
  --muted: #4A5560;
  --line: #D9D5CB;
  --accent: #0B7A5A;
  --accent-ink: #FFFFFF;
  --warn: #9A3412;
  --warn-bg: #FDEBDD;

  /* Type families */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Type scale */
  --text-xs: 0.8125rem;   /* 13px: mono labels, chips */
  --text-sm: 0.9375rem;   /* 15px: meta lines, tools lines */
  --text-base: 1.0625rem; /* 17px: body */
  --text-lg: 1.25rem;     /* 20px: lead text */
  --text-xl: 1.625rem;    /* 26px: role line, card titles */
  --text-2xl: clamp(2rem, 4.5vw, 2.75rem);  /* H2 */
  --text-h1: clamp(2.75rem, 7vw, 5rem);     /* H1 */
  --leading-body: 1.6;
  --leading-tight: 1.1;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Layout */
  --container: 1040px;
  --gutter: 16px;
  --label-col: 180px;
  --radius: 6px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
    --text-base: 1.125rem; /* 18px */
  }
}

/* Dark: follows the system unless the visitor chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1315;
    --surface: #171C1F;
    --ink: #E8EDEB;
    --muted: #A4B0AC;
    --line: #2A3236;
    --accent: #3DD6A0;
    --accent-ink: #06241A;
    --warn: #FDBA74;
    --warn-bg: #2A1A10;
  }
}

/* Dark: manual choice from the theme toggle */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1315;
  --surface: #171C1F;
  --ink: #E8EDEB;
  --muted: #A4B0AC;
  --line: #2A3236;
  --accent: #3DD6A0;
  --accent-ink: #06241A;
  --warn: #FDBA74;
  --warn-bg: #2A1A10;
}

/* ---------- Reset ---------- */

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

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

body,
h1, h2, h3, h4,
p, ul, ol, li,
figure, blockquote,
dl, dd {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

button,
input {
  font: inherit;
  color: inherit;
}

body {
  min-block-size: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-body);
  text-align: start;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
}

h1 {
  font-size: var(--text-h1);
}

h2 {
  font-size: var(--text-2xl);
}

/* Only 400 and 500 are loaded; 500 is the bold weight */
b,
strong {
  font-weight: 500;
}

code,
.mono {
  font-family: var(--font-mono);
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

.container {
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Header ---------- */

.site-header {
  border-block-end: 1px solid var(--line);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-3);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

/* Phones: wordmark and toggle share the first row, the nav wraps below */
.site-nav {
  order: 3;
  flex-basis: 100%;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-4);
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
}

.wordmark:hover,
.nav-list a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.theme-toggle {
  margin-inline-start: auto;
  min-block-size: 44px;
  padding-inline: var(--space-4);
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--ink);
}

@media (min-width: 768px) {
  .site-nav {
    order: 0;
    flex-basis: auto;
    margin-inline-start: auto;
  }

  .theme-toggle {
    margin-inline-start: 0;
  }
}

/* ---------- Chips and buttons ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--ink);
}

.chip abbr {
  text-decoration: none;
}

.chip-warn {
  border-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 500;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding-inline: var(--space-5);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.button:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

.hero {
  padding-block: var(--space-7) var(--space-8);
  border-block-end: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  gap: var(--space-7);
  align-items: start;
}

.hero-text > * + * {
  margin-block-start: var(--space-4);
}

.eyebrow {
  font-size: var(--text-sm);
  color: var(--muted);
}

.hero h1 {
  margin-block-start: var(--space-2);
}

.role-line {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.3;
}

.lead {
  max-inline-size: 36em;
  font-size: var(--text-lg);
  color: var(--muted);
}

.hero .chip-list {
  margin-block-start: var(--space-5);
}

.hero .button-row {
  margin-block-start: var(--space-5);
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: var(--space-8);
  }
}

/* ---------- Bug-report card ---------- */

.bug-card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.chip-note {
  display: block;
  border-radius: var(--radius);
  color: var(--muted);
}

.bug-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  margin-block-start: var(--space-4);
}

.bug-fields dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.9;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bug-title {
  font-weight: 500;
}

ol.bug-steps {
  padding-inline-start: 1.25em;
  list-style: decimal;
}

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

.section {
  padding-block: var(--space-8);
  border-block-end: 1px solid var(--line);
  scroll-margin-top: var(--space-4);
}

.section-grid {
  display: grid;
  gap: var(--space-3);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.section-body {
  min-inline-size: 0;
}

.section-body > * + * {
  margin-block-start: var(--space-5);
}

@media (min-width: 768px) {
  .section-grid {
    grid-template-columns: var(--label-col) minmax(0, 1fr);
    gap: var(--space-6);
  }

  .section-label {
    padding-block-start: 0.9em;
  }
}

.prose {
  max-inline-size: 40em;
}

.prose > * + * {
  margin-block-start: var(--space-4);
}

.section-intro {
  max-inline-size: 40em;
  color: var(--muted);
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space-4);
}

.card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card h3 {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
}

.card > * + * {
  margin-block-start: var(--space-3);
}

.tools {
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ---------- Experience ---------- */

.job h3 {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.3;
}

.meta {
  margin-block-start: var(--space-2);
  font-size: var(--text-sm);
  color: var(--muted);
}

.subline {
  margin-block-start: var(--space-1);
  color: var(--muted);
}

.job-points {
  max-inline-size: 42em;
  margin-block-start: var(--space-4);
  padding-inline-start: 1.25em;
}

.job-points li + li {
  margin-block-start: var(--space-2);
}

.job-points li::marker {
  color: var(--accent);
}

/* ---------- Work samples ---------- */

.sample {
  display: flex;
  flex-direction: column;
}

.sample-head {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: var(--space-2);
}

.sample-head .chip {
  white-space: nowrap;
}

.sample-foot {
  margin-block-start: auto;
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
}

.sample > p:not(.sample-foot) {
  margin-block-end: var(--space-3);
}

/* ---------- Certifications and education ---------- */

.cred-list li {
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--line);
}

.cred-list li:first-child {
  border-block-start: 1px solid var(--line);
}

.cred-name {
  font-weight: 500;
}

.cred-meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

.learning {
  color: var(--muted);
}

.learning h3 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.learning-list {
  margin-block-start: var(--space-2);
  font-size: var(--text-sm);
}

.learning-list li + li {
  margin-block-start: var(--space-1);
}

/* ---------- 404 ---------- */

.not-found {
  padding-block: var(--space-9);
}

.not-found p {
  margin-block-start: var(--space-6);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--space-6);
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ---------- Print ---------- */

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --ink: #000000;
    --muted: #333333;
    --line: #BBBBBB;
    --accent: #000000;
    --accent-ink: #000000;
    --warn: #000000;
    --warn-bg: #FFFFFF;
  }

  .site-header,
  .skip-link,
  .theme-toggle {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .hero,
  .section {
    padding-block: 1.5rem;
  }

  .button {
    display: inline;
    min-block-size: 0;
    padding: 0;
    border: 0;
    background: none;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: 400;
    text-decoration: none;
  }

  h1,
  h2,
  h3,
  .section-label {
    break-after: avoid;
  }

  .card,
  .bug-card,
  .job-points li,
  .cred-list li {
    break-inside: avoid;
  }
}

@media print and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --ink: #000000;
    --muted: #333333;
    --line: #BBBBBB;
    --accent: #000000;
    --accent-ink: #000000;
    --warn: #000000;
    --warn-bg: #FFFFFF;
  }
}

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