/* =========================================================
   ElZouhery.com — design system
   Concept "Signal": dark, bento, orange accent
   ========================================================= */

:root {
  --bg: #0E0E12;
  --bg-soft: #131319;
  --card: #17171D;
  --card-2: #1F1F27;
  --line: #26262F;
  --line-2: #33333F;

  --ink: #F5F5F7;
  --ink-2: #A0A0AE;
  --ink-3: #6B6B7A;

  --acc: #FF5C35;
  --acc-2: #FFB020;
  --blue: #5B8CFF;
  --green: #3ED598;

  --max: 1140px;
  --radius: 16px;
  --radius-lg: 22px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Space Grotesk", var(--font);
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--acc); color: #180703; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
.dsp { font-family: var(--display); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Hidden by clipping rather than by an off-canvas offset — a -9999px element
   still counts toward the document box in some mobile browsers. */
.skip {
  position: absolute; top: 0; left: 0; z-index: 100;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  background: var(--acc); color: #180703; padding: 10px 18px;
  border-radius: 0 0 10px 0; font-weight: 600;
}
.skip:focus {
  width: auto; height: auto; overflow: visible;
  clip: auto; clip-path: none;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(14, 14, 18, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 20px; }
.brand {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: -.02em; display: flex; align-items: center; gap: 10px;
}
.mark {
  width: 27px; height: 27px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  display: grid; place-items: center;
  font-size: 13px; color: #160A05; font-weight: 700;
}
.nav-links { display: flex; gap: 26px; font-size: 14.5px; color: var(--ink-2); align-items: center; }
.nav-links a { transition: color .16s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--acc); }
.nav-cta {
  border: 1px solid var(--line); background: var(--card);
  padding: 8px 15px; border-radius: 9px; color: var(--ink) !important; font-weight: 500;
}
.nav-cta:hover { border-color: var(--acc); }
@media (max-width: 820px) {
  .nav-links { gap: 18px; font-size: 14px; }
  .nav-links .hide-sm { display: none; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 20px; }
  .nav { height: 60px; gap: 12px; }
  .nav-links { gap: 16px; }
  .nav-cta { padding: 7px 12px; font-size: 13.5px; }
  .brand { font-size: 15.5px; }
}
@media (max-width: 470px) {
  .nav-cta { display: none; }
}
/* Very narrow phones (iPhone SE and similar): drop the brand wordmark and
   keep the mark, so the three nav links still fit on one line. */
@media (max-width: 400px) {
  .brand-text { display: none; }
  .nav-links { gap: 14px; font-size: 13.5px; }
  .wrap { padding: 0 16px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 24px; border-radius: 11px;
  font-size: 15px; font-weight: 600; line-height: 1;
  border: 1px solid var(--line); transition: .18s; cursor: pointer;
}
.btn-p { background: var(--acc); border-color: var(--acc); color: #180703; }
.btn-p:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(255, 92, 53, .5); }
.btn-s { background: var(--card); color: var(--ink); }
.btn-s:hover { border-color: var(--line-2); transform: translateY(-2px); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 76px; position: relative; }
.hero > *:not(.blob) { position: relative; z-index: 1; }
/* Ambient glow behind the hero. Kept inside the viewport on narrow screens —
   a blurred circle hanging past the right edge is enough to make iOS Safari
   pan horizontally, even with overflow-x hidden on the body. */
.blob {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  filter: blur(120px); opacity: .22; pointer-events: none; z-index: 0;
}
.blob-1 { background: var(--acc); top: -150px; right: -110px; }
.blob-2 { background: var(--blue); top: 130px; left: -190px; opacity: .15; }

@media (max-width: 820px) {
  .blob { width: min(420px, 88vw); height: min(420px, 88vw); filter: blur(90px); }
  .blob-1 { top: -90px; right: 0; }
  .blob-2 { top: 220px; left: 0; }
}

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; padding: 7px 15px;
  border: 1px solid var(--line); border-radius: 99px;
  color: var(--ink-2); margin-bottom: 26px; background: var(--card);
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none;
  box-shadow: 0 0 0 0 rgba(62, 213, 152, .7); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(62, 213, 152, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 213, 152, 0); }
}

