/* ============================================================
   Adnan Khan — Unified Site CSS
   @import MUST be first
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;1,8..60,300;1,8..60,400&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --ink:          #1a1a18;
  --ink-soft:     #3a3a35;
  --ink-muted:    #6b6b62;
  --paper:        #f9f6f0;
  --paper-warm:   #f4f1eb;
  --card:         #ffffff;
  --accent:       #8b4513;
  --accent-soft:  #c17942;
  --accent-pale:  rgba(139, 69, 19, .06);
  --border:       #ddd8cc;
  --border-card:  #e0dbd2;
  --link:         #0b57d0;
  --link-hover:   #083a8c;
  --header-bg:    #1a1a18;
  --font-head:    'Lora', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-system:  system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --prose-width:  66ch;
  --site-width:   min(920px, 92%);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-system);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff;
  padding: 8px 12px; z-index: 9999;
  font-family: var(--font-system);
}
.skip-link:focus { left: 10px; top: 10px; }

/* ── Site Header — unified ─────────────────────────────────── */
header.site-header {
  background: var(--header-bg);
  color: #e8e4dc;
  padding: 1.25rem 0 1rem;
  border-bottom: 3px solid var(--accent);
}
header.site-header .wrap {
  width: var(--site-width);
  margin: 0 auto;
}
header.site-header h1 {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: .2rem;
  letter-spacing: -.01em;
}
header.site-header .site-title {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 .2rem;
  letter-spacing: -.01em;
  line-height: 1.6;
}
header.site-header p {
  font-size: .88rem;
  color: #b0aca4;
  margin: .2rem 0;
  line-height: 1.5;
}
header.site-header p a,
header.site-header a {
  color: #d4c9b8;
  text-decoration: none;
}
header.site-header a:hover { color: #fff; text-decoration: underline; }

/* ── Navigation ────────────────────────────────────────────── */
nav[aria-label="Primary"] {
  margin-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
}
nav[aria-label="Primary"] a {
  font-family: var(--font-system);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #c0bbb3;
  background: rgba(255,255,255,.07);
  text-decoration: none;
  padding: .35rem .8rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
nav[aria-label="Primary"] a:hover {
  color: #fff;
  background: rgba(255,255,255,.14);
  border-color: var(--accent-soft);
}
nav[aria-label="Primary"] a[aria-current="page"] {
  color: #fff;
  background: rgba(139,69,19,.3);
  border-color: var(--accent-soft);
  font-weight: 600;
}

/* ── Main wrapper ──────────────────────────────────────────── */
main {
  width: var(--site-width);
  margin: 1.5rem auto 3rem;
}

/* ── Portfolio section cards ───────────────────────────────── */
.section {
  background: var(--card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.section h2 {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .65rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
}
.section h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 1rem 0 .35rem;
}
.section p { margin-bottom: .6rem; font-size: .95rem; line-height: 1.6; }

/* ── Shared typography ─────────────────────────────────────── */
a { color: var(--link); }
a:hover { color: var(--link-hover); text-decoration: underline; }
.muted { color: var(--ink-muted); font-style: italic; font-size: .9rem; }
ul { padding-left: 1.2rem; }
li { margin: .35rem 0; font-size: .95rem; line-height: 1.55; }
strong { font-weight: 600; }

/* ── Table (publications) ──────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: .92rem;
}
.table th, .table td {
  border: 1px solid var(--border-card);
  padding: .65rem .75rem;
  text-align: left;
  vertical-align: top;
}
.table th {
  background: var(--accent-pale);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .88rem;
  color: var(--ink);
}

/* ── KV grid ───────────────────────────────────────────────── */
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 12px;
}
.kv div { padding: 2px 0; font-size: .93rem; }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  width: var(--site-width);
  margin: 1rem auto 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--ink-muted);
}
footer a { color: var(--ink-muted); }
footer a:hover { color: var(--accent); }

/* ============================================================
   JOURNEY PAGE
   ============================================================ */

.journey-body { background: var(--paper-warm); }

.journey-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 5rem;
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.85;
}

.journey-intro {
  font-style: italic;
  color: var(--ink-muted);
  font-size: .94rem;
  border-left: 3px solid var(--accent-soft);
  padding-left: 1rem;
  margin-bottom: 2.5rem;
  line-height: 1.65;
}

