/* ==========================================================
   maram hamdey portfolio — shared styles
   palette: cherry blossom (pale muse, floss, cloudy blue,
   shabby chic, book binder, dark brown, wandering river)
   ========================================================== */

:root {
  --pale-muse: #e3dee6;
  --floss: #d7b4b9;
  --cloudy-blue: #abc1db;
  --shabby-chic: #bb8b8d;
  --book-binder: #825b59;
  --ink: #332a21;
  --river: #71a1c6;

  --paper: #f8f5f9;      /* lighter than pale muse, for cards */
  --line: rgba(130, 91, 89, 0.18);
  --muted: #6b5a55;      /* softened ink for secondary text */

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(51, 42, 33, 0.08);
  --shadow-lg: 0 18px 50px rgba(51, 42, 33, 0.14);

  --font-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Playfair Display", Georgia, serif;
  --wrap: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--pale-muse);
  background-image:
    radial-gradient(900px 500px at 8% -5%, rgba(215, 180, 185, 0.55), transparent 60%),
    radial-gradient(800px 520px at 100% 8%, rgba(171, 193, 219, 0.55), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--book-binder); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--river); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.section { padding: clamp(56px, 9vw, 104px) 0; }
.section.alt { background: rgba(248, 245, 249, 0.6); }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.7rem); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }

.eyebrow {
  display: inline-block;
  font-size: .76rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--book-binder);
  margin-bottom: 14px;
}
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head p { color: var(--muted); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(227, 222, 230, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: var(--ink); }
.brand span { color: var(--book-binder); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 6px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 14px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; color: var(--ink);
}
.nav-links a:hover, .nav-links a.active { background: var(--floss); text-decoration: none; }
.nav-links a.cta { background: var(--book-binder); color: #fff; }
.nav-links a.cta:hover { background: var(--ink); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: 10px;
  width: 42px; height: 42px; cursor: pointer; color: var(--ink); font-size: 1.2rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; border: 2px solid transparent;
  font: 600 .95rem var(--font-body); cursor: pointer; text-decoration: none !important;
  transition: transform .2s, background .2s, color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { background: var(--book-binder); color: #fff; }
.btn-primary:hover { background: var(--ink); }
.btn-ghost { background: transparent; color: var(--book-binder); border-color: var(--book-binder); }
.btn-ghost:hover { background: var(--book-binder); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 96px); }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero h1 em { font-style: italic; color: var(--book-binder); }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

.portrait { position: relative; justify-self: center; width: min(360px, 82%); }
.portrait::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px;
  border-radius: 999px 999px 28px 28px;
  background: linear-gradient(160deg, var(--floss), var(--cloudy-blue));
  z-index: 0;
}
.portrait img {
  position: relative; z-index: 1;
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 28%;
  border-radius: 999px 999px 28px 28px;
  border: 6px solid var(--paper);
  box-shadow: var(--shadow-lg);
  background: var(--floss);
}
.portrait .badge {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: -100px;
    transform: translateX(-50%);

    background: var(--paper);
    border-radius: 14px;
    padding: 10px 16px;
    box-shadow: var(--shadow);
    font-size: .82rem;
    font-weight: 600;
}

.portrait .badge b {
    display: block;
    font-family: var(--font-head);
    font-size: 1.15rem;
    color: var(--book-binder);
}

/* falling petals (created by main.js) */
.petal {
  position: absolute; top: -30px; pointer-events: none; z-index: 0;
  width: 14px; height: 14px; opacity: .75;
  background: var(--floss);
  border-radius: 80% 0 80% 0;
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translate3d(var(--drift, 60px), 110vh, 0) rotate(540deg); opacity: 0; }
}

/* ---------- chips ---------- */
.chip {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 600;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
}
.chip.tool { background: var(--cloudy-blue); border-color: transparent; }
.chip.rose { background: var(--floss); border-color: transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- cards ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 22px; }
.grid > *, .steps > *, .step > div { min-width: 0; }   /* lets wide tables scroll inside their card instead of stretching the page */
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.icon-dot {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--floss); font-size: 1.3rem; margin-bottom: 14px;
}
.card p:last-child { margin-bottom: 0; }
.card ul { margin: 0; padding-left: 1.1em; }
.card li { margin-bottom: 6px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 2rem; color: var(--book-binder); line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---------- skills ---------- */
.skill-card h3 { display: flex; align-items: center; gap: 10px; }
.skill-card .chip-row { margin-top: 12px; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 30px; display: grid; gap: 22px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--shabby-chic); opacity: .5; }
.tl-item { position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: -29px; top: 28px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--book-binder); border: 3px solid var(--pale-muse);
}
.tl-role { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: baseline; }
.tl-role h3 { margin: 0; }
.tl-org { color: var(--book-binder); font-weight: 700; margin-bottom: 10px; }

