/*
  A candidate's page: his programme first, then his name, work and words. Warm paper, black ink, the green of the flag darkened so it
  reads as text, and the flag's red kept for a few marks only (the live dot, the timeline, a highlight). Hairlines instead of boxes,
  a serif for names and titles, a sans for everything you scan. Light and dark, Latin and Arabic, no outside files.
*/

:root {
  --paper: #f6f4ee;
  --ink: #14191a;
  --muted: #566059;
  --line: rgba(20, 25, 26, 0.14);
  --accent: #0a5a35;
  --accent-ink: #ffffff;
  --red: #c8102e;
  --red-soft: rgba(200, 16, 46, 0.1);
  --serif: ui-serif, 'New York', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --ar: 'SF Arabic', 'Geeza Pro', 'Segoe UI', 'Noto Naskh Arabic', 'Noto Sans Arabic', Tahoma, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
  --pad: clamp(20px, 5vw, 48px);
  --col: 200px;
  --wash: #eaeee3;
  --glow: rgba(10, 90, 53, 0.13);
  --shadow: 0 1px 2px rgba(20, 25, 26, 0.06), 0 22px 40px -20px rgba(20, 25, 26, 0.32);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1311;
    --ink: #eef0ec;
    --muted: #a3aba5;
    --line: rgba(255, 255, 255, 0.15);
    --accent: #6fcf9a;
    --accent-ink: #0b1d12;
    --red: #ff7a85;
    --red-soft: rgba(255, 122, 133, 0.12);
    --wash: #131b16;
    --glow: rgba(111, 207, 154, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 44px -20px rgba(0, 0, 0, 0.75);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 112px; }
@media (min-width: 760px) { html { scroll-padding-top: 76px; } }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; background: var(--paper) radial-gradient(64rem 38rem at 82% -8%, var(--glow), transparent 72%) no-repeat; color: var(--ink); font: 400 1.0625rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html[dir='rtl'] body { font-family: var(--ar); line-height: 1.8; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---- the bar: the one floating thing, so it is the one translucent thing ---- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; min-height: 56px;
  padding-inline: max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad)));
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
html[dir='rtl'] .brand { font-family: var(--ar); font-weight: 700; letter-spacing: 0; }
.bar { flex-wrap: wrap; row-gap: 0; }
/* on a phone the sections become a second row you can swipe; from 760px they sit in the bar */
.links { display: flex; order: 3; width: 100%; gap: 2px; margin-inline: calc(-1 * 12px); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.links::-webkit-scrollbar { display: none; }
.links a { white-space: nowrap; }
.links a.key { color: var(--accent); font-weight: 600; }
@media (max-width: 759px) { .bar { gap: 10px; } .lang a { padding: 0 6px; font-size: 0.8125rem; } .brand { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; } }
.links a, .lang a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 0.875rem; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.links a:hover, .lang a:hover { color: var(--ink); }
.lang { display: flex; margin-inline-start: auto; }
.lang a[aria-current] { color: var(--ink); font-weight: 600; }
@media (min-width: 760px) { .bar { flex-wrap: nowrap; } .links { order: 0; width: auto; margin-inline: 0 0; margin-inline-start: auto; overflow: visible; border-top: 0; } .links + .lang { margin-inline-start: 8px; } }

main { overflow-x: clip; }

/* ---- hero: the name large on the left, his face on the right ---- */
.hero { max-width: var(--max); margin: 0 auto; padding: clamp(40px, 7vw, 104px) var(--pad) clamp(48px, 7vw, 96px); display: grid; gap: clamp(32px, 5vw, 72px); align-items: end; }
@media (min-width: 860px) { .hero:has(.portrait) { grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); } }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.9rem, 8.2vw, 6.9rem); line-height: 0.98; letter-spacing: -0.035em; text-wrap: balance; animation: rise 0.9s var(--ease) both; }
html[dir='rtl'] .hero h1 { font-family: var(--ar); font-weight: 800; line-height: 1.25; letter-spacing: 0; }
.tagline { margin-top: clamp(16px, 2.5vw, 28px); font-size: clamp(1.2rem, 2.4vw, 1.75rem); line-height: 1.35; color: var(--muted); letter-spacing: -0.01em; max-width: 26ch; animation: rise 0.9s 0.1s var(--ease) both; }
html[dir='rtl'] .tagline { letter-spacing: 0; }
.candidacy { margin-bottom: clamp(14px, 2vw, 22px); font-size: 1.0625rem; font-weight: 600; line-height: 1.4; color: var(--accent); max-width: 30rem; animation: rise 0.9s 0.15s var(--ease) both; }
.now { margin-top: clamp(28px, 4vw, 48px); padding-top: 16px; border-top: 1px solid var(--line); max-width: 34rem; animation: rise 0.9s 0.2s var(--ease) both; }
.small-label { font-size: 0.8125rem; color: var(--muted); margin-bottom: 6px; }
.now li { font-size: 1.0625rem; padding: 2px 0; }
.now .dim { color: var(--muted); }
.now .sep { color: var(--muted); margin-inline: 2px; }
.portrait { max-width: 320px; animation: rise 1s 0.15s var(--ease) both; }
@media (min-width: 860px) { .portrait { max-width: none; } }
.portrait img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 22%; border-radius: 14px; outline: 1px solid var(--line); outline-offset: -1px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- sections: a thin rule, the name of the section in the left column, the matter on the right ---- */
.sec { max-width: var(--max); margin: 0 auto; padding: clamp(40px, 6vw, 88px) var(--pad); border-top: 1px solid var(--line); display: grid; gap: clamp(16px, 3vw, 28px); }
@media (min-width: 860px) { .sec { grid-template-columns: var(--col) minmax(0, 1fr); gap: 48px; } .sec-label { position: sticky; top: 84px; align-self: start; } }
.sec-label { font-size: 0.9375rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.sec-body { min-width: 0; }
.sub { margin: 64px 0 14px; font-size: 0.9375rem; font-weight: 600; color: var(--muted); }

.prose { max-width: 36rem; font-family: var(--serif); font-size: 1.1875rem; line-height: 1.7; }
html[dir='rtl'] .prose, .prose[dir='rtl'] { font-family: var(--ar); line-height: 2; }
.prose p { margin-bottom: 1.2em; }
.prose h3 { margin: 2em 0 0.5em; font-family: var(--sans); font-size: 1.2rem; line-height: 1.3; }
.prose.lead { font-size: clamp(1.3rem, 2.1vw, 1.65rem); line-height: 1.55; max-width: 34em; }
html[dir='rtl'] .prose.lead, .prose.lead[dir='rtl'] { line-height: 1.95; }

/* ---- career and studies: a year column and what happened ---- */
.entry { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 20px; padding: 22px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; padding-top: 0; }
.when { color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; padding-top: 0.2em; }
.what h3 { font-size: 1.1875rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
html[dir='rtl'] .what h3 { letter-spacing: 0; }
.role { margin-top: 2px; }
.desc { margin-top: 8px; color: var(--muted); max-width: 54ch; }
.langs-line { margin-top: 8px; font-size: 1.125rem; }
@media (max-width: 560px) { .entry { grid-template-columns: 1fr; gap: 4px; } }

/* ---- writing: one line each, a date, a title, a few words ---- */
.pieces { min-width: 0; }
.piece { border-top: 1px solid var(--line); }
.piece:first-child { border-top: 0; }
.piece a { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: 20px; padding: 26px 0; text-decoration: none; align-items: start; }
.piece:first-child a { padding-top: 0; }
.piece time { color: var(--muted); font-size: 0.9375rem; padding-top: 0.45em; }
.piece h3 { font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 1.85rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; transition: color 0.2s; }
html[dir='rtl'] .piece h3 { font-family: var(--ar); font-weight: 700; letter-spacing: 0; line-height: 1.5; }
.piece p { margin-top: 8px; color: var(--muted); max-width: 52ch; }
.piece a:hover h3 { color: var(--accent); }
.thumb { width: 150px; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.more { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--accent); font-weight: 600; font-size: 0.9375rem; }
.more i, .back i { width: 7px; height: 7px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.3s var(--ease); }
html[dir='rtl'] .more i { transform: rotate(45deg); }
.piece a:hover .more i { transform: translateX(3px) rotate(-45deg); }
html[dir='rtl'] .piece a:hover .more i { transform: translateX(-3px) rotate(45deg); }
@media (max-width: 700px) { .piece a { grid-template-columns: 1fr; gap: 6px; } .thumb { width: 100%; max-width: 280px; margin-top: 8px; } }

/* ---- pictures ---- */
.gallery { columns: 2 150px; column-gap: 12px; min-width: 0; }
@media (min-width: 760px) { .gallery { columns: 3 220px; column-gap: 14px; } }
.shot { margin-bottom: 12px; break-inside: avoid; }
.shot .open { display: block; width: 100%; padding: 0; border: 0; background: var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.shot img { width: 100%; height: auto; transition: transform 0.8s var(--ease); }
.shot .open:hover img { transform: scale(1.025); }

dialog#viewer { border: 0; padding: 0; background: transparent; color: #fff; max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; }
dialog#viewer::backdrop { background: rgba(0, 0, 0, 0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
dialog#viewer[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; animation: fade 0.3s var(--ease); }
dialog#viewer img { max-width: min(94vw, 1400px); max-height: 80vh; width: auto; border-radius: 8px; }
dialog#viewer .cap { max-width: 60ch; padding: 0 20px; text-align: center; color: rgba(255, 255, 255, 0.85); font-size: 0.9375rem; }
dialog#viewer .cap:empty { display: none; }
dialog#viewer .close { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); inset-inline-end: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
dialog#viewer .close:hover { background: rgba(255, 255, 255, 0.28); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- contact ---- */
.contact-text { font-family: var(--serif); font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.3; max-width: 24ch; letter-spacing: -0.01em; margin-bottom: 20px; }
html[dir='rtl'] .contact-text { font-family: var(--ar); letter-spacing: 0; line-height: 1.7; }
.mail { display: inline-block; min-height: 44px; font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.5rem); color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; word-break: break-all; }
.mail:hover { text-decoration-thickness: 2px; }

/* ---- leave him a message ---- */
.note { margin-top: clamp(32px, 5vw, 56px); padding-top: 28px; border-top: 1px solid var(--line); max-width: 40rem; position: relative; }
.note-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
html[dir='rtl'] .note-title { font-family: var(--ar); letter-spacing: 0; }
.note label { display: block; margin: 16px 0 6px; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.note textarea, .note input[type='text'] {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; font: inherit; color: var(--ink); min-height: 48px;
  background: color-mix(in srgb, var(--ink) 4%, transparent); transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.note textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.note textarea:focus, .note input[type='text']:focus { outline: none; border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.note .two { display: grid; gap: 0 16px; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 640px) { .note .two { grid-template-columns: 1fr 1fr; } }
.send { margin-top: 20px; min-height: 48px; padding: 0 30px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.send:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px var(--accent); }
.send:active { transform: translateY(0); }
.fine { margin-top: 14px; font-size: 0.8125rem; color: var(--muted); }
.hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
h1.notice { font-size: clamp(2.2rem, 6vw, 4rem); }

/* ---- one piece of writing ---- */
.story { max-width: 44rem; margin: 0 auto; padding: clamp(28px, 5vw, 64px) var(--pad) clamp(56px, 9vw, 120px); }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: clamp(12px, 3vw, 28px); color: var(--accent); font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.back i { transform: rotate(135deg); }
html[dir='rtl'] .back i { transform: rotate(-135deg); }
.story header { margin-bottom: clamp(20px, 4vw, 36px); }
.story time { font-size: 0.9375rem; color: var(--muted); }
.story h1 { margin-top: 8px; font-family: var(--serif); font-weight: 600; font-size: clamp(2.1rem, 6vw, 3.6rem); line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance; }
html[dir='rtl'] .story h1 { font-family: var(--ar); font-weight: 800; letter-spacing: 0; line-height: 1.35; }
.story-cover { margin-bottom: clamp(24px, 4vw, 44px); }
.story-cover img { width: 100%; border-radius: 12px; }
.story .prose { max-width: none; }

.foot { max-width: var(--max); margin: 0 auto; padding: 28px var(--pad) max(36px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }

/* ---- reveal on scroll: only when the script ran, so without it everything is simply there ---- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }


/* ---- polish: colour, depth and motion. Everything here is progressive: without it the page is already complete ---- */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* a hairline that fills as the page is read (browsers with scroll-driven animation only) */
.bar::after { content: ''; position: absolute; inset: auto 0 -1px 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
html[dir='rtl'] .bar::after { transform-origin: 100% 50%; }
@supports (animation-timeline: scroll()) {
  .bar::after { animation: grow linear both; animation-timeline: scroll(root); }
}
@keyframes grow { to { transform: scaleX(1); } }

/* the bar's links underline themselves, and the section you are in stays marked */
.links a, .lang a { position: relative; }
.links a::after { content: ''; position: absolute; inset-inline: 12px; bottom: 9px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.35s var(--ease); }
html[dir='rtl'] .links a::after { transform-origin: 100% 50%; }
.links a:hover::after, .links a[aria-current]::after { transform: scaleX(1); }
.links a[aria-current] { color: var(--ink); }

/* the name comes into focus */
.hero h1 { animation: focus 1.1s var(--ease) both; }
@keyframes focus { from { opacity: 0; transform: translateY(18px); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }

/* a live mark on the candidacy, the one thing that is happening right now */
.candidacy { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 14px; border-radius: 999px; font-size: 0.9375rem; background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.candidacy::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: ping 2.8s 1.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }

/* his portrait: unveiled from below, with an outline that settles behind it and a slow drift as you scroll */
.portrait { position: relative; isolation: isolate; --dx: 14px; }
html[dir='rtl'] .portrait { --dx: -14px; }
.portrait::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 16px; border: 1px solid var(--accent); opacity: 0.6; transform: translate(var(--dx), 14px); animation: settle 1.3s 0.5s var(--ease) both; }
.portrait::after { content: ''; position: absolute; inset: 8% -6% -10% -6%; z-index: -2; background: radial-gradient(closest-side, var(--glow), transparent); filter: blur(24px); }
.portrait img { box-shadow: var(--shadow); animation: unveil 1.2s 0.15s var(--ease) both; }
@keyframes unveil { from { clip-path: inset(100% 0 0 0 round 14px); transform: scale(1.08); } to { clip-path: inset(0 round 14px); transform: none; } }
@keyframes settle { from { opacity: 0; transform: translate(0, 0); } to { opacity: 0.6; transform: translate(var(--dx), 14px); } }
@supports (animation-timeline: scroll()) {
  .portrait img { animation: unveil 1.2s 0.15s var(--ease) both, drift linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0 75vh; }
}
@keyframes drift { to { translate: 0 -26px; } }

/* a mark before each section's name */
.sec-label::before { content: ''; display: inline-block; width: 18px; height: 2px; margin-inline-end: 10px; vertical-align: middle; background: var(--accent); }
.js .sec-label::before { width: 0; transition: width 0.8s 0.2s var(--ease); }
.js .sec-label.in::before, .js .reveal.in .sec-label::before { width: 18px; }

/* the career is the heart of the page: one band of green-tinted paper, edge to edge */
#career, .band { background: var(--wash); box-shadow: 0 0 0 100vmax var(--wash); clip-path: inset(0 -100vmax); border-top-color: transparent; }
#career + .sec, .band + .sec { border-top-color: transparent; }
.when { color: var(--accent); font-weight: 600; }
#career .entry { border-top-color: color-mix(in srgb, var(--ink) 14%, transparent); }
.entry { position: relative; }
.entry::before { content: ''; position: absolute; inset-inline-start: -16px; top: 22px; bottom: 22px; width: 2px; background: var(--accent); transform: scaleY(0); transition: transform 0.45s var(--ease); }
.entry:first-child::before { top: 0; }
.entry:hover::before { transform: scaleY(1); }
.what h3 { transition: color 0.25s, transform 0.4s var(--ease); }
.entry:hover .what h3 { color: var(--accent); transform: translateX(3px); }
html[dir='rtl'] .entry:hover .what h3 { transform: translateX(-3px); }

/* rows arrive one after another */
.js .entries.reveal { opacity: 1; transform: none; }
.js .entries.reveal .entry { opacity: 0; transform: translateY(12px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .entries.reveal.in .entry { opacity: 1; transform: none; }
.js .entries.reveal.in .entry:nth-child(2) { transition-delay: 0.07s; }
.js .entries.reveal.in .entry:nth-child(3) { transition-delay: 0.14s; }
.js .entries.reveal.in .entry:nth-child(4) { transition-delay: 0.21s; }
.js .entries.reveal.in .entry:nth-child(5) { transition-delay: 0.28s; }
.js .entries.reveal.in .entry:nth-child(6) { transition-delay: 0.35s; }
.js .entries.reveal.in .entry:nth-child(7) { transition-delay: 0.42s; }
.js .entries.reveal.in .entry:nth-child(8) { transition-delay: 0.49s; }
.js .entries.reveal.in .entry:nth-child(9) { transition-delay: 0.56s; }
.js .entries.reveal.in .entry:nth-child(10) { transition-delay: 0.63s; }
.js .entries.reveal.in .entry:nth-child(11) { transition-delay: 0.70s; }
.js .entries.reveal.in .entry:nth-child(12) { transition-delay: 0.77s; }

/* pictures sit on the page like prints */
.shot .open { border-radius: 12px; box-shadow: var(--shadow); transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease); }
.shot .open:hover { transform: translateY(-5px); }
.shot:only-child { max-width: 440px; }

.mail { transition: text-underline-offset 0.3s var(--ease), color 0.2s; }
.mail:hover { text-underline-offset: 9px; }

/* ================================================================ the campaign: hero, figures, the programme in brief, the first 100 days */
.campaign .slogan { margin-top: clamp(16px, 2.4vw, 26px); font-family: var(--serif); font-size: clamp(1.3rem, 2.8vw, 2.1rem); line-height: 1.3; letter-spacing: -0.015em; max-width: 30ch; text-wrap: balance; animation: rise 0.9s 0.08s var(--ease) both; }
html[dir='rtl'] .campaign .slogan { font-family: var(--ar); font-weight: 700; letter-spacing: 0; line-height: 1.7; }
.campaign .tagline { font-size: clamp(1.05rem, 1.8vw, 1.3rem); max-width: 40ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(24px, 3.4vw, 40px); animation: rise 0.9s 0.2s var(--ease) both; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 22%, transparent); transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.2s; }
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.primary:hover { box-shadow: 0 12px 24px -12px var(--accent); }
.btn i { width: 8px; height: 8px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
html[dir='rtl'] .btn i { transform: rotate(45deg); } /* in RTL the two borders meet at the bottom-left, so 45deg points left */
.lead-in { font-size: clamp(1.1rem, 1.8vw, 1.3rem); line-height: 1.5; max-width: 46ch; margin-bottom: 28px; color: var(--muted); }
.more-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* the figures: one band in the flag's green, the numbers large */
.figures { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 100vmax var(--accent); clip-path: inset(0 -100vmax); border-top: 3px solid var(--red); }
.figures ul { max-width: var(--max); margin: 0 auto; padding: clamp(24px, 4vw, 40px) var(--pad); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
@media (min-width: 760px) { .figures ul { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.figures li { display: flex; flex-direction: column; gap: 4px; }
.figures b { font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.figures span { font-size: 0.9375rem; opacity: 0.88; line-height: 1.35; }
.figures + .sec { border-top-color: transparent; }

/* the shared projects as cards with an icon */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { position: relative; border-radius: 16px; background: color-mix(in srgb, var(--ink) 3%, var(--paper)); box-shadow: inset 0 0 0 1px var(--line); transition: transform 0.35s var(--ease), box-shadow 0.35s; scroll-margin-top: 120px; }
.card > a, .cards.wide .card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 20px; text-decoration: none; }
.card:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }
.card .ico { color: var(--accent); flex: none; }
.card h3 { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; }
.card p { font-size: 0.9375rem; color: var(--muted); line-height: 1.5; }
.cards.wide .card:target { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
@media (max-width: 560px) { .cards:not(.wide) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cards:not(.wide) .card > a { padding: 16px 14px; gap: 8px; } .cards:not(.wide) .card p { display: none; } .cards:not(.wide) .card h3 { font-size: 0.9375rem; } }

/* the first 100 days: a line with a red mark at each step */
.timeline { position: relative; display: grid; gap: 0; max-width: 44rem; }
.timeline li { position: relative; display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 16px; padding: 14px 0; padding-inline-start: 26px; border-inline-start: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.timeline li::before { content: ''; position: absolute; inset-inline-start: -7px; top: 21px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 3px var(--red); }
.timeline li:last-child::before { background: var(--red); }
.timeline .range { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline p { line-height: 1.55; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }
.now-sec .now { margin: 0; padding: 0; border: 0; animation: none; }

/* ================================================================ the programme page */
.phead { max-width: var(--max); margin: 0 auto; padding: clamp(32px, 6vw, 80px) var(--pad) clamp(28px, 4vw, 48px); }
.eyebrow { font-size: 0.875rem; font-weight: 700; color: var(--red); letter-spacing: 0.02em; margin-bottom: 12px; }
.eyebrow a { text-decoration: none; }
.phead h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 5.2vw, 3.6rem); line-height: 1.08; letter-spacing: -0.025em; max-width: 22ch; text-wrap: balance; animation: rise 0.9s var(--ease) both; }
html[dir='rtl'] .phead h1 { font-family: var(--ar); font-weight: 800; letter-spacing: 0; line-height: 1.45; }
.phead .plan { margin-top: 16px; font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.45; color: var(--muted); max-width: 48ch; }
.phead .edition { margin-top: 8px; font-size: 0.9375rem; color: var(--muted); }
.draft { margin-top: 18px; display: inline-flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--red-soft); font-size: 0.9375rem; font-weight: 600; }
.draft a { color: var(--red); }
.dl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 20px; font-size: 0.9375rem; color: var(--muted); }
.dl .btn { min-height: 40px; padding: 0 18px; font-size: 0.9375rem; }
.dl small { font-size: 0.8125rem; }

.pwrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad) clamp(48px, 8vw, 96px); display: grid; gap: 32px; }
@media (min-width: 1000px) { .pwrap { grid-template-columns: 250px minmax(0, 1fr); gap: 56px; } .toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; } }
.toc { padding: 18px 20px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.toc h2 { font-size: 0.875rem; color: var(--muted); margin-bottom: 8px; }
.toc a { display: block; padding: 6px 0; font-size: 0.9375rem; line-height: 1.35; text-decoration: none; color: var(--ink); }
.toc a:hover { color: var(--accent); }
.pbody { min-width: 0; }
.psec { padding: clamp(28px, 4vw, 44px) 0; border-top: 1px solid var(--line); }
.psec:first-child { border-top: 0; padding-top: 0; }
.psec h2 { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 16px; text-wrap: balance; }
html[dir='rtl'] .psec h2 { font-family: var(--ar); font-weight: 800; letter-spacing: 0; line-height: 1.55; }
.psec h3 { font-size: 1.125rem; font-weight: 700; margin: 28px 0 12px; }
.psec p { max-width: 68ch; margin-bottom: 12px; line-height: 1.7; }
html[dir='rtl'] .psec p { line-height: 1.95; }
.aside { font-size: 0.9375rem; color: var(--muted); }

.tscroll { overflow-x: auto; margin: 6px 0 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.ptable th, .ptable td { padding: 12px 14px; text-align: start; vertical-align: top; border-top: 1px solid var(--line); }
.ptable thead th { border-top: 0; background: var(--wash); font-size: 0.875rem; color: var(--muted); }
.ptable tbody th { font-weight: 700; min-width: 9rem; }

/* the justice index: one bar per criterion, the longest = 20 % */
.bars { display: grid; gap: 12px; margin: 18px 0 20px; max-width: 46rem; }
.bars li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 3.2rem; align-items: center; gap: 14px; }
.bars .lbl { font-size: 0.9375rem; line-height: 1.35; }
.bars .track { height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); overflow: hidden; }
.bars .track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: 0 50%; }
html[dir='rtl'] .bars .track i { transform-origin: 100% 50%; }
.bars .w20 { width: 100%; }
.bars .w15 { width: 75%; }
.bars .w10 { width: 50%; }
.bars b { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .bars li { grid-template-columns: minmax(0, 1fr) 3rem; } .bars .lbl { grid-column: 1 / -1; } }
.js .reveal .bars .track i { transform: scaleX(0); transition: transform 1s 0.2s var(--ease); }
.js .reveal.in .bars .track i { transform: scaleX(1); }

/* the allocation rule: one bar split 60 / 20 / 10 / 10 */
.split { display: flex; height: 44px; border-radius: 12px; overflow: hidden; margin: 8px 0 12px; max-width: 46rem; font-weight: 700; font-size: 0.9375rem; }
.split span { display: flex; align-items: center; justify-content: center; color: #fff; }
.s60 { flex: 60; background: var(--accent); }
.s20 { flex: 20; background: color-mix(in srgb, var(--accent) 62%, #ffffff); }
.s10a { flex: 10; background: var(--red); }
.s10b { flex: 10; background: color-mix(in srgb, var(--red) 55%, #ffffff); }
.split .s60, .split .s10a { color: #ffffff; }
.split .s20, .split .s10b { color: #10231a; }
@media (prefers-color-scheme: dark) { .split .s60, .split .s10a { color: #0b1d12; } }
.legend { display: grid; gap: 6px; margin-bottom: 14px; font-size: 0.9375rem; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; flex: none; }

.checks { display: grid; gap: 10px; max-width: 68ch; }
.checks li { position: relative; padding-inline-start: 30px; line-height: 1.6; }
.checks li::before { content: ''; position: absolute; inset-inline-start: 4px; top: 0.5em; width: 12px; height: 7px; border-inline-start: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }
html[dir='rtl'] .checks li::before { transform: rotate(45deg); }
.refs { list-style: decimal; padding-inline-start: 1.4em; display: grid; gap: 10px; font-size: 0.9375rem; }
.refs a { color: var(--accent); word-break: break-all; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.chips a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 0.9375rem; text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.2s, color 0.2s; }
.chips a:hover { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chips small { color: var(--muted); font-size: 0.8125rem; }

.closing { padding: clamp(36px, 6vw, 64px) 0 0; border-top: 1px solid var(--line); }
.closing p { max-width: 68ch; line-height: 1.7; }
.closing blockquote { margin: 24px 0; padding-inline-start: 20px; border-inline-start: 4px solid var(--red); font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2.1rem); line-height: 1.3; text-wrap: balance; }
html[dir='rtl'] .closing blockquote { font-family: var(--ar); font-weight: 800; line-height: 1.7; }

/* ================================================================ find my commune */
.search { margin-top: 24px; max-width: 34rem; }
.search label { display: block; font-size: 0.9375rem; font-weight: 700; margin-bottom: 8px; }
.search input { width: 100%; min-height: 54px; padding: 0 18px; border: 0; border-radius: 14px; font: inherit; font-size: 1.125rem; color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, var(--paper)); box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow 0.2s; }
.search input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search .count { margin-top: 8px; font-size: 0.9375rem; color: var(--muted); min-height: 1.5em; }
.chips-nav .chips { margin-top: 20px; }
.shared-note { margin-top: 18px; padding: 14px 18px; border-radius: 14px; background: var(--wash); max-width: 52rem; font-size: 0.9375rem; line-height: 1.6; }
.shared-note p + p { margin-top: 6px; }

.districts { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad) clamp(48px, 8vw, 96px); }
.district { padding-top: clamp(28px, 4vw, 44px); scroll-margin-top: 110px; }
.district h2 { display: flex; align-items: baseline; gap: 10px; font-size: clamp(1.2rem, 2.4vw, 1.5rem); font-weight: 800; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); }
.district h2 small { font-size: 0.875rem; font-weight: 600; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 1px 9px; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.commune { padding: 18px 20px 20px; border-radius: 16px; background: color-mix(in srgb, var(--ink) 3%, var(--paper)); box-shadow: inset 0 0 0 1px var(--line); scroll-margin-top: 120px; }
.commune:target { box-shadow: inset 0 0 0 2px var(--red), var(--shadow); }
.commune h3 { font-size: 1.25rem; font-weight: 800; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.commune .alt { font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.commune .diag { margin-top: 10px; line-height: 1.55; }
.commune .diag b, .plabel { display: block; font-size: 0.8125rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.plabel { margin-top: 12px; }
.proj { display: grid; gap: 4px; }
.proj li { position: relative; padding-inline-start: 18px; line-height: 1.5; font-size: 0.9375rem; }
.proj li::before { content: ''; position: absolute; inset-inline-start: 2px; top: 0.6em; width: 7px; height: 7px; border-radius: 2px; background: var(--red); }

/* ================================================================ share: the QR code at the bottom of his pages (always on white, so it scans in dark mode too) */
.share-body { display: grid; gap: 24px; align-items: center; }
@media (min-width: 640px) { .share-body { grid-template-columns: 220px minmax(0, 1fr); gap: 36px; } }
.qr { width: 220px; max-width: 100%; padding: 14px; border-radius: 18px; background: #ffffff; box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.qr img { width: 100%; height: auto; image-rendering: pixelated; }
.share-text { font-size: 1.0625rem; line-height: 1.6; max-width: 46ch; }
.qr-url { margin-top: 10px; font-weight: 700; color: var(--accent); word-break: break-all; }
.share .dl { margin-top: 16px; }
.pwrap + .share { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  .js .reveal, .js .entries.reveal .entry { opacity: 1; transform: none; }
  .bar::after, .portrait img, .candidacy::before { animation: none !important; }
  .js .reveal .bars .track i { transform: none; }
  .portrait img { clip-path: none; }
  .js .sec-label::before { width: 18px; }
}
@media (prefers-contrast: more) { :root { --muted: #2f3733; --line: rgba(0, 0, 0, 0.45); } }