h1.hero-title {
  font-family: var(--display);
  font-size: clamp(42px, 8vw, 86px);
  line-height: .98; letter-spacing: -.045em; font-weight: 700;
  margin-bottom: 26px;
}
.grad {
  background: linear-gradient(100deg, var(--acc), var(--acc-2) 55%, var(--blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(16px, 2vw, 19.5px); color: var(--ink-2); max-width: 58ch; margin-bottom: 34px; }

.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 36px; } }
.portrait-frame {
  position: relative; width: 280px; border-radius: var(--radius-lg);
  padding: 6px; background: linear-gradient(150deg, rgba(255, 92, 53, .55), rgba(91, 140, 255, .25) 60%, transparent);
}
.portrait {
  width: 100%; height: auto; aspect-ratio: 26 / 31; object-fit: cover; object-position: 50% 18%;
  border-radius: 17px; display: block;
}
@media (max-width: 900px) { .portrait-frame { width: 210px; } }
.portrait-ph {
  width: 260px; height: 300px; border-radius: var(--radius-lg);
  border: 1px dashed var(--line-2); background: var(--card);
  display: grid; place-items: center; text-align: center;
  color: var(--ink-3); font-size: 12.5px; line-height: 1.5; padding: 20px;
}
.portrait-ph code {
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px;
  color: var(--ink-2); word-break: break-all;
}
@media (max-width: 900px) { .portrait, .portrait-ph { width: 180px; height: 210px; } }

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Divider used where the marquee used to sit */
.rule-full { height: 1px; background: var(--line); }

/* ---------- Sections ---------- */
section { padding: 80px 0; }
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: .15em;
  text-transform: uppercase; color: var(--acc); margin-bottom: 12px;
}
h2 {
  font-family: var(--display); font-size: clamp(28px, 4.4vw, 44px);
  letter-spacing: -.03em; font-weight: 700; margin-bottom: 14px; line-height: 1.08;
}
h3 { font-family: var(--display); letter-spacing: -.02em; font-weight: 600; }
.sub { color: var(--ink-2); font-size: 16px; max-width: 60ch; margin-bottom: 40px; }
.sec-link { color: var(--acc); font-weight: 600; font-size: 15px; display: inline-flex; gap: 7px; align-items: center; }
.sec-link:hover { gap: 12px; transition: gap .18s; }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.tile {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px; transition: .22s; position: relative; overflow: hidden;
}
.tile:hover { transform: translateY(-3px); border-color: var(--line-2); }
.t-full { grid-column: span 6; }
.t-wide { grid-column: span 4; }
.t-half { grid-column: span 3; }
.t-third { grid-column: span 2; }
@media (max-width: 940px) { .t-wide, .t-half { grid-column: span 6; } .t-third { grid-column: span 3; } }
@media (max-width: 560px) { .t-third { grid-column: span 6; } }

.tile.featured {
  border-color: rgba(255, 92, 53, .45);
  background:
    linear-gradient(135deg, rgba(255, 92, 53, .10), rgba(255, 176, 32, .04)),
    var(--card);
}
.tile.featured:hover { border-color: var(--acc); }
.tile h3 { font-size: 20px; margin-bottom: 9px; }
.tile .ext { color: var(--acc); font-size: 16px; display: inline-block; transition: transform .18s; }
.tile:hover .ext { transform: translate(3px, -3px); }
.tile-link {
  display: inline-block; margin-top: 12px; font-size: 13.5px;
  font-family: var(--display); font-weight: 600; color: var(--acc);
  border-bottom: 1px solid rgba(255, 92, 53, .4); padding-bottom: 1px;
}
.tile p { font-size: 14.5px; color: var(--ink-2); }
.tile .meta { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.big {
  font-family: var(--display); font-size: clamp(38px, 6vw, 58px);
  line-height: 1; letter-spacing: -.04em; font-weight: 700; margin-bottom: 6px;
}
.lbl { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 7px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2);
}

