/* Ahmad Elbanna — Engineering Notes. A deliberately restrained editorial theme. */
:root {
  color-scheme: dark;
  --bg: #0a0908;
  --panel: #11100d;
  --text: #f5f1e9;
  --muted: #c9c2b8;
  --gold: #d4b878;
  --gold-bright: #e8d390;
  --rule: rgba(214, 189, 122, .77);
  --rule-soft: rgba(214, 189, 122, .18);
  --serif: Georgia, 'Iowan Old Style', 'Baskerville', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; }
img { display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold-bright); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 5px; }
::selection { background: var(--gold); color: #111; }
.shell { width: min(100% - 64px, 1090px); margin-inline: auto; }
.skip-link {
  position: fixed; z-index: 20; top: 8px; left: 12px;
  padding: 9px 14px; background: var(--gold); color: #111;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

/* Thin gold lines and a little geometry, not decorative measurements. */
body::before, body::after { content: ''; position: absolute; width: 230px; height: 230px; pointer-events: none; z-index: -1; }
body::before {
  left: -96px; top: -105px; transform: rotate(40deg);
  border-right: 1px solid rgba(229, 182, 99, .32);
  background: linear-gradient(90deg, transparent 50%, rgba(91, 59, 20, .12) 92%, transparent);
}
body::after {
  right: -170px; top: 690px; transform: rotate(43deg);
  border-left: 1px solid rgba(229, 182, 99, .20);
  background: linear-gradient(90deg, transparent 40%, rgba(130, 75, 19, .07) 80%, transparent);
}
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 84px; padding-block: 15px 11px; gap: 20px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.site-header::after {
  content: ''; position: absolute; right: -13px; bottom: -1px;
  height: 22px; border-right: 1px solid var(--rule);
  transform: rotate(43deg); transform-origin: bottom right;
}
.brand { display: inline-flex; gap: 14px; align-items: center; min-width: 0; }
.brand__mark { width: 46px; height: 46px; flex: 0 0 auto; }
.brand span {
  font-family: var(--serif); font-size: 20px;
  letter-spacing: .17em; text-transform: uppercase; white-space: nowrap;
}
.site-nav { display: flex; gap: 34px; align-items: center; }
.site-nav a { color: var(--text); font-size: 17px; transition: color .2s ease; }
.site-nav a:hover { color: var(--gold-bright); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  align-items: center; min-height: 617px; position: relative;
}
.hero__copy { position: relative; z-index: 2; padding-block: 52px 105px; }
.eyebrow, .section-line {
  color: var(--gold-bright); font-size: 14px; line-height: 1.4;
  font-weight: 500; letter-spacing: .22em; text-transform: uppercase;
}
.hero h1 {
  font-family: var(--serif); font-size: clamp(55px, 5.2vw, 78px);
  font-weight: 400; line-height: 1.02; letter-spacing: -.045em;
  max-width: 640px; margin: 35px -95px 22px 0;
}
.hero__description {
  max-width: 405px; margin: 0 0 33px;
  font-size: clamp(18px, 1.65vw, 22px); line-height: 1.44; color: var(--muted);
}
.text-link {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--gold-bright); font-size: 19px;
  border-bottom: 1px solid var(--gold-bright); padding-bottom: 6px;
  transition: color .2s ease, border-color .2s ease;
}
.text-link:hover { color: #fff1b4; border-color: #fff1b4; }
.text-link span { font-size: 24px; line-height: 1; }
.hero__art {
  position: relative; align-self: stretch; min-width: 0;
  display: flex; align-items: flex-end; justify-content: flex-end;
}
.hero__art::before {
  content: ''; position: absolute; inset: 15% -4% 10% 2%; pointer-events: none;
  background: radial-gradient(ellipse at 62% 52%, rgba(169, 93, 25, .14), transparent 66%);
}
.hero__art img {
  position: relative; z-index: 1; width: min(106%, 540px); max-width: none;
  height: auto; margin: 0 -22px -5px 0;
  object-fit: contain; filter: drop-shadow(0 0 25px rgba(173, 102, 39, .10));
}

.writing { scroll-margin-top: 25px; }
.section-line {
  display: flex; align-items: center; gap: 23px;
  white-space: nowrap; font-size: 14px;
}
.section-line::after {
  content: ''; height: 1px; flex: 1; min-width: 0;
  background: linear-gradient(90deg, var(--rule), rgba(214, 189, 122, .64));
}
.writing__list { margin: 23px 0 0; }
.post-card { border-bottom: 1px solid var(--rule-soft); }
.post-card:last-child { border-bottom: 0; }
.post-card__link {
  display: flex; justify-content: space-between; align-items: center;
  gap: 35px; padding: 16px 0 33px;
}
.post-card__main { min-width: 0; }
.post-card h2 {
  margin: 0; font: 400 clamp(36px, 3.9vw, 55px)/1.13 var(--serif);
  letter-spacing: -.035em; transition: color .2s ease;
}
.post-card__excerpt {
  max-width: 680px; margin: 10px 0 17px;
  color: var(--muted); font-size: 19px; line-height: 1.4;
}
.post-card__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 0; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: .19em;
}
.post-card__arrow {
  display: block; flex: 0 0 auto; color: var(--gold-bright);
  font-family: var(--serif); font-size: 36px;
  transition: transform .2s ease;
}
.post-card__link:hover h2 { color: var(--gold-bright); }
.post-card__link:hover .post-card__arrow { transform: translateX(5px); }
.empty-state { padding: 28px 0 35px; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; gap: 20px; margin: 15px 0 34px; font-size: 13px; color: var(--muted); }
.pagination a { color: var(--gold-bright); }

.about { margin-top: 58px; scroll-margin-top: 25px; }
.about__copy { margin-top: 30px; max-width: 800px; }
.about h2 {
  margin: 0 0 14px; max-width: 780px; font: 400 clamp(25px, 2.6vw, 35px)/1.22 var(--serif);
  letter-spacing: -.023em;
}
.about p {
  margin: 0; max-width: 730px; color: var(--muted);
  font-size: clamp(16px, 1.5vw, 18px); line-height: 1.55;
}
.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 85px; padding-block: 28px 42px;
  position: relative; color: var(--muted); font-size: 15px;
}
.site-footer__rule { position: absolute; inset: 0 0 auto; height: 1px; background: var(--rule); }
.site-footer p { margin: 0; }

