/* abdelshafy.com — shared stylesheet
   Palette: forest green (links/buttons) + copper (tags), green-tinted neutrals.
   Type: Source Serif 4 (headings, reading text) / Inter (UI) / JetBrains Mono (code). */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/assets/fonts/noto-naskh-arabic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #fbfbf8;
  --text: #0f1f17;
  --muted: #4a5a50;
  --border: #e1e7e0;
  --tint: #ecf6ef;

  --link: #047857;        /* 5.3:1 on --bg */
  --link-hover: #065f46;  /* 7.4:1 */
  --btn: #047857;
  --btn-hover: #065f46;
  --btn-text: #ffffff;

  --tag-bg: #fdf1de;      /* copper tag */
  --tag-text: #92400e;    /* 6.4:1 on tag bg */

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max-w: 720px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1712;
    --text: #eef5f0;
    --muted: #93a89b;
    --border: #1a2b22;
    --tint: #10261c;

    --link: #34d399;       /* 9.5:1 */
    --link-hover: #6ee7b7;
    --btn: #34d399;
    --btn-hover: #6ee7b7;
    --btn-text: #052e1f;   /* 7.7:1 on --btn */

    --tag-bg: #2a2316;
    --tag-text: #fcd34d;   /* 10.8:1 */
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  max-width: var(--max-w);
  margin: 40px auto;
  padding: 0 20px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.35rem; }

p { margin: 0.7rem 0; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 3px; }

hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--tint);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Nav ---------- */
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  font-family: var(--font-ui);
}
nav .brand { color: var(--text); font-weight: 600; text-decoration: none; }
nav .brand:hover { color: var(--link); }
nav .links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav .links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding-bottom: 2px;
}
nav .links a:hover { color: var(--link); }
nav .links a[aria-current="page"] { color: var(--link); box-shadow: 0 2px 0 var(--link); }

/* ---------- Page header ---------- */
.subtitle {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0 0 1.4rem;
}
.section-title { margin: 2rem 0 1rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.5rem 0 0.5rem; font-family: var(--font-ui); }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  text-decoration: none;
  border: 1.5px solid var(--btn);
}
a.btn.primary { background: var(--btn); color: var(--btn-text); }
a.btn.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--btn-text); text-decoration: none; }
a.btn.ghost { color: var(--link); background: transparent; }
a.btn.ghost:hover { background: var(--tint); color: var(--link-hover); text-decoration: none; }

/* ---------- Photos ---------- */
.lab-photos { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin: 28px 0; }
.lab-photos figure { margin: 0; }
.lab-photos img {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--tint);
}
.lab-photos figcaption {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 8px;
}

/* ---------- Cards, tags ---------- */
.project-card, .post-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.project-card h2, .post-card h2, .post-card h3 { margin: 0 0 8px; font-size: 1.25rem; }
.project-card p, .post-excerpt { margin: 0; color: var(--muted); font-size: 0.98rem; }

.post-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.post-title { margin: 8px 0 4px; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--link); text-decoration: underline; }
.post-meta { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }

.contact-list { padding-inline-start: 1.2rem; }
.contact-list li { margin-bottom: 6px; }
ul { padding-inline-start: 1.3rem; }

/* ---------- Arabic (RTL) ---------- */
:lang(ar) body, body:lang(ar) { font-family: "Noto Naskh Arabic", var(--font-ui); line-height: 1.85; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) .subtitle,
:lang(ar) nav, :lang(ar) .post-tag, :lang(ar) .post-meta, :lang(ar) .btn {
  font-family: "Noto Naskh Arabic", var(--font-ui);
}
/* letter-spacing and transforms break Arabic letter joining */
:lang(ar) * { letter-spacing: 0 !important; text-transform: none !important; }

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
  body { margin: 24px auto; }
  h1 { font-size: 1.7rem; }
  .lab-photos { grid-template-columns: 1fr; }
  .lab-photos img { height: auto; aspect-ratio: 4 / 3; }
}