.journey-wrap h2 {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2.75rem;
  margin-bottom: .85rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}

.journey-wrap p {
  font-size: 1rem;
  line-height: 1.85;
  margin-bottom: 1.2rem;
  max-width: var(--prose-width);
  color: var(--ink-soft);
}

.journey-wrap em { font-style: italic; color: var(--ink); }

.journey-blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: .75rem 1.25rem;
  background: var(--accent-pale);
  border-radius: 0 4px 4px 0;
}
.journey-blockquote p {
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0;
  max-width: none;
}

.journey-image {
  margin: 2rem 0;
  text-align: center;
}
.journey-image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 400px;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.13);
  object-fit: cover;
}
.journey-image figcaption {
  font-size: .82rem;
  color: var(--ink-muted);
  margin-top: .55rem;
  font-style: italic;
}

.journey-dateline {
  margin-top: 2.5rem;
  font-size: .9rem;
  color: var(--ink-muted);
}
.journey-dedication {
  margin-top: .75rem;
  font-style: italic;
  color: var(--ink-muted);
  font-size: .93rem;
}

/* ============================================================
   BLOG INDEX PAGE
   ============================================================ */

.blog-body { background: var(--paper-warm); }

.blog-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 5rem;
  font-family: var(--font-body);
}

.blog-wrap h1 {
  font-family: var(--font-head);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .35rem;
}

.blog-tagline {
  color: var(--ink-muted);
  font-style: italic;
  font-size: .93rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.blog-disclaimer {
  margin: 0 0 2rem;
  padding: .8rem 1rem;
  background: var(--accent-pale);
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-size: .87rem;
  color: var(--ink-soft);
  font-style: italic;
}

.blog-list { list-style: none; padding: 0; }

.blog-list-item {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-list-item:last-child { border-bottom: none; }

.blog-list-item h2 {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.blog-list-item h2 a { color: var(--ink); text-decoration: none; }
.blog-list-item h2 a:hover { color: var(--accent); }

.blog-meta { font-size: .8rem; color: var(--ink-muted); margin-bottom: .4rem; }
.blog-meta span { margin-right: .8rem; }

.blog-excerpt {
  font-size: .94rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: .5rem;
}

.blog-read-more {
  font-size: .84rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.blog-read-more:hover { text-decoration: underline; }

/* ============================================================
   BLOG POST PAGES
   ============================================================ */

.post-body { background: var(--paper-warm); }

.post-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 5rem;
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--ink-soft);
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: .65rem;
}

.post-meta { font-size: .8rem; color: var(--ink-muted); margin-bottom: .65rem; }
.post-meta span { margin-right: .85rem; }

.post-disclaimer {
  font-size: .84rem;
  color: var(--ink-muted);
  font-style: italic;
  padding: .55rem .9rem;
  background: var(--accent-pale);
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 3px 3px 0;
}

.post-body-content h2 {
  font-family: var(--font-head);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2.25rem;
  margin-bottom: .75rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--border);
}

.post-body-content p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink-soft);
  margin-bottom: 1.1rem;
  max-width: var(--prose-width);
}

.post-body-content em { font-style: italic; color: var(--ink); }
.post-body-content strong { font-weight: 600; color: var(--ink); }

.post-body-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: .75rem 1.25rem;
  background: var(--accent-pale);
  border-radius: 0 4px 4px 0;
}
.post-body-content blockquote p {
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0;
}

.post-body-content ul,
.post-body-content ol {
  padding-left: 1.35rem;
  margin-bottom: 1.1rem;
}
.post-body-content li {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}

.post-body-content a { color: var(--link); }
.post-body-content a:hover { color: var(--link-hover); }

/* Quran verses */
.quran-verse {
  background: rgba(139,69,19,.07);
  border-left: 4px solid var(--accent);
  padding: .85rem 1.15rem;
  margin: 1.5rem 0;
  border-radius: 0 4px 4px 0;
}
.quran-verse p {
  font-style: italic;
  color: var(--ink);
  margin-bottom: .2rem !important;
}
.quran-verse .quran-ref {
  font-size: .8rem;
  color: var(--accent);
  font-style: normal;
}

/* Post navigation */
.post-nav {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .87rem;
}
.post-nav a { color: var(--accent); text-decoration: none; }
.post-nav a:hover { text-decoration: underline; }