/* Ghost article, page, code, cards and embeds. */
.article-shell { min-height: 58vh; }
.article { width: min(100%, 780px); margin: 75px auto 0; }
.article__header { margin-bottom: 52px; }
.article__header h1, .error-page h1 {
  margin: 22px 0; font: 400 clamp(44px, 5.5vw, 76px)/1.07 var(--serif);
  letter-spacing: -.045em;
}
.article__dek { margin: 0 0 23px; font-size: 22px; line-height: 1.45; color: var(--muted); }
.article__image { margin: 0 0 50px; }
.article__image img { width: 100%; height: auto; border-radius: 2px; }
.article__content { color: #e8e3db; font-size: 19px; line-height: 1.78; overflow-wrap: anywhere; }
.gh-content > * { max-width: 100%; }
.gh-content h2, .gh-content h3, .gh-content h4 {
  color: var(--text); font-family: var(--serif); font-weight: 400;
  line-height: 1.2; letter-spacing: -.025em;
  margin: 1.8em 0 .65em;
}
.gh-content h2 { font-size: 1.75em; }
.gh-content h3 { font-size: 1.4em; }
.gh-content p { margin: 0 0 1.4em; }
.gh-content a { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }
.gh-content ul, .gh-content ol { padding-left: 1.45em; margin-bottom: 1.4em; }
.gh-content li { padding-left: .15em; margin: .25em 0; }
.gh-content blockquote { border-left: 2px solid var(--gold); padding-left: 20px; margin: 2em 0; color: var(--muted); font-family: var(--serif); font-style: italic; }
.gh-content hr { margin: 50px 0; border: 0; border-top: 1px solid var(--rule-soft); }
.gh-content img { max-width: 100%; height: auto; }
.gh-content figure { margin: 2em 0; }
.gh-content figcaption { margin-top: 8px; text-align: center; color: var(--muted); font-size: 14px; }
.gh-content :not(pre) > code { padding: .18em .34em; border-radius: 3px; background: #24211d; color: #f2d39c; font-size: .86em; }
.gh-content pre {
  display: block; max-width: 100%; overflow-x: auto; padding: 18px 20px;
  border: 1px solid var(--rule-soft); background: #181613;
  border-radius: 4px; white-space: pre; tab-size: 2;
  font-size: 15px; line-height: 1.55;
}
.gh-content pre code { background: none; color: #e4d5bd; font-size: inherit; }
.gh-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 16px; }
.gh-content th, .gh-content td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--rule-soft); }
.gh-content .kg-width-wide, .gh-content .kg-width-full { max-width: 100%; }
.gh-content .kg-image-card, .gh-content .kg-gallery-card { margin: 2em 0; }
.gh-content .kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.gh-content .kg-gallery-row { display: flex; gap: 8px; }
.gh-content .kg-gallery-image { flex: 1; min-width: 0; }
.gh-content .kg-gallery-image img { width: 100%; height: auto; }
.gh-content iframe { max-width: 100%; }
.article__footer { margin: 60px 0 10px; }
.error-page { padding-block: 95px 160px; min-height: 55vh; }
.error-page > p:not(.eyebrow) { color: var(--muted); margin-bottom: 30px; }

