/* yousef.uk/blog
   Dark palette = the CV site's tokens (style.css): smoky-black #121212-ish, eerie-black, jet, orange-yellow-crayola #FFDB70.
   Light palette = warm paper with a darkened gold for text (AA checked: accent 6.0:1, muted 6.0:1 on --bg). */
:root,
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111111;
  --surface: #1b1b1c;
  --elevated: #232325;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f2;
  --body: #dcdcd8;
  --muted: #9d9d98;
  --accent: #ffdb70;       /* text-safe accent: 14:1 on --bg */
  --accent-fill: #ffdb70;  /* decorative fills: bars, progress, drop cap */
  --accent-dim: rgba(255, 219, 112, 0.12);
  --on-accent: #111111;
  --header-bg: rgba(17, 17, 17, 0.82);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #faf8f3;
  --surface: #f1eee5;
  --elevated: #e9e4d7;
  --line: rgba(26, 25, 22, 0.1);
  --line-strong: rgba(26, 25, 22, 0.2);
  --text: #1a1916;
  --body: #33322e;
  --muted: #615f57;
  --accent: #7a5a00;       /* 6.0:1 on --bg, 5.5:1 on --surface */
  --accent-fill: #e8b630;
  --accent-dim: #f6eccc;
  --on-accent: #1a1916;
  --header-bg: rgba(250, 248, 243, 0.86);
  --shadow: 0 18px 40px rgba(60, 50, 20, 0.12);
}
:root {
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max: 80rem;
  --prose: 42rem;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-fill); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 2rem; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--accent-fill); color: var(--on-accent); padding: .5rem .9rem; border-radius: 8px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 2rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; background: var(--elevated); }
.brand .slash { color: var(--muted); font-weight: 500; }
.brand .blogword { color: var(--accent); }
.header-nav { display: flex; gap: 1.6rem; margin-left: auto; font-size: .92rem; color: var(--muted); font-weight: 600; }
.header-nav a { white-space: nowrap; position: relative; }
.header-nav a:hover, .header-nav a[aria-current] { color: var(--text); }
.header-nav a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -22px; height: 2px; background: var(--accent-fill); }
.theme-toggle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--text); padding: 0; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
[data-theme='dark'] .icon-moon, [data-theme='light'] .icon-sun { display: none; }

/* reading progress */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent-fill); transform-origin: 0 50%; transform: scaleX(0); }

/* index layout */
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3.5rem; padding-top: 3rem; padding-bottom: 5rem; }
.layout > *, .post-layout > * { min-width: 0; }
.rail { position: sticky; top: 96px; align-self: start; }
.rail-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.rail-tag { color: var(--muted); font-size: .92rem; margin: .4rem 0 1.6rem; }
.cat-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .15rem; }
.cat-nav a { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .8rem; border-radius: 10px; color: var(--muted); font-size: .93rem; font-weight: 600; }
.cat-nav a:hover { background: var(--surface); color: var(--text); }
.cat-nav a.is-active { background: var(--accent-dim); color: var(--accent); }
.cat-nav .count { font-variant-numeric: tabular-nums; opacity: .75; }
.rail-foot { margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); display: flex; flex-direction: column; gap: .55rem; }
.rail-foot a { display: inline-flex; align-items: center; gap: .45rem; }
.rail-foot a:hover { color: var(--accent); }

/* page title keeps the CV site's gold bar */
.page-title { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin: 0; line-height: 1.1; }
.page-title::after { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--accent-fill); margin-top: .9rem; }
.lede { color: var(--muted); margin: .9rem 0 2.2rem; max-width: 40rem; }
.empty { color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem; }

/* cards */
.meta { font-size: .75rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0; }
.meta .cat { color: var(--accent); }
.hero-card { display: grid; grid-template-columns: 1.45fr 1fr; gap: 2.2rem; align-items: center; padding-bottom: 2.8rem; border-bottom: 1px solid var(--line); margin-bottom: 2.6rem; }
.hero-card .cover { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.hero-card h2 { font-size: 2rem; line-height: 1.15; letter-spacing: -.02em; margin: .7rem 0 .8rem; transition: color .2s; }
.hero-card:hover h2 { color: var(--accent); }
.hero-card .ex { color: var(--body); margin: 0 0 1.3rem; }
.read { color: var(--accent); font-weight: 700; font-size: .93rem; display: inline-flex; align-items: center; gap: .4rem; }
.feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.6rem 2rem; }
.card .cover { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; border-radius: 14px; border: 1px solid var(--line); transition: transform .3s ease, box-shadow .3s ease; }
.card:hover .cover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:hover h3 { color: var(--accent); }
.card .meta { margin-top: 1rem; }
.card h3 { font-size: 1.2rem; line-height: 1.3; margin: .45rem 0 .5rem; letter-spacing: -.01em; transition: color .2s; }
.card .ex { color: var(--muted); font-size: .95rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* post */
.post-head { padding-top: 3rem; max-width: 56rem; }
.crumbs { font-size: .86rem; color: var(--muted); display: flex; gap: .5rem; font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.crumbs .cat { color: var(--accent); }
.post-title { font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.06; letter-spacing: -.035em; font-weight: 800; margin: 1rem 0; }
.dek { font-size: 1.2rem; color: var(--muted); margin: 0; max-width: 46rem; }
.feature { margin: 2.25rem 0 0; }
.feature img { width: 100%; aspect-ratio: 2.2 / 1; object-fit: cover; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); }
.feature figcaption { font-size: .85rem; color: var(--muted); margin-top: .7rem; }
.post-layout { display: grid; grid-template-columns: 14rem minmax(0, var(--prose)) 14rem; justify-content: space-between; gap: 3rem; padding-top: 3rem; padding-bottom: 5rem; }
.post-layout.no-toc { grid-template-columns: minmax(0, var(--prose)) 14rem; justify-content: center; gap: 6rem; }
.toc-rail { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; }
.toc-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 0 0 .8rem; }
.toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-strong); }
.toc a { display: block; padding: .38rem 0 .38rem 1rem; margin-left: -1px; border-left: 2px solid transparent; font-size: .88rem; color: var(--muted); line-height: 1.4; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent-fill); font-weight: 600; }
.toc .sub a { padding-left: 1.8rem; font-size: .84rem; }
.toc-mobile { display: none; }

