/* ahmad-hamid.com — the shared shell: colour tokens, header, pages, footer.
   Every page loads this one file. It is external on purpose: the
   Content-Security-Policy in _headers forbids inline styles and scripts.
   Layout uses logical properties (inline-start/end), so the same rules serve
   Arabic (rtl) and English (ltr); site.js flips <html dir> and data-theme. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #efefeb;
  --text: #15181a;
  --muted: #5c6368;
  --border: #e3e3de;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.12);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 14px 34px -14px rgba(16, 24, 40, 0.22);
  --radius: 16px;
  --header-h: 64px;
  color-scheme: light;
}

/* Dark follows the system unless the visitor chose light; the explicit
   choice (data-theme) always wins. The two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012;
    --surface: #16191c;
    --surface-2: #1d2125;
    --text: #eceef0;
    --muted: #98a1a9;
    --border: #262b30;
    --accent: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.12);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1012;
  --surface: #16191c;
  --surface-2: #1d2125;
  --text: #eceef0;
  --muted: #98a1a9;
  --border: #262b30;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
img { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.container {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 20px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline-start: 12px;
}

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-width: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ctl:hover { border-color: var(--accent); }

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

.ctl svg {
  width: 18px;
  height: 18px;
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* ---- Pages ------------------------------------------------------------- */

main {
  flex: 1;
  padding-block: 40px 64px;
}

.page-title {
  margin: 0 0 24px;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero { padding-block: 40px 40px; }

.hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero p {
  max-width: 36rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
}

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.section-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

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

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.section-icon svg {
  width: 24px;
  height: 24px;
}

.section-card h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.section-card p {
  margin: 0;
  color: var(--muted);
}

.section-arrow {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---- Project cards (work) --------------------------------------------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.project:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

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

.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Logo files carry their own background; the thin border keeps every
   logo's edge visible on both light and dark surfaces. */
.project-logo {
  flex: none;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.project-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.project-full {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.3;
}

.status {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-live {
  color: var(--ok);
  background: var(--ok-soft);
}

.status-soon {
  color: var(--muted);
  background: var(--surface-2);
}

.project-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.project-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.project-soon { opacity: 0.75; }

/* ---- Empty state, 404 -------------------------------------------------- */

.empty {
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.notfound {
  padding-block: 48px;
  text-align: center;
}

.notfound h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.notfound p {
  margin: 0 0 20px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

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

.site-footer {
  padding-block: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* ---- Small screens ----------------------------------------------------- */

@media (max-width: 600px) {
  .container { padding-inline: 16px; }
  .brand-name { display: none; }
  .nav { margin-inline-start: 2px; }
  .nav a { padding: 8px 9px; font-size: 0.9rem; }
  .ctl { padding: 0 9px; }
  .ctl-text { display: none; }
  main { padding-block: 28px 48px; }
  .hero { padding-block: 24px 32px; }
  .section-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}
