/*
 * Boukhriss — main styles.
 * Every colour, font and size comes from the custom properties printed by the Customizer
 * (see inc/customizer.php → boukhriss_css_vars). Logical properties keep RTL working.
 */

:root {
	--bg: #F5F5F1;
	--card: #FFFFFF;
	--ink: #121214;
	--muted: #5D5E66;
	--line: #E5E4DE;
	--java: #F89820;
	--spring: #6DB33F;
	--angular: #DD0031;
	--pg: #336791;
	--ts: #3178C6;
	--on-java: #121214;
	--on-spring: #121214;
	--on-angular: #fff;
	--on-pg: #fff;
	--on-ts: #fff;
	--on-ink: #fff;
	--font-display: 'Bricolage Grotesque Variable', 'Readex Pro Variable', system-ui, sans-serif;
	--font-body: 'Geist Variable', 'Readex Pro Variable', system-ui, sans-serif;
	--font-code: 'JetBrains Mono Variable', ui-monospace, Menlo, monospace;
	--name-scale: 1;
	--radius: 28px;
	--gap: 16px;
	--row: 186px;
	--max: 1280px;
	--ease: cubic-bezier(.2, .8, .2, 1);
	color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
	-webkit-tap-highlight-color: transparent;
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--pg); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3 { letter-spacing: 0; line-height: 1.25; }
p { margin: 0; }
.icon { width: 1em; height: 1em; flex: none; }
[dir="rtl"] .icon-arrow, [dir="rtl"] .icon-external { transform: scaleX(-1); }

/* No selection (Customizer → Effects). Form fields and the e-mail stay selectable. */
body.no-select { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.no-select :is(input, textarea, select, [contenteditable], .selectable, .comments, .entry .prose) { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
body.no-select img { -webkit-user-drag: none; }

/* WordPress core classes */
.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; }
.screen-reader-text:focus { background: var(--card); clip: auto !important; clip-path: none; color: var(--ink); display: block; font-weight: 600; height: auto; inset-inline-start: 8px; top: 8px; padding: 14px 20px; width: auto; z-index: 100000; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-inline: auto; }
.alignwide, .alignfull { max-width: 100%; }
.wp-caption, .gallery-caption, .wp-caption-text { font-size: 14px; color: var(--muted); }
.wp-caption { max-width: 100%; }
.sticky, .bypostauthor { display: block; }

/* Layout */
.site { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); padding-block-end: 28px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: calc(18px + env(safe-area-inset-top, 0px)) 18px; }
.sticky-header .site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-code); font-weight: 600; font-size: 15px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--ink); color: var(--on-ink); font-size: 13px; flex: none; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 10px; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 10px; }
.menu ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.menu a { display: block; padding: 9px 14px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 14px; }
.menu a:hover, .menu .current-menu-item a { background: var(--card); }
.langs { display: flex; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.langs a { min-width: 36px; height: 32px; display: grid; place-items: center; padding-inline: 6px; border-radius: 999px; font-family: var(--font-code); font-size: 12px; color: var(--muted); text-decoration: none; }
.langs a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--on-ink); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
@media (max-width: 760px) { .site-header .menu { display: none; } .brand-name { display: none; } }
@media (max-width: 420px) { .site-header .pill { display: none; } }

.footer-widgets { margin-top: var(--gap); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 24px; }
.widget-title { font-size: 20px; margin-bottom: 8px; }
.widget ul { margin: 0; padding-inline-start: 18px; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block-start: 24px; font-family: var(--font-code); font-size: 12px; color: var(--muted); }
.site-footer a { text-decoration: none; }

/* Bento grid: blocks span columns/rows set in the Customizer; dense flow fills the gaps. */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(var(--row), auto); grid-auto-flow: dense; gap: var(--gap); }
.c-1 { grid-column: span 1; } .c-2 { grid-column: span 2; } .c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; }
.r-1 { grid-row: span 1; } .r-2 { grid-row: span 2; } .r-3 { grid-row: span 3; } .r-4 { grid-row: span 4; }
@media (max-width: 1080px) {
	.bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.c-3, .c-4 { grid-column: span 2; }
}
/* Phones: a 2-column bento with its own order, width and height per block (Customizer → Home grid). */
@media (max-width: 640px) {
	.bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(132px, auto); gap: 10px; }
	.bento > * { grid-column: 1 / -1; grid-row: auto; }
	.bento.home > .tile { order: var(--mo, 0); }
	.bento.home > .mc-1 { grid-column: span 1; }
	.bento.home > .mr-2 { grid-row: span 2; }
}

