/* ahnafakil.com — warm, simple, readable. No JavaScript required. */

:root {
  /* Brand: Charcoal Silk #3F3F44 + Vanilla Bean #F5F1E8. Every text/background
     pair below is >= 4.5:1 (WCAG AA). Tints/shades are mixes of these two only. */
  --bg: #F5F1E8;          /* Vanilla Bean */
  --surface: #FAF8F4;     /* card: vanilla toward white */
  --tint: #EAE6DE;        /* slightly darker vanilla (6% charcoal) */
  --ink: #2F2F33;         /* charcoal, one step darker  11.83:1 on bg */
  --muted: #4A4A4E;       /* no lighter than this   7.83:1 on bg, 7.09:1 on tint */
  --accent: #3F3F44;      /* Charcoal Silk — buttons, nav pill, footer, links */
  --accent-dark: #1F1F22; /* darker hover          15.2:1 vanilla on this */
  --on-accent: #F5F1E8;   /* vanilla on charcoal   9.29:1 */
  --line: #DFDCD4;        /* 12% charcoal into vanilla */
  --field-border: #888686; /* 3.21:1 on bg — form controls (WCAG 1.4.11) */
  --footer-bg: #3F3F44;
  --footer-text: #F5F1E8; /*                        9.29:1 on footer */
  --footer-muted: #E4E0D8; /*                       7.95:1 on footer */
  --tag-bg: #EAE6DE;
  --tag-text: #2F2F33;    /*                        10.71:1 on tag-bg */

  --serif: "Playfair Display", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(63, 63, 68, .06), 0 8px 24px rgba(63, 63, 68, .06);
  --wrap: 1080px;
  --wrap-narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.125rem; /* 18px */
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }
img, picture { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 1.1em; }
ul, ol { padding-left: 1.3em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--tint); padding: .1em .35em; border-radius: 6px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.15rem, 4.5vw + .4rem, 3.4rem); font-weight: 600; }
h1 em { font-weight: 600; font-style: italic; color: var(--ink); }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.1rem); margin-top: 1.6em; }
h3, .h3 { font-size: 1.25rem; line-height: 1.3; }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.wrap-narrow { width: min(var(--wrap-narrow), 100% - 2.5rem); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.skip-link { position: absolute; left: .75rem; top: -4rem; background: var(--ink); color: var(--on-accent); padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: .75rem; color: var(--on-accent); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 0; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.4rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: .6rem; line-height: 1; }
.brand:hover { color: var(--accent); }
.brand .logo-mark { width: 36px; height: 36px; flex: none; color: currentColor; }
.brand-name { line-height: 1.15; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.nav-links a { display: block; padding: .45rem .8rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.9375rem; /* 15px */ }
.nav-links a:hover { background: var(--tint); color: var(--ink); }
.nav-links a[aria-current="page"] { background: var(--ink); color: var(--on-accent); }

/* Buttons */
.btn { display: inline-block; padding: .8rem 1.4rem; border-radius: 999px; font-weight: 500; font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-family: var(--sans); line-height: 1.2; }
.btn-primary { background: var(--ink); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* Hero */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.eyebrow { font-size: 0.9375rem; /* 15px */ font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.eyebrow a { color: inherit; }
.lead { font-size: 1.2rem; font-weight: 400; line-height: 1.65; color: var(--muted); max-width: 38em; }
.hero-photo { justify-self: center; width: min(100%, 400px); }
.headshot { width: 100%; height: auto; border-radius: 28px; box-shadow: var(--shadow); background: var(--tint); }
.hero-photo .headshot { border-radius: 200px 200px 28px 28px; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%; }

/* Sections */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-tight { padding-top: 1rem; }
.section-tint { background: var(--tint); }
.section h2:first-child, .section-head h2 { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin-bottom: 0; }
.more-link { font-weight: 600; white-space: nowrap; }
.page-head { padding: clamp(2rem, 5vw, 4rem) 0 1rem; }
.page-head h1 { margin-bottom: .35em; }

/* Post list */
.post-list { display: flex; flex-direction: column; }
.post-item { display: flex; gap: 1.5rem; justify-content: space-between; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.post-item:last-child { border-bottom: 1px solid var(--line); }
.post-item-body { min-width: 0; }
.post-meta { font-size: 0.9375rem; font-weight: 500; color: var(--muted); margin-bottom: .35rem; }
.post-item-title { font-size: 1.55rem; margin: 0 0 .35rem; }
.post-item-title a { color: var(--ink); text-decoration: none; }
.post-item-title a:hover { color: var(--accent); text-decoration: underline; }
.post-item-desc { color: var(--muted); margin-bottom: .7rem; }
.post-item-thumb { flex: 0 0 160px; align-self: center; }
.post-item-thumb img { width: 160px; height: 110px; object-fit: cover; border-radius: 12px; }
.empty { color: var(--muted); padding: 2rem 0; }
.rss-note { margin-top: 1.5rem; color: var(--muted); font-size: 0.9375rem; font-weight: 500; }

/* Tags & badges */
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }

.tag-list a:hover { background: var(--ink); color: var(--on-accent); }
.tag-cloud { margin-top: 1rem; }
.tag-cloud .count { opacity: .8; font-size: .8em; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .55rem; border-radius: 999px; vertical-align: middle; margin-left: .4rem; }
.badge-sample { background: #EFE6D0; color: #5C4A1C; border: 1px solid #D4C9A8; }
.badge-draft { background: var(--ink); color: var(--on-accent); }

/* Post page */
.post { padding: clamp(2rem, 5vw, 4rem) 0 3rem; }
.post-header { margin-bottom: 2rem; }
.post-title { font-size: clamp(2rem, 4vw + .5rem, 3rem); margin-bottom: .4em; }
.post-lede { font-size: 1.25rem; font-weight: 400; line-height: 1.65; color: var(--muted); }
.notice { background: #EFE6D0; border: 1px solid #D4C9A8; color: #5C4A1C; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 2rem; font-size: 1.0625rem; }
.notice code { background: #E6DCC0; color: #5C4A1C; }
.post-cover { margin: 0 0 2rem; }
.post-cover img { width: 100%; border-radius: var(--radius); }
.prose { font-size: 1.125rem; line-height: 1.7; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose img { border-radius: 12px; margin: 1.5rem 0; }
.prose blockquote { margin: 1.5rem 0; padding: .25rem 0 .25rem 1.25rem; border-left: 4px solid var(--accent); color: var(--muted); font-family: var(--serif); font-weight: 600; font-size: 1.15em; font-style: italic; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose pre { background: var(--ink); color: #f3e9dc; padding: 1rem 1.25rem; border-radius: 12px; overflow-x: auto; font-size: .95rem; line-height: 1.6; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose li { margin-bottom: .35em; }
.post-footer { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.author-card { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.author-card p { margin: 0; }
.author-photo { flex: 0 0 72px; }
.author-photo .headshot { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: center 18%; box-shadow: none; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.post-nav-link { display: block; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 600; line-height: 1.3; }
.post-nav-link span { display: block; font-family: var(--sans); font-weight: 500; font-size: 0.9375rem; color: var(--muted); margin-bottom: .25rem; }
.post-nav-link:hover { border-color: var(--accent); color: var(--accent-dark); }
.post-nav-next { text-align: right; }

/* Cards, About, Contact */
.cta-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: var(--shadow); }
.cta-card h2 { margin-top: 0; }
.cta-card p { max-width: 36em; }
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 6vw, 4rem); align-items: center; }
.about-photo { justify-self: center; width: min(100%, 360px); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin: 1.25rem 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.card h2, .card h3 { margin: 0 0 .4rem; font-size: 1.2rem; }
.card p { margin-bottom: .4rem; font-size: 1.0625rem; }
.card p:last-child { margin-bottom: 0; }
.facts { list-style: none; padding: 0; }
.facts li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.5rem, 5vw, 3rem); align-items: start; }
.contact-side { display: grid; gap: 1rem; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(1.25rem, 4vw, 2rem); box-shadow: var(--shadow); }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 500; font-size: 0.9375rem; margin-bottom: .35rem; }
.field input, .field textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--field-border); border-radius: 12px; padding: .75rem .9rem; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 9rem; }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: 2.5rem 0; margin-top: 2rem; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem 2rem; align-items: start; }
.footer-brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--footer-text); margin: 0; display: flex; align-items: center; gap: .6rem; }
.footer-brand .logo-mark { width: 32px; height: 32px; flex: none; color: currentColor; }
.footer-note { margin: .2rem 0 0; font-size: 0.9375rem; font-weight: 500; color: var(--footer-muted); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem 1.25rem; flex-wrap: wrap; justify-content: flex-end; font-size: 0.9375rem; font-weight: 500; }
.site-footer a { color: var(--footer-text); }
.site-footer a:hover { color: #fff; }
.footer-copy { grid-column: 1 / -1; margin: 0; font-size: 0.9375rem; font-weight: 500; color: var(--footer-muted); border-top: 1px solid rgba(245, 241, 232, .22); padding-top: 1rem; }

/* Mobile */
@media (max-width: 760px) {
  body { font-size: 1.0625rem; /* 17px */ }
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; width: min(70%, 260px); justify-self: start; }
  .about-photo { width: min(70%, 260px); justify-self: start; }
  .header-inner { padding: .75rem 0; }
  .nav-links { margin-left: -.8rem; }
  .post-item { flex-direction: column-reverse; gap: 1rem; }
  .post-item-thumb { flex-basis: auto; }
  .post-item-thumb img { width: 100%; height: 180px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .section-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.about-body { max-width: 760px; }

/* Four-point sparkle motif from the brand swatch */
.sparkle { display: inline-block; vertical-align: middle; color: var(--ink); flex: 0 0 auto; }
.sparkle-sm { width: 12px; height: 12px; }
.sparkle-md { width: 16px; height: 16px; }
/* .brand flex rules live with the header block above */
.eyebrow { display: inline-flex; align-items: center; gap: .55rem; }
.hero-text .eyebrow .sparkle { width: 10px; height: 10px; }

/* ---- Thoughts (X-style feed) ---- */
.thought-feed { display: flex; flex-direction: column; gap: 1rem; }
.thought { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; }
.thought-avatar { flex: 0 0 48px; }
.thought-avatar .headshot { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: center 18%; box-shadow: none; }
.thought-main { min-width: 0; flex: 1; }
.thought-head { margin: 0 0 .35rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.thought-name { color: var(--ink); font-weight: 600; font-size: 1.0625rem; }
.thought-date { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.thought-date:hover { color: var(--ink); text-decoration-color: currentColor; }
.thought-head .badge { margin-left: 0; }
.thought-text { font-size: 1.1875rem; line-height: 1.6; overflow-wrap: anywhere; }
.thought-text p { margin: 0 0 .6em; }
.thought-text > :last-child { margin-bottom: 0; }
.thought-quote-body { margin: 0; }
.thought-quote-body blockquote { margin: 0; padding: .1rem 0 .1rem 1.1rem; border-left: 3px solid var(--accent); font-family: var(--serif); font-weight: 500; font-style: italic; font-size: 1.375rem; line-height: 1.45; color: var(--ink); }
.thought-quote-body figcaption { margin: .6rem 0 0 1.1rem; font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.thought-single { padding: 1.75rem; }
.thought-single .thought-text { font-size: 1.375rem; }
.thought-single .thought-quote-body blockquote { font-size: 1.75rem; }
.back-link { margin: 0 0 1rem; font-weight: 500; }
.wrap-narrow > .thought-single + .post-nav { margin-top: 2rem; }

/* ---- Photos (masonry gallery + lightbox) ---- */
.photo-grid { list-style: none; margin: 0; padding: 0; column-count: 3; column-gap: 1.1rem; }
.photo { break-inside: avoid; margin: 0 0 1.4rem; }
.photo-link { display: block; border-radius: 12px; overflow: hidden; background: var(--tint); line-height: 0; box-shadow: var(--shadow); }
.photo-link img { width: 100%; height: auto; display: block; transition: transform .35s ease; }
.photo-link:hover img { transform: scale(1.03); }
.photo-meta { margin: .55rem .15rem 0; font-size: 0.9375rem; font-weight: 500; line-height: 1.4; color: var(--muted); display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: baseline; }
.photo-caption { flex-basis: 100%; color: var(--ink); font-size: 1rem; }
.photo-meta .badge { margin-left: 0; }
.lightbox { border: 0; padding: 0; background: transparent; color: #F5F1E8; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; overflow: hidden; }
.lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: 3.5rem .75rem 1rem; }
.lightbox::backdrop { background: rgba(31, 31, 34, .97); }
.lightbox form { display: contents; }
.lb-fig { margin: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.lb-fig img { max-width: 100%; max-height: calc(100dvh - 11rem); width: auto; height: auto; object-fit: contain; border-radius: 6px; }
.lb-fig figcaption { font-size: 1.0625rem; font-weight: 500; text-align: center; max-width: 60ch; color: #F5F1E8; }
.lb-date { display: block; font-size: 0.9375rem; color: #E4E0D8; margin-top: .15rem; }
.lb-close, .lb-nav { font-family: var(--sans); font-size: 1rem; font-weight: 500; color: #F5F1E8; background: rgba(245, 241, 232, .14); border: 1px solid rgba(245, 241, 232, .55); border-radius: 999px; cursor: pointer; }
.lb-close { position: absolute; top: .9rem; right: .9rem; padding: .5rem 1rem; }
.lb-nav { width: 3rem; height: 3rem; font-size: 1.25rem; }
.lb-close:hover, .lb-nav:hover { background: rgba(245, 241, 232, .28); }
@media (max-width: 1000px) { .photo-grid { column-count: 2; } }
@media (max-width: 600px) {
  .photo-grid { column-count: 1; }
  .thought { padding: 1rem; gap: .75rem; }
  .thought-avatar { flex-basis: 40px; }
  .thought-avatar .headshot { width: 40px; height: 40px; }
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; padding: 3.5rem .5rem 1rem; }
  .lb-nav { position: absolute; bottom: 1rem; width: 3rem; height: 3rem; }
  .lb-prev { left: 1rem; } .lb-next { right: 1rem; }
  .lb-fig img { max-height: calc(100dvh - 13rem); }
}
@media (prefers-reduced-motion: reduce) { .photo-link img { transition: none; } }
.thought-h1 { font-size: 2rem; margin: 0 0 1rem; }

.logo-mark { display: block; overflow: visible; }
@media (max-width: 760px) {
  .brand .logo-mark { width: 30px; height: 30px; }
}

/* ---- Work (project cards) ---- */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.work-grid-tease { margin-top: .5rem; }
@media (max-width: 760px) { .work-grid { grid-template-columns: 1fr; } }
.work-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem 1.35rem; display: flex; flex-direction: column; gap: .7rem; }
.work-meta { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; font-size: 0.9375rem; font-weight: 500; letter-spacing: .04em; color: var(--muted); }
.work-index { font-variant-numeric: tabular-nums; letter-spacing: .12em; text-transform: uppercase; }
.work-title { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; line-height: 1.2; margin: 0; color: var(--ink); }
.work-desc { margin: 0; font-size: 1.125rem; line-height: 1.65; }
.work-desc p { margin: 0; }
.work-desc > :last-child { margin-bottom: 0; }
.work-tags { list-style: none; margin: .15rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.work-tags li { background: var(--tag-bg); color: var(--tag-text); font-size: 0.875rem; font-weight: 500; padding: .25rem .65rem; border-radius: 999px; }
.work-links { margin: .25rem 0 0; font-weight: 500; }
.work-links a { color: var(--ink); }
.work-cta { margin: 2rem 0 0; text-align: center; font-weight: 500; }
