/* mohassan.net
   Simple, quiet, technical. System fonts, a serif for display, mono for metadata.
   Light and dark themes via [data-theme] or prefers-color-scheme. */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1b1b1a;
  --ink-2: #44443f;
  --muted: #6e6c66;
  --line: #e3e1db;
  --line-strong: #cfccc4;
  --accent: #b5470f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7dc;
  --code-bg: #efede8;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --wrap: 68rem;
  --narrow: 42rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 10px;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  --step-3: clamp(1.875rem, 1.4rem + 2.2vw, 2.75rem);
  --step-4: clamp(2.125rem, 1.4rem + 3.4vw, 3.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1a1a18; --ink: #ecebe6; --ink-2: #c9c7c0; --muted: #9a978f;
    --line: #2a2926; --line-strong: #3a3935; --accent: #f08a4b; --accent-ink: #1a0d05;
    --accent-soft: #2b1c12; --code-bg: #1f1f1d;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a18; --ink: #ecebe6; --ink-2: #c9c7c0; --muted: #9a978f;
  --line: #2a2926; --line-strong: #3a3935; --accent: #f08a4b; --accent-ink: #1a0d05;
  --accent-soft: #2b1c12; --code-bg: #1f1f1d;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent-soft); }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-size: 0.86em; letter-spacing: -0.01em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--bg); padding: 0.5rem 0.75rem; border-radius: 6px; z-index: 20; }
.skip-link:focus { top: 1rem; }

.container { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.container.narrow { max-width: calc(var(--narrow) + var(--gutter) * 2); }

.eyebrow { color: var(--muted); font-size: var(--step--1); margin-bottom: 1rem; }
.eyebrow a { text-decoration: none; }
.badge {
  display: inline-block; font: 500 0.6875rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.3rem 0.45rem; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); vertical-align: 0.2em;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 7px;
  background: var(--ink); color: var(--bg); font-size: 0.8rem; font-weight: 600;
}
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; }
.site-nav ul a { display: block; padding: 0.4rem 0.7rem; border-radius: 6px; color: var(--ink-2); font-size: 0.95rem; }
.site-nav ul a:hover { color: var(--ink); background: var(--surface); }
.site-nav ul a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.nav-cta {
  margin-left: 0.5rem; padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
  background: var(--ink); color: var(--bg);
}
.nav-cta:hover { background: var(--accent); color: var(--accent-ink); }
.theme-toggle, .nav-toggle {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 8px;
  border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--line); color: var(--ink); }
.theme-toggle { margin-left: 0.25rem; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 4rem; flex-direction: column; align-items: stretch; gap: 0.75rem;
    padding: 1rem var(--gutter) 1.5rem; background: var(--bg); border-bottom: 1px solid var(--line);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; }
  .site-nav ul a { padding: 0.65rem 0.5rem; font-size: 1.05rem; }
  .nav-cta { margin: 0; text-align: center; padding: 0.7rem 1rem; }
  .theme-toggle { align-self: flex-start; margin: 0; }
}

.draft-banner {
  background: var(--accent); color: var(--accent-ink); text-align: center; padding: 0.4rem 1rem; font-size: var(--step--1);
}