.tile {
	--tone: var(--pg);
	--fg: var(--ink);
	--fg-soft: var(--muted);
	position: relative;
	isolation: isolate;
	min-width: 0;
	border-radius: var(--radius);
	background: var(--card);
	color: var(--fg);
	border: 1px solid var(--line);
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	overflow: hidden;
	transition: transform .5s var(--ease), box-shadow .5s, opacity .7s var(--ease);
}
.tile::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--tone) 14%, transparent), transparent 60%); }
.tile:hover::before { opacity: 1; }
.tile.no-spot::before { display: none; }
body:not(.no-lift) .tile:not(.s-transparent):hover { transform: translateY(-3px); box-shadow: 0 30px 60px -30px rgba(18, 18, 20, .28); }
.tile.pending { opacity: 0; transform: translateY(16px) scale(.97); }

.s-java { background: var(--java); --fg: var(--on-java); --fg-soft: var(--on-java); border-color: transparent; --tone: #fff; }
.s-spring { background: var(--spring); --fg: var(--on-spring); --fg-soft: var(--on-spring); border-color: transparent; --tone: #fff; }
.s-angular { background: var(--angular); --fg: var(--on-angular); --fg-soft: var(--on-angular); border-color: transparent; --tone: #fff; }
.s-pg { background: var(--pg); --fg: var(--on-pg); --fg-soft: var(--on-pg); border-color: transparent; --tone: #fff; }
.s-ink { background: var(--ink); --fg: var(--on-ink); --fg-soft: var(--on-ink); border-color: transparent; --tone: #fff; }
.s-transparent { background: transparent; border-style: dashed; border-color: color-mix(in srgb, var(--muted) 35%, transparent); }
.s-transparent::before { display: none; }
:is(.s-java, .s-spring, .s-angular, .s-pg, .s-ink) :is(.label, .hint, .card-summary, p) { opacity: .88; }

.label { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-code); font-size: 12px; letter-spacing: .03em; color: var(--fg-soft); }
.label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none; }
.tile-title { font-size: 28px; }
.big { font-family: var(--display, var(--font-display)); font-weight: 800; font-stretch: 80%; font-size: clamp(56px, 5vw, 76px); line-height: .85; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--fg-soft); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2; text-decoration: none; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); transition: background-color .25s, border-color .25s, transform .45s var(--ease); }
.btn:hover { border-color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.mag.pulling { transition: transform .12s linear; }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--fg); padding-block: 10px; }
.more:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Hero */
.t-hero { justify-content: space-between; padding: 30px; --tone: var(--java); }
.role { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding-block: 6px; padding-inline: 6px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; }
.role img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.name { font-weight: 800; font-stretch: 80%; font-size: calc(clamp(48px, 5.4vw, 86px) * var(--name-scale)); line-height: .88; letter-spacing: -.045em; }
.name > span { display: block; }
.name .caret { display: inline-block; width: .09em; height: .78em; margin-inline-start: .06em; background: var(--java); vertical-align: -.04em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
[lang="ar"] .name { letter-spacing: 0; line-height: 1.12; font-weight: 700; }
.lead { max-width: 42ch; font-size: clamp(16px, 1.35vw, 18.5px); color: var(--fg-soft); }
.cta, .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 3D code block */
.t-code { padding: 0; --tone: var(--spring); }
.code-head, .code-foot { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.code-foot { margin-top: auto; font-family: var(--font-code); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.run { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-family: var(--font-code); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.run .icon { width: 11px; height: 11px; }
.build { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--spring) 18%, var(--card)); color: color-mix(in srgb, var(--spring) 60%, #000); font-weight: 600; opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
.build.on { opacity: 1; transform: none; }
.stage { position: relative; flex: 1; min-height: 0; }
.has-gl .stage { cursor: grab; }
.has-gl .stage:active { cursor: grabbing; }
.code-fallback { position: absolute; inset: 2% 6%; margin: 0; padding: 22px 24px; border-radius: 18px; background: var(--card); box-shadow: 0 30px 60px -28px rgba(18, 18, 20, .35); font-family: var(--font-code); font-size: 13px; line-height: 1.75; color: #3A3B42; overflow: hidden; white-space: pre; text-align: left; }
.has-gl .code-fallback { visibility: hidden; }
#boukhriss-gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.intro #boukhriss-gl { z-index: 40; }

/* Photo, stat, location */
.t-photo { padding: 0; }
.t-photo .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.t-photo:hover .cover { transform: scale(1.04); }
.t-photo .tag { position: absolute; inset-inline-start: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #121214; font-size: 13px; font-weight: 600; }
.t-stat, .t-location { justify-content: space-between; }
.t-stat .big + p, .t-location .big + p { margin-top: 8px; }

/* Project cards */
.card { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.card-wide { flex-direction: row; gap: 22px; }
.card-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1 1 44%; }
.card-title { font-size: 32px; }
.card-wide .card-title { font-size: clamp(36px, 3.6vw, 52px); }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.card-kicker { font-weight: 600; font-size: 14px; }
.card-summary { color: var(--fg-soft); font-size: 14.5px; }
.card .actions { margin-top: auto; padding-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li { padding: 5px 10px; border-radius: 999px; background: var(--bg); color: var(--ink); font-family: var(--font-code); font-size: 11.5px; direction: ltr; }

.browser { display: flex; flex-direction: column; min-width: 0; min-height: 150px; flex: 1 1 56%; border-radius: 18px; border: 1px solid var(--line); background: #FBFBF9; overflow: hidden; text-decoration: none; color: var(--ink); transition: transform .6s var(--ease); }
.card-compact .browser { flex: 1 1 auto; }
.card-wide:hover .browser { transform: perspective(900px) rotateY(-4deg) rotateX(2deg); }
[dir="rtl"] .card-wide:hover .browser { transform: perspective(900px) rotateY(4deg) rotateX(2deg); }
.bar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--card); font-family: var(--font-code); font-size: 11px; direction: ltr; }
.dots { display: flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; }
.dots i:nth-child(1) { background: var(--angular); }
.dots i:nth-child(2) { background: var(--java); }
.dots i:nth-child(3) { background: var(--spring); }
.url { flex: 1; min-width: 0; padding: 4px 10px; border-radius: 6px; background: var(--bg); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live { color: color-mix(in srgb, var(--spring) 60%, #000); white-space: nowrap; font-weight: 600; }
.screen { position: relative; flex: 1; display: block; min-height: 120px; background: #fff; overflow: hidden; }
.screen .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mini { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px; background: color-mix(in srgb, var(--tone) 6%, #fff); }
.mini i { border-radius: 8px; background: color-mix(in srgb, var(--tone) 16%, #fff); }
.mini i:nth-child(1) { grid-column: span 3; background: color-mix(in srgb, var(--tone) 70%, #fff); }
.mini i:nth-child(4) { grid-column: span 2; }
@media (max-width: 1080px) { .card-wide { flex-direction: column; } .card-wide .browser { min-height: 220px; } }

/* Stack */
.t-stack { --tone: var(--spring); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-family: var(--font-code); font-size: 12.5px; direction: ltr; transition: background-color .25s, color .25s, border-color .25s, transform .25s; }
.chips li i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #B9B8B1); }
.chips li[data-tag] { cursor: pointer; }
.chips li:hover, .chips li.on, .chips li:focus-visible { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: #fff; transform: translateY(-2px); }
.chips li:hover i, .chips li.on i, .chips li:focus-visible i { background: #fff; }

/* Experience */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 14px; padding-block: 11px; border-top: 1px solid var(--line); transition: padding .35s var(--ease); }
.timeline li:hover { padding-inline-start: 8px; }
.timeline .when { font-family: var(--font-code); font-size: 12px; color: var(--fg-soft); padding-top: 2px; }
.timeline h3 { font-family: var(--font-body); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.timeline h3 span { font-weight: 500; color: var(--fg-soft); }
.timeline p { font-size: 13.5px; color: var(--fg-soft); margin-top: 2px; }
.timeline .is-current .when::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: var(--spring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--spring) 25%, transparent); }
.spoken { margin-top: auto; font-size: 13px; color: var(--fg-soft); }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* All projects */
.t-projects { padding: 0; }
.all-projects { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 24px; color: var(--fg); text-decoration: none; }
.all-label { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.all-projects:hover .icon { transform: translateX(4px); }
[dir="rtl"] .all-projects:hover .icon { transform: translateX(-4px) scaleX(-1); }
.all-label .icon { transition: transform .3s var(--ease); }

/* Contact */
.t-contact { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; }
.contact-title { font-size: clamp(32px, 3.4vw, 48px); max-width: 14ch; }
.contact-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.mail { display: flex; align-items: center; gap: 6px; padding-block: 6px; padding-inline: 18px 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); direction: ltr; max-width: 100%; }
.mail a { font-family: var(--font-code); font-size: 15px; text-decoration: none; overflow-wrap: anywhere; }
.mail button { border: 0; padding: 10px 16px; border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.social { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.social a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); text-decoration: none; font-size: 13px; }
.social a:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

/* Projects page */
.archive-head { gap: 12px; padding: 30px; }
.archive-head h1 { font-size: clamp(48px, 6vw, 88px); font-weight: 800; font-stretch: 80%; }
.archive-head .count { position: absolute; inset-inline-end: 30px; top: 22px; font-family: var(--font-display); font-weight: 800; font-size: clamp(64px, 8vw, 120px); line-height: 1; color: var(--angular); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-family: var(--font-code); font-size: 12px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-inline-end: 6px; opacity: .5; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* Project page */
.single .crumbs-row { grid-row: auto; padding-inline: 4px; align-self: end; }
.bento.single { grid-auto-rows: auto; }
.d-head h1 { font-size: clamp(44px, 5vw, 76px); font-weight: 800; font-stretch: 80%; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.meta dt { font-family: var(--font-code); font-size: 11.5px; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 600; }
.d-preview { padding: 0; min-height: 460px; }
.d-preview .browser { height: 100%; flex: 1; border-radius: var(--radius); }
.d-body h2, .d-gallery h2 { font-size: 26px; }
.bento.single > .d-gallery { align-self: start; }
.prose { font-size: 16px; line-height: 1.7; color: var(--ink); }
.prose > * + * { margin-top: 12px; }
.prose ul { padding-inline-start: 20px; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--tone); }
.gallery-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery-grid button { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); cursor: zoom-in; aspect-ratio: 16 / 10; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s var(--ease); }
.gallery-grid button:hover img { transform: scale(1.05); }
.d-next { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; min-height: 0; }
.d-next a { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 4vw, 48px); text-decoration: none; color: var(--fg); }
.d-next a:hover .icon { transform: translateX(6px); }
.d-next .icon { transition: transform .3s var(--ease); }

/* Generic pages */
.generic .tile { gap: 18px; padding: clamp(24px, 4vw, 48px); }
.entry + .entry { border-top: 1px solid var(--line); padding-top: 24px; }
.entry-title { font-size: clamp(32px, 4vw, 52px); }
.entry-title a { text-decoration: none; }
.entry-meta, .entry-tags { color: var(--muted); font-size: 14px; }
.entry-thumb { border-radius: 16px; margin-block: 12px; }
.not-found .big { font-size: clamp(80px, 12vw, 160px); color: var(--angular); }
.comments { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.comment-list { padding-inline-start: 20px; }
.comment-form input:not([type="checkbox"]):not([type="submit"]), .comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.comment-form .submit { padding: 12px 18px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font: inherit; font-weight: 600; cursor: pointer; }
.nav-links { display: flex; gap: 10px; margin-top: 18px; }
.page-numbers { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; }
.page-numbers.current { background: var(--ink); color: var(--on-ink); }

/* Preview dialog */
.preview { width: min(1100px, calc(100vw - 32px)); height: min(760px, calc(100svh - 48px)); max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: 0 60px 140px rgba(18, 18, 20, .35); overflow: hidden; }
.preview[open] { display: flex; flex-direction: column; }
.preview::backdrop { background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(8px); }
.preview .bar { padding: 10px 14px; }
.preview-open, .preview-close { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 16px; }
.preview-body { position: relative; flex: 1; min-height: 0; background: #fff; }
.preview-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-body .slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
.preview-nav { position: absolute; inset-inline: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.preview-nav button { pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.preview-nav span { pointer-events: auto; padding: 6px 12px; border-radius: 999px; background: var(--card); font-family: var(--font-code); font-size: 12px; }

/* Latin name next to the Arabic one */
.name .name-latin { display: block; margin-top: .35em; font-family: var(--font-display); font-size: .3em; font-weight: 600; font-stretch: 85%; letter-spacing: -.01em; line-height: 1; color: var(--fg-soft); }
.brand-latin { margin-inline-start: 6px; color: var(--muted); font-weight: 500; }

/* Live sites rendered at desktop width, scaled to their frame (see main.js) */
.frame-scale { position: absolute; inset: 0; overflow: hidden; direction: ltr; background: #fff; }
.frame-scale iframe { position: absolute; top: 0; left: 0; width: 1440px; max-width: none; height: 100%; border: 0; transform-origin: 0 0; }

/* ---------- Phone design ---------- */
@media (max-width: 640px) {
	.site { padding-inline: max(12px, env(safe-area-inset-left, 0px)); }
	.site-header { padding-block: calc(12px + env(safe-area-inset-top, 0px)) 12px; gap: 8px; }
	.brand-mark, .brand-logo { width: 34px; height: 34px; border-radius: 10px; }
	.langs a { min-width: 30px; height: 30px; font-size: 11px; }
	.pill { padding: 9px 14px; font-size: 13px; }

	.tile { padding: 18px; gap: 12px; border-radius: min(var(--radius), 22px); }
	body:not(.no-lift) .tile:not(.s-transparent):hover { transform: none; box-shadow: none; }
	.label { font-size: 11px; }
	.big { font-size: 46px; }

	/* Introduction */
	.t-hero { padding: 22px; gap: 18px; }
	.role { font-size: 12.5px; }
	.role img { width: 26px; height: 26px; }
	.name { font-size: calc(clamp(46px, 14vw, 64px) * var(--name-scale)); }
	.lead { font-size: 15.5px; }
	.t-hero .cta { display: grid; grid-template-columns: 1fr 1fr; }
	.t-hero .cta .btn { justify-content: center; padding-inline: 12px; }

	/* Photo next to the two small figures */
	.t-photo { min-height: 274px; }
	.t-photo .tag { inset-inline-start: 10px; bottom: 10px; padding: 6px 10px; font-size: 11.5px; }
	.t-stat, .t-location { padding: 16px; }
	.t-stat .big + p, .t-location .big + p { font-size: 12.5px; line-height: 1.3; }

	/* Project cards: screenshot first, then the text */
	.card, .card-wide { flex-direction: column; gap: 14px; }
	.card .browser { order: -1; flex: none; height: 188px; min-height: 0; border-radius: 14px; }
	.card-wide .browser { height: 210px; }
	.card-wide:hover .browser, [dir="rtl"] .card-wide:hover .browser { transform: none; }
	.card-title, .card-wide .card-title { font-size: 28px; }
	.card-summary { font-size: 14px; }
	.card .tags { display: none; }
	.card .actions { gap: 4px 12px; }
	.card .actions .btn { padding: 10px 14px; }

	/* All projects: one horizontal strip */
	.all-projects { flex-direction: row; align-items: center; padding: 18px 20px; }
	.all-projects .big { font-size: 52px; }
	.all-label { font-size: 20px; }

	/* 3D editor */
	.t-code { min-height: 380px; }
	.code-head, .code-foot { padding: 12px 14px; }
	.code-fallback { font-size: 11px; inset: 2% 4%; padding: 16px; }

	/* Stack and experience */
	.tile-title { font-size: 24px; }
	.chips { gap: 6px; }
	.chips li { padding: 6px 10px; font-size: 11.5px; }
	.timeline li { grid-template-columns: 1fr; gap: 2px; padding-block: 10px; }
	.timeline h3 { font-size: 14.5px; }

	/* Contact */
	.t-contact { flex-direction: column; align-items: stretch; padding: 22px; }
	.contact-title { font-size: 32px; max-width: none; }
	.contact-side { align-items: stretch; }
	.mail { justify-content: space-between; }
	.mail a { font-size: 13.5px; }

	/* Projects page and project page */
	.archive-head, .d-head { padding: 22px; }
	.archive-head .count { inset-inline-end: 20px; top: 18px; font-size: 56px; }
	.d-preview { min-height: 260px; }
	.d-next a { font-size: 26px; }
	.preview { width: calc(100vw - 16px); height: calc(100svh - 32px); border-radius: 16px; }
}