.prose { font-size: 1.1rem; line-height: 1.78; color: var(--body); }
.prose > p:first-of-type::first-letter { float: left; font-size: 3.4rem; line-height: .9; font-weight: 800; color: var(--accent); margin: .35rem .6rem 0 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.35em; }
.prose li { margin: .3em 0; }
.prose h2 { font-size: 1.65rem; line-height: 1.25; color: var(--text); letter-spacing: -.02em; margin: 2.2em 0 .7em; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.25rem; line-height: 1.3; color: var(--text); margin: 1.8em 0 .5em; scroll-margin-top: 90px; }
.prose strong { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose blockquote { margin: 2em 0; padding: .2em 0 .2em 1.4em; border-left: 3px solid var(--accent-fill); font-size: 1.22rem; color: var(--text); font-weight: 500; }
.prose code { font-size: .9em; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .1em .35em; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; overflow: auto; font-size: .9rem; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line-strong); margin: 2.5em 0; }
.prose figure { margin: 2.2em 0; }
.prose figure.wide { margin-left: -4rem; margin-right: -4rem; }
.prose figure img { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.prose figcaption { font-size: .85rem; color: var(--muted); margin-top: .7rem; text-align: center; line-height: 1.5; }

.side { position: sticky; top: 96px; align-self: start; font-size: .88rem; color: var(--muted); }
.side .box { border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; background: var(--surface); margin-bottom: 1rem; }
.side .box h2, .author-inline h2 { margin: 0 0 .6rem; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.side .box p, .author-inline p { margin: 0 0 .6rem; }
.author-name { color: var(--text); font-weight: 800; font-size: .98rem; margin: 0 0 .1rem !important; }
.author-meta { margin: 0 0 .85rem !important; font-size: .82rem; font-variant-numeric: tabular-nums; }
.author-inline { display: none; }
.side .more, .author-inline .more { color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; }
.chip { display: inline-block; padding: .3rem .75rem; border-radius: 999px; background: var(--accent-dim); color: var(--accent); font-size: .8rem; font-weight: 700; }
.share { display: flex; gap: .5rem; flex-wrap: wrap; }
.share a, .share button { border: 1px solid var(--line-strong); border-radius: 999px; padding: .3rem .75rem; color: var(--text); font-size: .8rem; background: transparent; cursor: pointer; }
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }
.related { border-top: 1px solid var(--line); padding-top: 3rem; padding-bottom: 4rem; }
.related h2 { font-size: 1.4rem; margin: 0 0 1.6rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 2.2rem 0; color: var(--muted); font-size: .88rem; }
.foot-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.foot-row nav { display: flex; gap: 1.3rem; flex-wrap: wrap; }
.foot-row a:hover { color: var(--accent); }

/* responsive */
@media (max-width: 1180px) {
  .post-layout, .post-layout.no-toc { grid-template-columns: 13rem minmax(0, 1fr); gap: 3rem; justify-content: stretch; }
  .post-layout.no-toc { grid-template-columns: minmax(0, var(--prose)); justify-content: center; }
  .side { display: none; }
  .author-inline { display: block; margin-top: 2.5rem; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; background: var(--surface); font-size: .9rem; color: var(--muted); }
  .prose figure.wide { margin-left: 0; margin-right: 0; }
}
@media (max-width: 1100px) { .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .wrap { padding: 0 1.15rem; }
  .layout { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.6rem; }
  .rail { position: static; }
  .rail-tag { margin-bottom: 1rem; }
  .cat-nav { flex-direction: row; overflow-x: auto; gap: .4rem; padding-bottom: .3rem; scrollbar-width: none; }
  .cat-nav a { white-space: nowrap; border: 1px solid var(--line-strong); border-radius: 999px; padding: .4rem .85rem; }
  .cat-nav a.is-active { border-color: transparent; }
  .cat-nav .count, .rail-foot, .header-nav .hide-sm { display: none; }
  .hero-card { grid-template-columns: 1fr; gap: 1.2rem; }
  .hero-card h2 { font-size: 1.55rem; }
  .page-title { font-size: 2rem; }
  .post-head { padding-top: 1.8rem; }
  .post-layout, .post-layout.no-toc { grid-template-columns: minmax(0, 1fr); padding-top: 1.6rem; }
  .toc-rail { display: none; }
  .toc-mobile { display: block; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; background: var(--surface); margin-bottom: 1.8rem; }
  .toc-mobile summary { font-weight: 700; font-size: .92rem; cursor: pointer; }
  .toc-mobile .toc { margin-top: .8rem; }
  .feature { margin-top: 1.5rem; }
  .feature img { aspect-ratio: 16 / 10; border-radius: 14px; }
  .prose { font-size: 1.05rem; }
}
@media (max-width: 620px) {
  .feed { grid-template-columns: 1fr; }
  .header-row { gap: .9rem; }
  .header-nav { gap: 1rem; font-size: .86rem; }
  .brand .name, .brand .slash { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