@media (max-width: 840px) {
  .shell { width: min(100% - 52px, 760px); }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero__copy { padding: 62px 0 0; }
  .hero h1 { max-width: 660px; margin: 20px 0 20px; font-size: clamp(55px, 9vw, 78px); }
  .hero__art { height: clamp(350px, 63vw, 520px); margin: -12px -8px 2px 0; }
  .hero__art img { width: min(94%, 525px); margin: 0 -2% -6% 0; }
  .about { margin-top: 57px; }
}

@media (max-width: 540px) {
  body { font-size: 16px; }
  .shell { width: calc(100% - 40px); }
  .site-header { min-height: 67px; gap: 8px; padding: 10px 0; }
  .site-header::after { height: 14px; right: -8px; }
  .brand { gap: 7px; }
  .brand__mark { width: 32px; height: 32px; }
  .brand span { font-size: 12px; letter-spacing: .11em; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 13px; }
  .hero__copy { padding: 51px 0 0; }
  .eyebrow, .section-line { font-size: 11px; letter-spacing: .22em; }
  .hero h1 { font-size: clamp(47px, 13vw, 66px); line-height: 1.02; margin: 20px 0 18px; letter-spacing: -.045em; }
  .hero__description { font-size: 17px; max-width: 330px; margin-bottom: 25px; }
  .text-link { font-size: 17px; }
  .hero__art { height: clamp(340px, 100vw, 430px); margin: -8px -16px 4px 0; }
  .hero__art img { width: min(108%, 445px); margin: 0 -8% -6% 0; }
  .section-line { gap: 13px; }
  .writing__list { margin-top: 17px; }
  .post-card__link { align-items: flex-start; gap: 12px; padding: 12px 0 27px; }
  .post-card h2 { font-size: clamp(32px, 9vw, 43px); }
  .post-card__excerpt { font-size: 17px; line-height: 1.45; margin: 11px 0 13px; }
  .post-card__meta { gap: 7px; font-size: 10px; letter-spacing: .12em; }
  .post-card__arrow { font-size: 28px; padding-top: 4px; }
  .about { margin-top: 48px; }
  .about__copy { margin-top: 23px; }
  .about h2 { font-size: clamp(24px, 6.2vw, 30px); }
  .about p { font-size: 16px; }
  .site-footer { margin-top: 67px; padding: 23px 0 35px; font-size: 12px; }
  .article { margin-top: 54px; }
  .article__header { margin-bottom: 33px; }
  .article__header h1 { font-size: clamp(43px, 11vw, 57px); }
  .article__dek { font-size: 18px; }
  .article__content { font-size: 17px; line-height: 1.74; }
  .gh-content pre { font-size: 13px; padding: 13px 12px; }
  .error-page { padding-block: 65px 120px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