/* ---------- Projects ---------- */
/* auto-fit: one project fills the row, two sit side by side */
.proj-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

.proj-card, .proj-detail {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; transition: .22s;
}
.proj-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.proj-card.featured, .proj-detail.featured {
  border-color: rgba(255, 92, 53, .4);
  background: linear-gradient(135deg, rgba(255, 92, 53, .09), rgba(255, 176, 32, .03)), var(--card);
}
.proj-detail + .proj-detail { margin-top: 18px; }

.proj-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.proj-type {
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
  color: var(--acc); border: 1px solid rgba(255, 92, 53, .35);
  padding: 4px 10px; border-radius: 6px;
}
.proj-status {
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--green); display: inline-flex; align-items: center; gap: 7px;
}
.proj-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green);
}

.proj-card h3, .proj-detail h3 { font-size: clamp(24px, 3.2vw, 30px); letter-spacing: -.03em; margin-bottom: 6px; }
.proj-tagline { color: var(--ink); font-size: 16.5px; font-weight: 500; margin-bottom: 14px; }
.proj-card p, .proj-summary { font-size: 15px; color: var(--ink-2); max-width: 68ch; }

.proj-sub {
  font-family: var(--display); font-size: 12.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  margin: 26px 0 12px;
}
.proj-features {
  list-style: none; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px 26px; font-size: 14.5px; color: var(--ink-2);
}
@media (max-width: 760px) { .proj-features { grid-template-columns: 1fr; } }
.proj-features li { position: relative; padding-left: 20px; }
.proj-features li::before {
  content: "→"; position: absolute; left: 0; top: 0; color: var(--acc); font-size: 13px;
}

.proj-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.proj-links .btn { padding: 11px 19px; font-size: 14px; }

/* ---------- Logo wall ---------- */
.logo-wall {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--card);
}
@media (max-width: 860px) { .logo-wall { grid-template-columns: repeat(2, 1fr); } }

.logo-cell {
  display: grid; place-items: center; text-align: center;
  min-height: 128px; padding: 26px 22px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: background .2s, transform .2s;
}
.logo-cell:hover { background: var(--card-2); }
/* remove the outer edges of the grid lines */
.logo-wall > .logo-cell:nth-child(4n) { border-right: 0; }
.logo-wall > .logo-cell:nth-last-child(-n + 4) { border-bottom: 0; }
@media (max-width: 860px) {
  .logo-wall > .logo-cell:nth-child(4n) { border-right: 1px solid var(--line); }
  .logo-wall > .logo-cell:nth-child(2n) { border-right: 0; }
  .logo-wall > .logo-cell:nth-last-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .logo-wall > .logo-cell:nth-last-child(-n + 2) { border-bottom: 0; }
}

/* Logos keep their real brand colours in every state. Hover just lifts them
   slightly and brightens the cell. */
