/* Layout and presentation. Load after the component stylesheets.
   Base rules are mobile-first; desktop columns are introduced only at 961px. */
:root {
  --bg: #111820;
  --surface: #17212b;
  --surface-2: #202d39;
  --ink: #e0e7ed;
  --muted: #b3bec9;
  --faint: #94a4b4;
  --line: rgba(185, 204, 222, .16);
  --line-strong: rgba(137, 174, 206, .4);
  --blue: #8ab8e0;
  --cyan: #a4bfd3;
  --gold: #e5ac57;
  --violet: var(--blue);
  --violet-light: var(--blue);
  --lime: #a0c4ae;
  --coral: var(--gold);
  --radius: .65rem;
  --shadow: 0 12px 32px rgba(0, 0, 0, .16);
  --font: 'Space Grotesk', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --shell: 1120px;
}
html[data-theme="light"] {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #eeefeb;
  --ink: #263746;
  --muted: #526473;
  --faint: #617380;
  --line: rgba(32, 57, 78, .16);
  --line-strong: rgba(32, 78, 112, .35);
  --blue: #315f7e;
  --cyan: #426a81;
  --gold: #94601b;
  --lime: #416b53;
  --shadow: 0 12px 32px rgba(25, 46, 64, .07);
}
body { min-width: 320px; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.75; }
.page-noise, .ambient, .visual-orbit, .floating-card, .mofit-glow,
.thamara-reflection, .dashboard-reflection { display: none; }
.shell, .hub-shell { width: min(calc(100% - 32px), var(--shell)); }
.shell > *, .hub-shell > *, .hero-layout > *, .about-grid > *,
.skills-layout > *, .contact-layout > *, .project-card > *,
.timeline-item > *, .skill-group > *, .services-panel > * { min-width: 0; }
h1, h2, h3 { color: var(--ink); font-family: var(--font); letter-spacing: -.035em; overflow-wrap: normal; word-break: normal; }
h1 { max-width: none; font-size: clamp(1.875rem, 7.8vw, 2.85rem); line-height: 1.2; }
h1 em { color: var(--blue); }
.section-heading h2, .skills-copy h2, .services-copy h2, .contact-copy h2 {
  max-width: 25ch; font-size: clamp(1.65rem, 5.8vw, 2.15rem); line-height: 1.3;
}
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 {
  font-family: 'IBM Plex Sans Arabic', sans-serif; letter-spacing: 0; line-height: 1.5;
}
html[dir="rtl"] body { letter-spacing: 0; }
.eyebrow { gap: 10px; margin-bottom: 16px; color: var(--gold); font-size: 11px; line-height: 1.7; letter-spacing: .04em; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; background: var(--gold); box-shadow: none; animation: none; }
.eyebrow-index { flex: 0 0 auto; color: var(--gold); }
.section { padding-block: 48px; scroll-margin-top: 84px; }
.site-header, .site-header.is-scrolled {
  background: var(--bg); border-bottom: 1px solid var(--line); backdrop-filter: none;
}
.header-inner { height: 68px; gap: 10px; }
.brand { gap: 8px; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; }
.brand-name { font-size: 13px; letter-spacing: -.025em; }
.header-actions { gap: 6px; }
.icon-button, .language-button, .menu-button { width: 40px; height: 40px; border-radius: 6px; }
.icon-button[data-theme-toggle] { display: none; }
.menu-button { display: grid; }
.desktop-nav, .header-contact { display: none; }
.mobile-menu {
  display: block; top: 100%; max-height: calc(100dvh - 68px); overflow-y: auto;
  padding: 12px 20px 20px; background: var(--bg); border-bottom: 1px solid var(--line);
  transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s, visibility .18s, transform .18s;
}
.mobile-menu.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-menu a { padding: 12px 4px; font-size: 15px; line-height: 1.6; border-bottom: 1px solid var(--line); }
.hero { min-height: 0; display: block; padding: 104px 0 44px; }
.hero-layout, .about-grid, .skills-layout, .contact-layout, .services-panel {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px;
}
.hero-copy { grid-row: auto; padding: 0; border: 0; }
.hero-lede { max-width: 60ch; margin: 20px 0 24px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.hero-actions { display: flex; gap: 10px; margin: 0 0 28px; }
.button { min-height: 46px; width: auto; padding: 12px 16px; border-radius: 6px; font-size: 13px; line-height: 1.5; }
.hero-actions > .button { flex: 1 1 140px; }
.button-primary, .header-contact { background: var(--gold); color: #17212b; }
html[data-theme="light"] .button-primary, html[data-theme="light"] .header-contact { color: #fff; }
.button-primary:hover { background: var(--gold); box-shadow: none; }
.button-secondary { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.hero-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 0; padding-top: 22px; border-top: 1px solid var(--line); }
.hero-facts > div:last-child { grid-column: 1 / -1; }
.hero-facts dt { color: var(--faint); font-size: 10px; line-height: 1.6; }
.hero-facts dd, .hero-facts dd:not(:has(small)) { max-width: none; font-size: 14px; line-height: 1.6; }
.hero-visual { grid-row: auto; display: block; min-height: 0; overflow: visible; }
.terminal-card { width: 100%; background: var(--surface); border-radius: 8px; box-shadow: none; transform: none; backdrop-filter: none; }
.terminal-topbar { height: 42px; padding: 0 12px; gap: 8px; font-size: 9px; background: var(--surface-2); }
.terminal-topbar > span:not(.terminal-live) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.terminal-dots, .terminal-live { flex-shrink: 0; }
.terminal-body { min-height: 174px; padding: 16px 12px; font-size: 11px; line-height: 1.9; }
.terminal-line { min-width: 0; gap: 6px; }
.terminal-typed { min-width: 0; overflow-wrap: anywhere; }
.terminal-footer { padding: 12px; gap: 12px; background: var(--surface-2); }
.terminal-footer strong { font-size: 11px; }
.terminal-success { color: var(--lime); }
.capability-strip { padding: 14px 0; background: transparent; }
.strip-track { animation-duration: 50s; }
.strip-set { font-size: 11px; }
.strip-set b { color: var(--gold); }
.about-copy { padding: 0; }
.about-lede { font-size: 17px; line-height: 1.8; }
.about-copy p, .skills-copy > p, .services-copy > p:not(.eyebrow), .contact-copy > p:not(.eyebrow) { font-size: 15px; line-height: 1.85; color: var(--muted); }
.text-link { font-size: 13px; color: var(--blue); }
.text-link:after { content: none; }
.capabilities-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 32px; border: 0; background: transparent; }
.capability-card { min-height: 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.capability-card:before { content: none; }
.capability-card:hover { transform: none; background: var(--surface); }
.capability-icon { margin-bottom: 18px; border-radius: 6px; color: var(--blue); background: var(--surface-2); }
.capability-card h3 { font-size: 19px; }
.capability-card p { font-size: 14px; }
.experience-section { background: transparent; }
.section-heading-wide { display: block; }
.section-heading-wide > p { width: auto; max-width: 55ch; margin: 18px 0 0; font-size: 15px; }
.timeline { margin-top: 28px; }
.timeline-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 26px 0; }
.timeline-item:before, .timeline-content:before { content: none; }
.timeline-period { padding: 0; font-size: 12px; line-height: 1.6; color: var(--gold); }
.timeline-content { padding: 0; }
.timeline-title-row { display: flex; flex-direction: column; align-items: start; gap: 8px; }
.timeline-title-row h3 { font-size: 19px; line-height: 1.5; }
.timeline-title-row span { margin: 0; font-size: 11px; color: var(--blue); line-height: 1.6; }
.timeline-content > p { font-size: 14px; line-height: 1.85; }
.impact-list { list-style: disc; display: block; padding-inline-start: 20px; }
.impact-list li { margin: 8px 0; padding: 0; font-size: 14px; line-height: 1.85; color: var(--muted); }
.impact-list li:before { content: none; }
.impact-list li::marker { color: var(--gold); }
.skills-copy { position: static; }
.skill-group { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px 0; }
.skill-group p { font-size: 11px; line-height: 1.7; color: var(--gold); }
.skill-group div span { font-size: 12px; line-height: 1.5; border-radius: 4px; background: transparent; }
.project-list { margin-top: 28px; gap: 24px; }
.project-card { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; padding: 0; border-radius: 8px; background: var(--surface); }
.project-card:after { content: none; }
.project-meta { position: static; grid-row: 1; padding: 14px 18px; gap: 12px; border-bottom: 1px solid var(--line); font-size: 10px; line-height: 1.6; color: var(--faint); }
.project-content { grid-row: 3; padding: 24px 20px; }
.project-content h3 { font-size: 25px; line-height: 1.3; max-width: none; }
.project-label { margin: 0 0 12px; color: var(--gold); font-size: 11px; }
.project-content > p:not(.project-label) { max-width: none; font-size: 14px; line-height: 1.85; }
.project-tags { margin: 0 0 22px; }
.project-tags li { border-radius: 4px; font-size: 10px; line-height: 1.6; }
.project-actions { flex-wrap: wrap; gap: 16px; }
.project-action { min-height: 40px; font-size: 13px; color: var(--blue); }
.project-private { font-size: 11px; }
.project-art, .project-mofit .project-art, .project-dashboard .project-art, .thamara-art {
  grid-row: 2; margin: 0; min-height: 280px; overflow: hidden; border: 0;
}
.thamara-art, .dashboard-art { background: #121d2c; }
.mofit-art { background: #142b30; }
.browser-frame { width: 84%; border-radius: 6px; box-shadow: 0 14px 30px rgba(0,0,0,.28); animation: none; }
.browser-frame img, .phone-frame img { width: 100%; height: auto; object-fit: contain; }
.phone-frame { width: 90px; inset-inline-end: 4%; bottom: 14px; border-radius: 14px; animation: none; }
.mofit-phone { width: 168px; transform: rotate(3deg); box-shadow: 0 12px 28px rgba(0,0,0,.3); animation: none; }
.dashboard-frame { width: 86%; transform: rotate(-2deg); animation: none; border-radius: 6px; }
.dashboard-main { width: 100%; height: auto; object-fit: contain; }
.dashboard-secondary { display: none; }
.services-section { padding-top: 48px; }
.services-panel { padding: 24px; border-radius: 8px; background: var(--surface); }
.services-copy { grid-row: 1; }
.service-visual { grid-row: 2; min-height: 250px; overflow: hidden; }
.audit-ring { animation: none; opacity: .45; }
.audit-core, .metric-bubble { box-shadow: none; background: var(--surface); }
.service-list { font-size: 14px; }
.contact-section { padding-top: 48px; }
.contact-layout { padding-bottom: 0; }
.contact-details > a, .contact-details > span { width: auto; font-size: 13px; overflow-wrap: anywhere; }
.contact-form { padding: 20px; border-radius: 8px; background: var(--surface); }
.form-field label { font-size: 13px; }
.form-field input, .form-field textarea { background: var(--bg); font-size: 16px; border-radius: 5px; }
.form-submit, .form-whatsapp { width: 100%; }
.form-note { font-size: 12px; }
.site-footer { padding: 20px 0; background: var(--bg); }
.footer-top { display: flex; flex-wrap: wrap; gap: 20px; padding: 12px 0 24px; }
.footer-top .brand { flex-basis: 100%; }
.footer-top p { order: 0; font-size: 13px; flex-basis: 100%; }
.footer-top-link { margin: 0; font-size: 12px; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; }
.case-dialog { max-height: calc(100dvh - 24px); border-radius: 8px; }
.case-dialog-grid { grid-template-columns: minmax(0, 1fr); padding: 64px 20px 24px; }
.dialog-close { width: 44px; height: 44px; top: 10px; inset-inline-end: 10px; }
.hub-main { padding-top: 68px; }
.hub-breadcrumbs { padding-top: 18px; margin-bottom: 20px; line-height: 1.8; }
.hub-hero { padding: 40px 0 32px; background: transparent; }
.hub-title, .article-title { max-width: none; font-size: clamp(1.8rem, 6.5vw, 2.6rem); line-height: 1.3; letter-spacing: -.025em; }
.hub-lede, .article-dek { font-size: 15px; line-height: 1.85; }
.hub-section { padding-block: 36px; }
.card-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; border: 0; background: transparent; }
.hub-card { padding: 22px; border: 1px solid var(--line); border-radius: 8px; }
.hub-card:before { content: none; }
.hub-card h3 { font-size: 19px; }
.hub-card-meta, .article-meta { color: var(--faint); line-height: 1.8; }
.hub-card p { font-size: 14px; }
.article-header { padding: 36px 0 24px; background: transparent; }
.article-shell, .hub-shell-narrow { width: min(calc(100% - 32px), 760px); }
.article-body h2 { font-size: 23px; }
.article-body h3 { font-size: 19px; }
.article-body pre { max-width: 100%; }
.article-body a, html[data-theme="light"] .article-body a { color: var(--blue); }
.article-body blockquote { border-inline-start-color: var(--gold); }
.article-body pre, html[data-theme="light"] .article-body pre { background: #17212b; }
.pill { border-radius: 4px; }

/* Chat remains inside the visual viewport, including short landscape screens. */
.nabil-ai { z-index: 120; inset-inline-end: max(16px, env(safe-area-inset-right)); inset-block-end: max(16px, env(safe-area-inset-bottom)); }
.nabil-ai-launcher { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 66px; height: 70px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); animation: none; box-shadow: var(--shadow); }
.nabil-ai-launcher-label { font: 600 11px/1.3 var(--font); letter-spacing: .01em; white-space: nowrap; }
.nabil-ai-launcher-icon { width: 30px; height: 28px; object-fit: contain; }
.nabil-ai-panel { position: fixed; inset-inline-start: auto; inset-inline-end: 12px; inset-block-start: auto; inset-block-end: max(12px, env(safe-area-inset-bottom)); display: flex; width: min(380px, calc(100% - 24px)); height: min(560px, calc(100dvh - 92px)); max-height: calc(100dvh - 92px); border-radius: 12px; background: var(--surface); overflow: hidden; }
.nabil-ai-panel[hidden] { display: none; }
.nabil-ai-header { flex: 0 0 auto; min-width: 0; min-height: 70px; padding: 10px 12px; gap: 8px; background: var(--surface-2); border-top: 0; }
.nabil-ai-header > div:first-child { min-width: 0; flex: 1 1 auto; }
.nabil-ai-title { font-size: 15px; line-height: 1.6; }
.nabil-ai-subtitle { font-size: 11px; line-height: 1.6; }
.nabil-ai-header-actions { flex: 0 0 auto; gap: 4px; align-items: center; }
.nabil-ai-icon-btn { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.nabil-ai-icon-btn[data-nabil-close] { border-color: var(--line-strong); background: var(--surface); }
.nabil-ai-icon-btn svg { width: 18px; height: 18px; }
.nabil-ai-messages { min-height: 0; flex: 1 1 0; padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
.nabil-ai-empty p, .nabil-ai-bubble { font-size: 14px; line-height: 1.8; }
.nabil-ai-suggestion { font-size: 12px; padding: 10px; line-height: 1.5; border-radius: 6px; }
.nabil-ai-input-row { flex: 0 0 auto; min-width: 0; padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--surface-2); }
.nabil-ai-input-row input { min-width: 0; width: 0; font-size: 16px; border-radius: 6px; }
.nabil-ai-send { width: 44px; height: 44px; border-radius: 6px; background: var(--gold); color: #17212b; }
.nabil-ai-send:hover { background: var(--gold); }
html[dir="rtl"] .nabil-ai-title, html[dir="rtl"] .nabil-ai-empty p, html[dir="rtl"] .nabil-ai-bubble, html[dir="rtl"] .nabil-ai-suggestion { font-family: 'IBM Plex Sans Arabic', sans-serif; }

@media (min-width: 621px) {
  .section { padding-block: 64px; }
  .shell, .hub-shell { width: min(calc(100% - 64px), var(--shell)); }
  .hero { padding-top: 116px; padding-bottom: 56px; }
  h1 { font-size: 46px; line-height: 1.18; }
  .hero-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-facts > div:last-child { grid-column: auto; }
  .hero-actions > .button { flex: 0 1 auto; }
  .capabilities-grid, .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-art { min-height: 340px; }
  .phone-frame { width: 110px; }
  .mofit-phone { width: 185px; }
  .nabil-ai-panel { inset-inline-end: 20px; inset-block-end: 102px; height: min(560px, calc(100dvh - 120px)); }
}
@media (min-width: 961px) {
  .desktop-nav { display: flex; gap: 20px; }
  .desktop-nav a { font-size: 13px; }
  .icon-button[data-theme-toggle] { display: grid; }
  .menu-button, .mobile-menu { display: none; }
  .header-contact { display: inline-flex; border-radius: 6px; }
  .header-inner { height: 76px; gap: 20px; }
  .brand-name { font-size: 14px; }
  .hero { padding: 132px 0 64px; }
  .hero-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; }
  h1 { max-width: 24ch; font-size: clamp(38px, 3.5vw, 48px); }
  html[dir="rtl"] h1 { max-width: none; font-size: 44px; line-height: 1.45; }
  .hero-visual { align-self: center; }
  .hero-lede { font-size: 16px; }
  .section-heading h2, .skills-copy h2, .services-copy h2, .contact-copy h2 { font-size: 32px; }
  .about-grid, .skills-layout, .contact-layout { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 64px; }
  .capabilities-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-heading-wide { display: flex; align-items: start; gap: 48px; }
  .section-heading-wide > p { margin-top: 30px; max-width: 38ch; }
  .timeline-item { grid-template-columns: 172px minmax(0, 1fr); gap: 32px; }
  .timeline-title-row { flex-direction: row; justify-content: space-between; }
  .skill-group { grid-template-columns: 145px minmax(0, 1fr); }
  .project-card { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .project-meta { grid-column: 1 / -1; }
  .project-content { grid-row: 2; grid-column: 1; padding: 28px; }
  .project-art { grid-column: 2; min-height: 360px; height: 100%; }
  .project-content h3 { font-size: 29px; }
  .services-panel { grid-template-columns: minmax(0, .75fr) minmax(0, 1fr); padding: 36px; gap: 48px; }
  .services-copy, .service-visual { grid-row: auto; }
  .service-visual { min-height: 320px; }
  .footer-top .brand { flex-basis: auto; }
  .footer-top p { flex: 1 1 240px; margin: 0; }
  .hub-main { padding-top: 76px; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .case-dialog-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 64px 32px 32px; }
}
@media (max-height: 520px) {
  .nabil-ai-panel { inset-block-end: 8px; height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .nabil-ai-header { min-height: 56px; padding-block: 6px; }
}
@media (prefers-reduced-motion: reduce) { .strip-track { animation: none; } }
