:root {
  --bg: #ffffff;
  --surface: #f6f7f8;
  --text: #111214;
  --text-2: #3a3d42;
  --muted: #7b7f86;
  --border: #e7e8ea;
  --accent: #4b7bf5;
  --accent-ink: #ffffff;
  --brand: #3c8f78;
  --brand-soft: #eef8f4;
  --chip: #eef2fd;
  --chip-ink: #2d3a5c;
  --radius: 20px;
  --wrap: 928px;
  --measure: 720px; /* shared width for case titles and intro text */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012;
    --surface: #17191c;
    --text: #f2f3f5;
    --text-2: #c9ccd1;
    --muted: #8d9198;
    --border: #26292e;
    --brand: #5cc0a2;
    --brand-soft: #14231f;
    --chip: #1d2433;
    --chip-ink: #c8d4f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1012;
    --surface: #17191c;
    --text: #f2f3f5;
    --text-2: #c9ccd1;
    --muted: #8d9198;
    --border: #26292e;
    --brand: #5cc0a2;
    --brand-soft: #14231f;
    --chip: #1d2433;
    --chip-ink: #c8d4f5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { text-wrap: balance; margin: 0; letter-spacing: -0.02em; line-height: 1.15; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-block: 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Header */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-size: 14px; font-weight: 500; }
.nav { display: flex; gap: 24px; font-size: 14px; color: var(--text-2); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* Buttons */
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }

/* Home hero */
.hero { padding-top: 72px; padding-bottom: 96px; }
.avatar { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; margin-bottom: 28px; }
.hero h1 { font-size: clamp(36px, 6vw, 48px); font-weight: 700; }
.hero .role { margin-top: 8px; font-weight: 500; color: var(--text-2); }
.hero .bio { margin: 28px 0 24px; max-width: 460px; font-size: 15px; color: var(--text-2); }

/* Projects */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; font-weight: 500; letter-spacing: 0; }
.section-head span { color: var(--text-2); }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; padding-bottom: 120px; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--bg); transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -20px rgba(0,0,0,.25); }
.card-media { aspect-ratio: 450 / 356; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-body { padding: 18px 16px 28px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 6px; background: var(--chip); color: var(--chip-ink); }
.card h3 { font-size: clamp(20px, 2.6vw, 24px); font-weight: 700; }
.card p { margin-top: 10px; font-size: 14px; color: var(--muted); max-width: 360px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 32px; padding-bottom: 40px; font-size: 14px; color: var(--text-2); flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 24px; }
.site-footer a:hover { color: var(--text); }

/* ===== Case study ===== */
.case-hero { padding-top: 64px; padding-bottom: 56px; }
.eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.case-hero h1 { margin-top: 12px; font-size: clamp(20px, calc((100vw - 32px) * .072), 52px); /* scales so titles stay within two lines */ font-weight: 700; max-width: var(--measure); }
.case-hero .lead { margin-top: 16px; max-width: var(--measure); color: var(--text-2); }

.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 24px; margin: 40px 0 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.meta dt { font-size: 13px; font-weight: 600; }
.meta dd { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.meta .num dt { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.meta .num dd { color: var(--muted); font-size: 13px; }

.frame { border-radius: var(--radius); overflow: hidden; background: var(--brand-soft); }
.frame img { width: 100%; }
figure { margin: 0; }
figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }

.section { padding: 88px 0; border-top: 1px solid var(--border); }
.section .num-label { font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.section h2 { margin-top: 6px; font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
.intro { margin-top: 24px; padding-left: 18px; border-left: 2px solid var(--border); max-width: 920px; }
.intro p + p { margin-top: 10px; }
.note { margin-top: 20px; max-width: 460px; font-size: 13px; color: var(--muted); }

.cols { display: grid; gap: 28px 24px; margin-top: 32px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.rule { padding-left: 14px; border-left: 2px solid var(--brand); }
.rule h3, .box h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.rule p, .box p { margin-top: 10px; font-size: 14px; color: var(--text-2); }

.box { padding: 20px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.box.final { border: 1.5px solid var(--brand); background: var(--brand-soft); }

.versions { display: grid; grid-template-columns: 2.8fr 1fr; gap: 12px; margin-top: 24px; align-items: start; }
.versions .v-old { background: linear-gradient(135deg, #c9cde6, #7c86ad); }
.versions .v-new { background: linear-gradient(160deg, #6ff0c0, #2fb58c); }
.stat { margin-top: 28px; padding: 22px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.stat strong { display: block; font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; }
.stat span { display: block; margin-top: 6px; font-size: 14px; color: var(--text-2); }

.split { display: grid; grid-template-columns: 1.7fr 1fr; gap: 40px; margin-top: 32px; align-items: center; }
.split .phone { border: 1px solid var(--border); border-radius: 16px; padding: 12px; background: var(--bg); }
.split .phone img { border-radius: 10px; }
.split figcaption { text-align: center; }

.approved { margin-top: 28px; padding: 24px 20px; border-radius: 14px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.approved strong { font-size: 24px; letter-spacing: -0.02em; }
.approved p { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.subhead { margin-top: 36px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.delivered { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 24px; }
.delivered li { padding-left: 14px; border-left: 2px solid var(--brand); font-size: 14px; color: var(--text-2); }

.cta { padding: 96px 0 112px; border-top: 1px solid var(--border); }
.cta h2 { font-size: clamp(30px, 5vw, 40px); font-weight: 700; }
.cta p { margin: 12px 0 24px; color: var(--text-2); }

/* Gentle entrance; content is visible at rest */
@keyframes rise { from { opacity: .001; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .6s ease both; }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* Responsive */
@media (max-width: 820px) {
  .cards, .cols-2, .cols-3, .split, .versions, .delivered { grid-template-columns: 1fr; }
  .cols-4, .meta { grid-template-columns: repeat(2, 1fr); }
  .split .phone { max-width: 320px; margin: 0 auto; }
  .section { padding: 64px 0; }
  .hero { padding-top: 48px; padding-bottom: 72px; }
  .cards { padding-bottom: 80px; }
}
@media (max-width: 420px) {
  .cols-4 { grid-template-columns: 1fr; }
  .nav { gap: 16px; }
}

/* Phone rows on a soft frame */
.frame.phones { display: flex; justify-content: center; align-items: flex-start; gap: 20px; flex-wrap: wrap; padding: 32px 20px; }
.frame.phones img { width: clamp(130px, 26%, 240px); filter: drop-shadow(0 14px 22px rgba(0,0,0,.14)); }
.frame.phones.two img { width: clamp(130px, 38%, 250px); }
.frame.flow { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; padding: 24px 16px; }
.frame.flow figure { display: flex; flex-direction: column; gap: 8px; }
.frame.flow img { filter: drop-shadow(0 10px 16px rgba(0,0,0,.14)); }
.frame.flow figcaption { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; }
.feature { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: center; margin-top: 48px; }
.feature:first-of-type { margin-top: 32px; }
.feature > * { min-width: 0; }
.feature.rev { grid-template-columns: 1.4fr 1fr; }
.feature.rev > .rule { order: 2; }
@media (max-width: 820px) {
  .feature, .feature.rev { grid-template-columns: 1fr; gap: 20px; }
  .feature.rev > .rule { order: 0; }
  .frame.flow { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px 10px; }
}
.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
@media (max-width: 820px) { .cols-5 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* Blue felt backdrop for screen frames */
.frame.phones, .frame.flow {
  position: relative; isolation: isolate;
  background-color: #3567c4;
  background-image:
    linear-gradient(118deg, rgba(10,25,70,.38) 0%, rgba(10,25,70,0) 32%, rgba(255,255,255,.10) 46%, rgba(10,25,70,0) 58%, rgba(10,25,70,.30) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55  0 0 0 0 .7  0 0 0 0 1  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .02  0 0 0 0 .08  0 0 0 0 .3  0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}
.frame.phones img, .frame.flow img { filter: drop-shadow(0 22px 28px rgba(5,15,50,.45)) drop-shadow(0 4px 8px rgba(5,15,50,.3)); }
.frame.flow figcaption { color: #e8efff; }

/* ===== Dark "stage" case (Rentec): same type system, dark palette ===== */
html:root.stage-theme {
  --bg: #0a0b0d;
  --surface: #131519;
  --text: #f1f2f4;
  --text-2: #b4b8c0;
  --muted: #7d828b;
  --border: #23262c;
  --accent: #2e8cff;
  --brand: #2e8cff;
  --brand-soft: #131519;
  --chip: #1a2333;
  --chip-ink: #c8d8f5;
  --live: #3ddc84;
  color-scheme: dark;
}
:root { --live: #1f9d5c; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.live {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 28px;
  padding: 20px 22px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--live) 35%, var(--border));
  background: linear-gradient(100deg, color-mix(in srgb, var(--live) 10%, var(--surface)), var(--surface) 60%);
}
.live-status { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.live-status small { display: block; font-size: 14px; font-weight: 400; color: var(--text-2); }
.live .btn { margin-left: auto; }
.stage { margin-top: 8px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.stage img { width: 100%; }
.wave {
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--border) 0 2px, transparent 2px 9px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.box.dark { background: var(--surface); }
.delivered.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) {
  .live .btn { margin-left: 0; }
  .delivered.two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

/* ===== Green band case (Dubai real estate): same type system, brand-green hero ===== */
:root { --estate: #0b8a3e; --estate-deep: #0a6b34; --estate-soft: #e8f5ec; --on-estate: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --estate: #2fbf6a; --estate-soft: #12261b; }
}
:root[data-theme="dark"] { --estate: #2fbf6a; --estate-soft: #12261b; }

.band { position: relative; overflow: hidden; color: var(--on-estate); background: linear-gradient(125deg, var(--estate-deep), #0d9a49); }
.band::before, .band::after { content: ""; position: absolute; background: rgba(255,255,255,.08); transform: rotate(-15deg); pointer-events: none; }
.band::before { width: 320px; height: 320px; right: -80px; top: -120px; box-shadow: inset 0 0 0 70px rgba(0,0,0,.06); }
.band::after { width: 150px; height: 150px; left: -40px; bottom: -60px; }
.band .case-hero { position: relative; padding-bottom: 72px; }
.band .eyebrow, .band .lead, .band .meta dd { color: rgba(255,255,255,.85); }
.band .meta { border-top-color: rgba(255,255,255,.22); }
.band .meta dt { color: var(--on-estate); }
.overlap { position: relative; margin-top: -36px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #1e1e1e; box-shadow: 0 30px 60px -30px rgba(0,0,0,.35); }
.overlap img { width: 100%; }
.estate .rule, .estate .delivered li { border-left-color: var(--estate); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-bottom: 12px; border-radius: 6px; background: var(--estate); color: var(--on-estate); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.estate .approved { background: var(--estate-soft); border-color: color-mix(in srgb, var(--estate) 30%, transparent); }
.estate .delivered b { display: block; color: var(--text); font-weight: 600; }
.section.first { border-top: 0; }

/* ===== Breadcrumbs and back link ===== */
.crumbs { margin-bottom: 20px; font-size: 13px; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--border); }
.crumbs a { color: var(--text-2); transition: color .15s ease; }
.crumbs a:hover { color: var(--text); }
.crumbs a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.crumbs [aria-current="page"] { color: var(--text); }
.band .crumbs a, .band .crumbs li + li::before { color: rgba(255,255,255,.7); }
.band .crumbs a:hover, .band .crumbs [aria-current="page"] { color: var(--on-estate); }

.back-row { padding-block: 8px 48px; }
.btn.back { gap: 8px; }
.btn.back .arrow { transition: transform .2s ease; }
.btn.back:hover .arrow { transform: translateX(-3px); }

/* ===== Language switch ===== */
.nav .lang {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--text);
  transition: border-color .15s ease;
}
.nav .lang:hover { border-color: var(--muted); }
.nav { align-items: center; }
@media (max-width: 420px) {
  .nav { gap: 14px; font-size: 13px; }
  .nav a:first-child { display: none; } /* the logo already links home */
}