.logo-cell img {
  max-height: calc(40px * var(--s, 1));
  max-width: calc(150px * var(--s, 1));
  width: auto; height: auto;
  opacity: 1;
  transition: transform .25s, box-shadow .25s, filter .25s;
}
.logo-cell:hover img,
.logo-cell:focus-visible img {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* Marks drawn for white backgrounds (black, navy, deep red artwork) would be
   unreadable straight on the dark card, so they sit on a light plate. Set
   "chip": true in companies.json. The plate is a spread box-shadow rather than
   padding, so it costs no layout space and nothing shifts on hover. */
.logo-cell.has-chip img {
  background: #F4F4F6;
  border-radius: 4px;
  box-shadow: 0 0 0 11px #F4F4F6;
}
.logo-cell.has-chip:hover img,
.logo-cell.has-chip:focus-visible img {
  box-shadow:
    0 0 0 11px #FFF,
    0 10px 26px -10px rgba(0, 0, 0, .8);
  background: #FFF;
}

@media (prefers-reduced-motion: reduce) {
  .logo-cell img { transition: opacity .2s; }
  .logo-cell:hover img { transform: none; }
}

.logo-cell .wordmark {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(15px, 2vw, 19px); letter-spacing: -.01em;
  color: rgba(245, 245, 247, .58); transition: color .22s; line-height: 1.25;
}
.logo-cell:hover .wordmark { color: var(--ink); }

/* ---------- Post cards ---------- */
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 940px) { .g3 { grid-template-columns: 1fr; } }
.post-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; transition: .2s;
  display: flex; flex-direction: column; gap: 8px;
}
.post-card:hover { border-color: var(--acc-2); transform: translateY(-3px); }
.post-card .d { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.post-card h3 { font-size: 19px; }
.post-card p { font-size: 14.5px; color: var(--ink-2); }

/* ---------- Post list (writing index) ---------- */
.post-list { display: grid; gap: 2px; }
.post-item {
  display: grid; grid-template-columns: 130px 1fr; gap: 24px;
  padding: 26px 0; border-bottom: 1px solid var(--line); transition: .18s;
}
.post-item:hover { padding-left: 12px; }
.post-item .d { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-top: 5px; }
.post-item h3 { font-size: 22px; margin-bottom: 8px; }
.post-item p { font-size: 15px; color: var(--ink-2); max-width: 66ch; }
@media (max-width: 640px) { .post-item { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- Article ---------- */
.article { max-width: 720px; margin: 0 auto; padding: 70px 0 40px; }
.article-head { margin-bottom: 44px; }
.article-head .d { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); margin-bottom: 14px; }
.article-head h1 {
  font-family: var(--display); font-size: clamp(32px, 5.4vw, 52px);
  line-height: 1.06; letter-spacing: -.035em; font-weight: 700; margin-bottom: 16px;
}
.article-head .standfirst { font-size: 18.5px; color: var(--ink-2); }

.prose { font-size: 17px; line-height: 1.75; color: #DCDCE4; }
.prose > * + * { margin-top: 1.35em; }
.prose h2 { font-size: 27px; margin-top: 2em; margin-bottom: .55em; letter-spacing: -.025em; }
.prose h3 { font-size: 21px; margin-top: 1.7em; margin-bottom: .45em; }
.prose a { color: var(--acc); border-bottom: 1px solid rgba(255, 92, 53, .38); }
.prose a:hover { border-color: var(--acc); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .45em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose blockquote {
  border-left: 3px solid var(--acc); padding: 4px 0 4px 22px;
  color: var(--ink-2); font-size: 19px; font-style: italic;
}
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em;
  background: var(--card-2); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 5px; color: var(--acc-2);
}
.prose pre {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; overflow-x: auto; font-size: 14px; line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose img { border-radius: 12px; border: 1px solid var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.prose th { background: var(--card); font-weight: 600; }

.article-foot {
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: center;
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 300px; gap: 56px; align-items: start; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 36px; } }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: sticky; top: 92px; }
.side-card h3 { font-size: 15px; margin-bottom: 14px; }
.side-card dl { display: grid; gap: 12px; font-size: 14px; }
.side-card dt { color: var(--ink-3); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.side-card dd { color: var(--ink); }
.side-card dd a:hover { color: var(--acc); }

.skill-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .skill-grid { grid-template-columns: 1fr; } }
.skill-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.skill-card h3 { font-size: 15px; color: var(--acc); margin-bottom: 12px; letter-spacing: .04em; text-transform: uppercase; font-size: 12.5px; }
.skill-card ul { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.skill-card li { font-size: 12.5px; padding: 5px 11px; border-radius: 7px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- CTA box ---------- */
.cta-box {
  background: linear-gradient(135deg, rgba(255, 92, 53, .14), rgba(91, 140, 255, .10));
  border: 1px solid var(--line); border-radius: 24px;
  padding: 56px 40px; text-align: center;
}
.cta-box .sub { margin: 0 auto 30px; }
.cta-box .cta { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 40px 0;
  color: var(--ink-3); font-size: 13.5px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; align-items: center;
}
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--acc); }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