/* ---------- project cards (landing) ---------- */
.project-card {
  display: flex; flex-direction: column; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s;
}
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); text-decoration: none; }
.project-thumb {
  height: 150px; display: flex; align-items: flex-end; padding: 16px 20px;
  color: #fff; font-family: var(--font-head); font-size: 1.15rem; font-weight: 600;
  position: relative; overflow: hidden;
}
.project-thumb::after {
  content: attr(data-glyph); position: absolute; right: 14px; top: 2px;
  font-size: 5.2rem; opacity: .22; line-height: 1;
}
.thumb-nova { background: linear-gradient(135deg, var(--book-binder), var(--shabby-chic)); }
.thumb-deco { background: linear-gradient(135deg, var(--river), var(--cloudy-blue)); color: var(--ink); }
.thumb-cafe { background: linear-gradient(135deg, var(--shabby-chic), var(--floss)); color: var(--ink); }
.thumb-car  { background: linear-gradient(135deg, var(--ink), var(--book-binder)); }
.project-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-body p { margin: 0; color: var(--muted); font-size: .95rem; }
.project-body .go { margin-top: auto; font-weight: 700; color: var(--book-binder); }
.project-card:hover .go span { display: inline-block; transform: translateX(5px); }
.go span { transition: transform .2s; }

/* project filter */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter-btn { border: 1px solid var(--line); cursor: pointer; font: 600 .88rem var(--font-body); padding: 9px 20px; border-radius: 999px; background: var(--paper); color: var(--ink); }
.filter-btn:hover { background: var(--floss); }
.filter-btn[aria-pressed="true"] { background: var(--book-binder); color: #fff; border-color: var(--book-binder); }
.project-card[hidden] { display: none; }
.thumb-py   { background: linear-gradient(135deg, var(--river), var(--book-binder)); }
.thumb-api  { background: linear-gradient(135deg, var(--cloudy-blue), var(--shabby-chic)); color: var(--ink); }
.thumb-sql  { background: linear-gradient(135deg, var(--ink), var(--river)); }
.thumb-db   { background: linear-gradient(135deg, var(--shabby-chic), var(--book-binder)); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.contact-item { display: flex; gap: 14px; align-items: center; color: var(--ink); }
.contact-item:hover { text-decoration: none; transform: translateY(-3px); }
.contact-item { transition: transform .2s; }
.contact-item .icon-dot { margin: 0; flex: none; }
.contact-item small { display: block; color: var(--muted); font-weight: 600; }
.contact-item strong { word-break: break-word; }

.footer { padding: 34px 0; text-align: center; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ==========================================================
   project (case study) pages
   ========================================================== */
.back { display: flex; width: fit-content; gap: 8px; font-weight: 700; margin-bottom: 22px; }
.case-hero { padding: clamp(36px, 6vw, 72px) 0 36px; }
.case-hero .lead { margin-bottom: 20px; }
.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.meta div { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.meta small { display: block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--book-binder); font-weight: 700; }
.meta span { font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 26px 0; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--shabby-chic); border-radius: var(--radius-sm); padding: 16px 18px; }
.kpi b { display: block; font-family: var(--font-head); font-size: 1.7rem; line-height: 1.1; }
.kpi span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi.bad { border-left-color: var(--book-binder); }
.kpi.good { border-left-color: var(--river); }

.case-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 8px; }
.case-nav a { padding: 7px 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: .84rem; font-weight: 600; color: var(--ink); }
.case-nav a:hover { background: var(--floss); text-decoration: none; }

/* numbered walkthrough steps */
.steps { display: grid; gap: 16px; counter-reset: step; }
.step { display: grid; grid-template-columns: 52px 1fr; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--book-binder); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem;
}
.step h3 { margin: 2px 0 6px; }
.step p { margin: 0; color: var(--muted); }
.step .why { margin-top: 8px; font-size: .92rem; color: var(--ink); }
.step .why b { color: var(--book-binder); }