/* Keyword highlight: accent color with a soft marker underline. */
.hl {
  color: var(--accent);
  background: linear-gradient(to top, var(--accent-soft) 0.28em, transparent 0.28em);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- home ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(3rem, 7vw, 5.5rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 25.5rem; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero-photo, .about-photo { margin: 0; }
.hero-photo img, .about-photo img {
  display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 18px; background: #1b1b1a;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -24px rgb(0 0 0 / 0.35);
}
.hero-photo img { transform: rotate(1.5deg); }
/* In dark mode the charcoal photo would merge into the page, so give it a lighter edge. */
:root[data-theme="dark"] :is(.hero-photo, .about-photo) img { box-shadow: 0 0 0 1px var(--line-strong); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.hero-photo, .about-photo) img { box-shadow: 0 0 0 1px var(--line-strong); }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-photo { order: -1; width: 8.25rem; margin-bottom: 1.5rem; }
  .hero-photo img { border-radius: 50%; transform: none; }
}
.hero-title {
  font-family: var(--font-serif); font-weight: 400; font-size: var(--step-4); line-height: 1.12;
  letter-spacing: -0.02em; max-width: 22ch; text-wrap: balance;
}
.hero-lede { margin-top: 1.75rem; max-width: 40rem; color: var(--ink-2); font-size: var(--step-1); line-height: 1.55; text-wrap: pretty; }
.proof {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 1.25rem 0 0; margin: 2.5rem 0 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1);
}
.proof li { display: flex; align-items: center; gap: 0.5rem; }
.proof li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ---------- sections ---------- */
.section { padding-block: clamp(2rem, 4.5vw, 3.25rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.section-title { font-size: var(--step-1); }
.section-link { color: var(--muted); font-size: 0.95rem; text-decoration: none; white-space: nowrap; }
.section-intro { color: var(--ink-2); max-width: 40rem; margin-bottom: 1.75rem; }

/* projects (home) */
.projects { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); }
.project-link {
  display: grid; grid-template-columns: 9rem 1fr auto; gap: 1.5rem; align-items: baseline;
  padding: 1.1rem 0.25rem; text-decoration: none; transition: background 0.15s, padding 0.15s;
}
.project-link:hover { color: var(--ink); background: var(--surface); padding-inline: 0.85rem; border-radius: 6px; }
.project-name { font-weight: 600; }
.project-summary { color: var(--ink-2); }
.project-domain { color: var(--muted); font-size: var(--step--1); white-space: nowrap; }
.project-link:hover .project-domain { color: var(--accent); }
@media (max-width: 760px) {
  .project-link { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* project cards (building) */
.project-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.project-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.project-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.project-card-name { font-size: var(--step-1); }
.project-card-summary { color: var(--ink); }
.project-card-why { color: var(--ink-2); margin-top: 0.75rem; font-size: 0.97rem; }
.project-card-why .mono { color: var(--muted); }
.project-card-link { display: inline-block; margin-top: 1rem; color: var(--accent); text-decoration: none; }

/* lists (writing, notes) */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list-item { border-bottom: 1px solid var(--line); padding: 1.15rem 0; }
.list-item[hidden] { display: none; }
.list-link { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; text-decoration: none; }
.list-link:hover { color: var(--ink); }
.list-link:hover .list-title { color: var(--accent); }
.list-title { font-weight: 550; font-size: 1.05rem; line-height: 1.4; text-wrap: pretty; }
.list-meta { color: var(--muted); font-size: var(--step--1); white-space: nowrap; flex-shrink: 0; }
.list-summary { color: var(--muted); margin-top: 0.35rem; font-size: 0.95rem; max-width: 36rem; }
@media (max-width: 640px) {
  .list-link { flex-direction: column-reverse; gap: 0.25rem; }
}

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.filter {
  font: inherit; font-size: 0.9rem; padding: 0.35rem 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.filter .mono { color: var(--muted); margin-left: 0.2rem; }
.filter:hover { border-color: var(--line-strong); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter[aria-pressed="true"] .mono { color: inherit; opacity: 0.7; }
.filter-empty { color: var(--muted); padding: 1rem 0; }

/* callout (keytactic) */
.callout {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 2.25rem);
}
.callout > div { max-width: 36rem; }
.callout .eyebrow { margin-bottom: 0.5rem; }
.callout-title { font-size: var(--step-1); margin-bottom: 0.4rem; }
.callout p { color: var(--ink-2); }

.button {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.7rem 1.1rem; border-radius: 999px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 500; font-size: 0.95rem; white-space: nowrap;
}
.button:hover { background: var(--accent); color: var(--accent-ink); }
.button-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.button-quiet:hover { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- page heads ---------- */
.page-head { padding-block: clamp(3rem, 8vw, 5.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-title { font-family: var(--font-serif); font-weight: 400; font-size: var(--step-3); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; max-width: 26ch; }
.page-lede { margin-top: 1.25rem; color: var(--ink-2); font-size: var(--step-1); line-height: 1.55; max-width: 40rem; }

/* about */
.about-grid { display: grid; grid-template-columns: 17rem minmax(0, var(--narrow)); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about-aside { position: sticky; top: 6rem; display: grid; gap: 1.5rem; }
.facts { margin: 0; display: grid; gap: 0.9rem; font-size: var(--step--1); }
.facts div { display: grid; gap: 0.15rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); }
.facts a { text-decoration: none; }
.about-timeline { padding-bottom: 0; }
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-aside { position: static; grid-template-columns: 8rem 1fr; align-items: start; }
  .about-photo img { border-radius: 14px; }
  .facts { gap: 0.6rem; }
  .facts div { padding-top: 0.6rem; }
  .facts div:first-child { border-top: 0; padding-top: 0; }
}

/* wide index pages: list rows use the full width, summaries stay readable */
.page-writing .list-summary, .page-notes .list-summary { max-width: 44rem; }
@media (min-width: 900px) {
  .project-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-card { display: flex; flex-direction: column; }
  .project-card-link { margin-top: auto; padding-top: 1rem; }
}

/* timeline */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0 0 1.75rem 1.5rem; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 0.55rem; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg); box-shadow: 0 0 0 1.5px var(--line-strong);
}
.timeline li:first-child::before { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.timeline-when { color: var(--muted); font-size: var(--step--1); padding-top: 0.2rem; }
.timeline h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.timeline p { color: var(--ink-2); font-size: 0.97rem; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: 0.2rem; } }

/* ---------- posts ---------- */
.post { padding-top: clamp(2.5rem, 7vw, 4.5rem); }
.post-head { margin-bottom: 2.5rem; }
.post-title { font-family: var(--font-serif); font-weight: 400; font-size: var(--step-3); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.post-meta { margin-top: 1rem; color: var(--muted); font-size: var(--step--1); }
.post-tags { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1); display: flex; flex-wrap: wrap; gap: 0.75rem; }

.prose { font-size: 1.0625rem; line-height: 1.75; color: var(--ink); }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: var(--step-2); margin-top: 2.2em; letter-spacing: -0.02em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.9em; }
.prose h4, .prose h5, .prose h6 { font-size: 1.05rem; margin-top: 1.6em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.6em; }
.prose :is(h2, h3, h4, h5, h6) { position: relative; }
.prose .anchor { position: absolute; left: -1.1em; color: var(--line-strong); text-decoration: none; opacity: 0; font-weight: 400; }
.prose :is(h2, h3, h4):hover .anchor { opacity: 1; }
.prose a { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin-inline: 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 2px solid var(--accent);
  color: var(--ink-2); font-family: var(--font-serif); font-size: 1.15rem;
}
.prose blockquote > * + * { margin-top: 0.75em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em; }
.prose img { display: block; border-radius: 8px; border: 1px solid var(--line); margin-inline: auto; max-height: 80vh; width: auto; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--code-bg); padding: 0.12em 0.35em; border-radius: 4px; }
.prose pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.15rem;
  overflow-x: auto; font-size: 0.88rem; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose .table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; }
@media (max-width: 760px) { .prose .anchor { display: none; } }

/* ---------- footer ---------- */
.site-footer { margin-top: clamp(3rem, 8vw, 6rem); border-top: 1px solid var(--line); padding-block: clamp(2.5rem, 6vw, 4rem) 2rem; }
.footer-cta { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap; }
.footer-title { font-family: var(--font-serif); font-weight: 400; font-size: var(--step-2); margin-bottom: 0.5rem; }
.footer-cta p { color: var(--ink-2); max-width: 32rem; }
.footer-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.footer-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .draft-banner { display: none; }
  body { background: #fff; color: #000; }
}