.post-footer-disclaimer {
  margin-top: 2rem;
  padding: .7rem .95rem;
  background: var(--accent-pale);
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-size: .84rem;
  color: var(--ink-muted);
  font-style: italic;
}

/* Giscus / comments */
.comments-section {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.comments-section h3 {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .85rem;
}

/* ============================================================
   HOME PAGE
   ============================================================ */

.intro {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.headshot {
  display: block;
  width: 170px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,.14);
}
.intro-text h2 { margin-top: 0; }

.status {
  background: var(--accent-pale);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: .6rem .85rem;
  color: var(--ink);
}
.section p.status { margin-bottom: .9rem; }

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
  margin-bottom: .75rem;
}
.work-card {
  border: 1px solid var(--border-card);
  border-top: 3px solid var(--accent-soft);
  border-radius: 6px;
  padding: .85rem 1rem;
  background: var(--paper);
}
.section .work-card h3 { margin: 0 0 .1rem; color: var(--ink); }
.section .work-card p { font-size: .9rem; margin-bottom: .5rem; }
.section .work-card p.work-venue {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .45rem;
}
.section .work-card p.work-links { margin-bottom: 0; font-size: .86rem; }

/* CV publication list */
.pub-list { padding-left: 1.4rem; }
.pub-list li { margin: .5rem 0; }
.pub-links { display: block; font-size: .85rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 620px) {
  header.site-header h1,
  header.site-header .site-title { font-size: 1.4rem; }
  nav[aria-label="Primary"] a { font-size: .72rem; padding: .3rem .55rem; }

  .journey-wrap,
  .blog-wrap,
  .post-wrap { padding: 1.5rem 1rem 3rem; }

  .journey-wrap h2 { font-size: 1.12rem; }
  .post-header h1 { font-size: 1.35rem; }
  .post-body-content h2 { font-size: 1.05rem; }

  .journey-image img {
    max-height: 250px;
    width: 100%;
    object-fit: cover;
  }

  .journey-wrap p,
  .post-body-content p { font-size: .96rem; }

  .post-nav { flex-direction: column; gap: .35rem; }

  .section { padding: .9rem 1rem; }

  /* home: stack portrait above the intro */
  .intro { grid-template-columns: 1fr; gap: 1rem; }
  .headshot { width: 150px; margin: 0 auto; }

  /* publications table → stacked cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--border-card); border-radius: 6px; margin-bottom: .75rem; padding: .35rem 0; }
  .table td { border: none; padding: .3rem .75rem; }
  .table td:nth-child(2),
  .table td:nth-child(3) { display: inline; padding-top: 0; font-size: .85rem; color: var(--ink-muted); }
  .table td:nth-child(2) { padding-right: .25rem; }
  .table td:nth-child(3) { padding-left: 0; }
  .table td:nth-child(3)::before { content: "· "; }
}

/* ── Page load fade ─────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
main,
.journey-wrap,
.blog-wrap,
.post-wrap {
  animation: fadeUp .4s ease both;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  main,
  .journey-wrap,
  .blog-wrap,
  .post-wrap { animation: none; }
}

/* ============================================================
   PRINT (CV → "Save as PDF")
   ============================================================ */

@media print {
  @page { margin: 1.4cm 1.6cm; }

  body { background: #fff; color: #000; font-size: 10pt; }
  .skip-link,
  nav[aria-label="Primary"],
  footer { display: none !important; }

  header.site-header {
    background: none;
    border-bottom: 1.5px solid #000;
    padding: 0 0 .4rem;
  }
  header.site-header .wrap,
  main { width: auto; margin: 0; }
  header.site-header h1,
  header.site-header p,
  header.site-header a { color: #000 !important; }
  header.site-header h1 { font-size: 20pt; }

  main { animation: none; }
  .section {
    border: none;
    border-radius: 0;
    padding: 0;
    margin: .7rem 0 0;
  }
  .section h2 { font-size: 12pt; border-bottom: 1px solid #888; margin-bottom: .35rem; }
  .section h3 { font-size: 10.5pt; margin-top: .55rem; }
  h2, h3 { break-after: avoid; }
  li, .section p { font-size: 9.5pt; line-height: 1.4; }
  li { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .muted { color: #333; }
  .pub-links { display: none; }
}