/* dashboard viewer */
.dash-viewer { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.dash-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--floss); }
.dash-bar .dots { display: flex; gap: 6px; }
.dash-bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--book-binder); opacity: .55; }
.dash-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-tabs button, .tab-btn {
  border: 0; cursor: pointer; font: 600 .84rem var(--font-body);
  padding: 8px 16px; border-radius: 999px; background: rgba(248, 245, 249, 0.7); color: var(--ink);
}
.dash-tabs button[aria-selected="true"], .tab-btn[aria-selected="true"] { background: var(--book-binder); color: #fff; }
.dash-full { border: 0; cursor: pointer; font: 600 .84rem var(--font-body); padding: 8px 14px; border-radius: 999px; background: var(--ink); color: #fff; }
.dash-stage { position: relative; aspect-ratio: 16 / 9; background: var(--pale-muse); }
.dash-stage:fullscreen { aspect-ratio: auto; background: #000; }
.dash-stage iframe, .dash-stage img { width: 100%; height: 100%; border: 0; object-fit: contain; display: block; }
.dash-stage img { cursor: zoom-in; }
.dash-stage.is-image { aspect-ratio: auto; }
.dash-stage.is-image img { height: auto; object-fit: initial; }
.dash-stage.is-image:fullscreen img { height: 100%; object-fit: contain; }
.dash-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.dash-empty b { display: block; font-family: var(--font-head); font-size: 1.3rem; color: var(--book-binder); margin-bottom: 6px; }
.dash-hint { font-size: .84rem; color: var(--muted); margin: 10px 4px 0; }

/* insight / proposal cards */
.insight { display: grid; grid-template-columns: 46px 1fr; gap: 14px; }
.insight .num { width: 38px; height: 38px; border-radius: 12px; background: var(--cloudy-blue); display: grid; place-items: center; font-weight: 800; color: var(--ink); }
.insight h3 { margin-bottom: 4px; }
.insight p { color: var(--muted); margin: 0 0 8px; }
.insight .so { color: var(--ink); font-weight: 600; }
.effort { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.effort.low { background: var(--cloudy-blue); }
.effort.high { background: var(--floss); }

/* files panel */
.files { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.file {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--paper); border: 1px dashed var(--shabby-chic); border-radius: var(--radius-sm); color: var(--ink);
  transition: background .2s, transform .2s;
}
.file:hover { background: var(--floss); text-decoration: none; transform: translateY(-2px); }
.file .ext { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--book-binder); color: #fff; display: grid; place-items: center; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.file b { display: block; font-size: .93rem; line-height: 1.3; }
.file small { color: var(--muted); font-weight: 500; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--floss); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { display: inline-block; height: 8px; border-radius: 99px; background: var(--shabby-chic); vertical-align: middle; margin-left: 8px; }

/* before / after switch */
.compare-switch { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.compare-switch button { border: 0; cursor: pointer; font: 700 .86rem var(--font-body); padding: 9px 20px; border-radius: 999px; background: transparent; color: var(--ink); }
.compare-switch button[aria-pressed="true"] { background: var(--book-binder); color: #fff; }
.bad-cell { background: rgba(187, 139, 141, 0.35); font-weight: 700; }
.fixed-cell { background: rgba(171, 193, 219, 0.55); font-weight: 700; }

/* quality meters */
.meter { margin-bottom: 16px; }
.meter-top { display: flex; justify-content: space-between; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.meter-track { height: 12px; background: var(--pale-muse); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--shabby-chic), var(--river)); border-radius: 99px; transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }

/* code block */
.code { position: relative; background: var(--ink); color: #f1e9ee; border-radius: var(--radius); overflow: hidden; }
.code-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(255, 255, 255, 0.07); font-size: .8rem; font-weight: 600; }
.code-top button { background: var(--floss); color: var(--ink); border: 0; border-radius: 999px; padding: 6px 14px; font: 700 .76rem var(--font-body); cursor: pointer; }
.code pre { margin: 0; padding: 18px 20px; overflow: auto; max-height: 460px; font: .84rem/1.65 ui-monospace, "SF Mono", Menlo, Consolas, monospace; tab-size: 2; }
.code .k { color: var(--cloudy-blue); font-weight: 700; }
.code .c { color: #a89aa0; font-style: italic; }
.code .s { color: var(--floss); }
.code .n { color: #e9c9a8; }

/* sql query browser */
.query-list { display: grid; gap: 8px; }
.query-list details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.query-list summary { cursor: pointer; padding: 13px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.query-list summary::-webkit-details-marker { display: none; }
.query-list summary::after { content: "+"; color: var(--book-binder); font-size: 1.2rem; line-height: 1; }
.query-list details[open] summary::after { content: "–"; }
.query-list details > div { padding: 0 18px 16px; }
.query-list details p { color: var(--muted); font-size: .92rem; margin: 0 0 10px; }
.query-list .code pre { max-height: 260px; }

/* er diagram */
.er { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.er-table { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; font-size: .84rem; }
.er-table header { background: var(--book-binder); color: #fff; padding: 9px 12px; font-weight: 700; display: flex; justify-content: space-between; }
.er-table ul { list-style: none; margin: 0; padding: 8px 12px; }
.er-table li { padding: 2px 0; }
.er-table li.key { color: var(--book-binder); font-weight: 700; }

/* figures (charts from my notebooks) */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.fig { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.fig img { width: 100%; height: auto; background: #fff; cursor: zoom-in; }
.fig figcaption { padding: 14px 18px; font-size: .92rem; }
.fig figcaption b { display: block; font-family: var(--font-head); font-size: 1.05rem; margin-bottom: 2px; }
.fig figcaption span { color: var(--muted); }
.callout { background: var(--floss); border-radius: var(--radius); padding: 18px 22px; font-weight: 600; }
.code.tall pre { max-height: 560px; }

/* prev/next project */
.next-prev { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.next-prev a { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; color: var(--ink); }
.next-prev a:hover { background: var(--floss); text-decoration: none; }
.next-prev small { display: block; color: var(--book-binder); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .72rem; }
.next-prev a:last-child { text-align: right; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(51, 42, 33, 0.92); display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; width: min(280px, 70%); }
  .grid-3, .grid-4, .contact-grid, .er { grid-template-columns: 1fr 1fr; }
  .stats, .meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: 66px; flex-direction: column; align-items: stretch;
    background: var(--pale-muse); padding: 12px 16px 18px; border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .contact-grid, .er, .next-prev { grid-template-columns: 1fr; }
  .step { grid-template-columns: 1fr; }
  .dash-stage { aspect-ratio: 4 / 3; }
  .next-prev a:last-child { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .petal { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; }
}
@media (max-width: 900px) {
  .portrait { width: min(280px, 70%); }

  .portrait .badge {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: fit-content;
    max-width: 100%;
    margin: -22px auto 0;   /* يطلع شوية فوق الصورة */
    text-align: center;
  }

  .portrait::before { inset: 18px -12px 28px 12px; }  /* الخلفية تفضل ورا الصورة بس */
}