/* ==========================================================================
   MDB Development — 2026 redesign
   Warm paper, charcoal ink, one copper accent (drawn from the MDB wordmark).
   Mobile-first. No build step. Light/dark via [data-theme].
   ========================================================================== */

:root {
    --paper: #f5f2ec;
    --paper-2: #ebe6dc;
    --paper-3: #e1dbcf;
    --ink: #1c1b19;
    --ink-2: #47443f;
    --muted: #77726a;
    --line: #d8d1c4;
    --line-strong: #bdb4a4;
    --copper: #b8722c;
    --copper-2: #955b20;
    --copper-soft: rgba(184, 114, 44, 0.12);
    --on-copper: #ffffff;
    --shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 12px 32px -12px rgba(28, 27, 25, 0.18);

    --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --wrap: 1180px;
    --gutter: 20px;
    --radius: 6px;
    --radius-lg: 12px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
    --paper: #141311;
    --paper-2: #1c1a17;
    --paper-3: #26231f;
    --ink: #f1ede6;
    --ink-2: #c9c3b8;
    --muted: #8f8a80;
    --line: #2d2a25;
    --line-strong: #403c35;
    --copper: #d38c46;
    --copper-2: #e5a161;
    --copper-soft: rgba(211, 140, 70, 0.14);
    --on-copper: #141311;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    overflow-x: hidden;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--copper); color: var(--on-copper); }

:focus-visible {
    outline: 2px solid var(--copper);
    outline-offset: 3px;
    border-radius: 2px;
}

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    padding: 10px 14px; background: var(--ink); color: var(--paper);
    border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */
.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}
.section { padding: 80px 0; border-top: 1px solid var(--line); }
.section-alt { background: var(--paper-2); }
.section-head { max-width: 720px; margin-bottom: 44px; }
.section-sub { margin-top: 16px; font-size: 1.0625rem; color: var(--ink-2); }

@media (min-width: 768px) {
    :root { --gutter: 32px; }
    .section { padding: 112px 0; }
    .section-head { margin-bottom: 56px; }
}
@media (min-width: 1024px) {
    .section { padding: 136px 0; }
}

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; }
h1 { font-size: clamp(2.5rem, 8.5vw, 5.25rem); }
h2 { font-size: clamp(1.9rem, 5.2vw, 3.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); letter-spacing: -0.02em; }
h4 { font-size: 0.8125rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.accent { color: var(--copper); }
.lead { font-size: clamp(1.0625rem, 2.2vw, 1.3125rem); line-height: 1.55; color: var(--ink-2); max-width: 640px; }
.eyebrow, .index {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.section-head .index { margin-bottom: 18px; }

/* ---------- Buttons & links ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px 20px;
    font-weight: 700; font-size: 0.9375rem; line-height: 1;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
    white-space: nowrap;
}
.btn-primary { background: var(--copper); color: var(--on-copper); }
.btn-primary:hover { background: var(--copper-2); transform: translateY(-1px); }
.btn-lg { padding: 16px 26px; font-size: 1rem; }
.btn-sm { padding: 9px 14px; font-size: 0.875rem; }
.btn-full { width: 100%; }
.btn svg { transition: transform 0.2s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

.link-arrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 0.9375rem; color: var(--ink);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--line-strong);
    transition: border-color 0.2s, color 0.2s;
}
.link-arrow::after {
    content: "→";
    font-family: var(--font-mono);
    transition: transform 0.2s var(--ease);
}
.link-arrow:hover { color: var(--copper); border-color: var(--copper); }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- Nav ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }

.brand { display: inline-flex; align-items: baseline; gap: 8px; }
.brand-mark { font-weight: 800; font-size: 1.375rem; letter-spacing: -0.04em; line-height: 1; }
.brand-mark .m { color: var(--copper); }
.brand-name { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-2); }

.nav-links {
    display: none;
}
.nav-links a { font-weight: 600; font-size: 0.9375rem; color: var(--ink-2); transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.nav-cta { color: var(--on-copper); }
.nav-links a.nav-cta:hover { color: var(--on-copper); }

.nav-tools { display: flex; align-items: center; gap: 6px; }
.theme-switch, .nav-toggle {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    color: var(--ink-2);
    transition: background 0.2s, color 0.2s;
}
.theme-switch:hover, .nav-toggle:hover { background: var(--paper-2); color: var(--ink); }
.nav-toggle { flex-direction: column; gap: 5px; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform 0.25s var(--ease); }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* Mobile menu */
.nav-links.open {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; left: 0; right: 0; top: 64px;
    padding: 12px var(--gutter) 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.nav-links.open a { padding: 12px 4px; font-size: 1.0625rem; border-bottom: 1px solid var(--line); }
.nav-links.open a:last-child { border-bottom: 0; margin-top: 8px; padding: 14px 16px; }

@media (min-width: 900px) {
    .nav-row { height: 72px; }
    .nav-links { display: flex; align-items: center; gap: 28px; }
    .nav-links a.nav-cta { margin-left: 8px; }
    .nav-toggle { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 56px; position: relative; overflow: hidden; }
.hero::before {
    /* faint grid — engineering-paper texture */
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.35;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 100%);
}
.hero h1 { margin: 20px 0 22px; max-width: 14ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 32px; }

.proof {
    display: grid; grid-template-columns: 1fr 1fr;
    margin-top: 56px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--paper-2);
}
.proof-item { padding: 20px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.proof-item:nth-child(2n) { border-right: 0; }
.proof-item:nth-last-child(-n+2) { border-bottom: 0; }
.proof dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.proof dd { margin-top: 8px; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.proof dd .unit { font-size: 0.875rem; font-weight: 600; letter-spacing: 0; color: var(--ink-2); }

@media (min-width: 768px) {
    .hero { padding: 104px 0 88px; }
    .hero h1 { margin: 24px 0 28px; }
    .proof { grid-template-columns: repeat(4, 1fr); margin-top: 72px; }
    .proof-item { padding: 26px 24px; border-bottom: 0; }
    .proof-item:nth-child(2n) { border-right: 1px solid var(--line); }
    .proof-item:last-child { border-right: 0; }
    .proof dd { font-size: 2.5rem; }
}
@media (min-width: 1024px) {
    .hero { padding: 128px 0 104px; }
}

/* ---------- Practice ---------- */
.practice-grid {
    display: grid; gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--paper);
}
.practice { padding: 28px 22px 32px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.practice:last-child { border-bottom: 0; }
.practice .index { color: var(--copper); }
.practice h3 { margin: 14px 0 12px; }
.practice > p { color: var(--ink-2); font-size: 0.9875rem; }
.checks { margin: 20px 0 22px; display: grid; gap: 9px; }
.checks li { position: relative; padding-left: 22px; font-size: 0.9375rem; color: var(--ink-2); }
.checks li::before {
    content: ""; position: absolute; left: 0; top: 0.55em;
    width: 11px; height: 6px;
    border-left: 2px solid var(--copper); border-bottom: 2px solid var(--copper);
    transform: rotate(-45deg);
}
.from {
    margin-top: auto; padding-top: 18px; border-top: 1px dashed var(--line-strong);
    font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); line-height: 1.6;
}
.from span { color: var(--ink); font-weight: 500; }
.practice .link-arrow { margin-top: 18px; align-self: flex-start; }

@media (min-width: 900px) {
    .practice-grid { grid-template-columns: repeat(3, 1fr); }
    .practice { padding: 36px 30px 40px; border-bottom: 0; border-right: 1px solid var(--line); }
    .practice:last-child { border-right: 0; }
}

/* ---------- Work ---------- */
.work-grid { display: grid; gap: 28px; }
.work-card { display: block; }
.browser {
    border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
    background: var(--paper);
    box-shadow: var(--shadow);
    transition: transform 0.35s var(--ease), border-color 0.25s;
}
.work-card:hover .browser { transform: translateY(-4px); border-color: var(--line-strong); }
.browser-bar {
    display: flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 12px;
    background: var(--paper-2); border-bottom: 1px solid var(--line);
}
.browser-bar span { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.browser-bar em {
    margin-left: 10px; font-style: normal; font-family: var(--font-mono);
    font-size: 0.6875rem; color: var(--muted); letter-spacing: 0.02em;
}
.browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.work-meta { padding: 18px 4px 0; }
.work-meta h3 { margin: 8px 0 10px; }
.work-meta p:not(.index) { color: var(--ink-2); font-size: 0.9375rem; }
.work-meta .link-arrow { margin-top: 14px; }

@media (min-width: 768px) {
    .work-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
    .work-card:first-child { grid-column: 1 / -1; }
    .work-card:first-child .browser img { aspect-ratio: 16 / 8; }
}
@media (min-width: 1024px) {
    .work-card:first-child { display: grid; grid-template-columns: 7fr 5fr; gap: 36px; align-items: center; }
    .work-card:first-child .browser img { aspect-ratio: 16 / 10; }
    .work-card:first-child .work-meta { padding: 0; }
}

/* Case studies */
.cases { display: grid; gap: 20px; margin-top: 64px; }
.case {
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--paper);
    padding: 26px 22px;
}
.case-head { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.case-head h3 { margin-top: 10px; }
.case-body { display: grid; gap: 18px; }
.case-body h4 { margin-bottom: 6px; }
.case-body p { font-size: 0.9375rem; color: var(--ink-2); }

@media (min-width: 900px) {
    .cases { margin-top: 88px; }
    .case { padding: 36px 36px 40px; }
    .case-body { grid-template-columns: repeat(3, 1fr); gap: 32px; }
}

/* ---------- Studio ---------- */
.studio-grid { display: grid; gap: 48px; }
.studio-text h2 { margin: 18px 0 22px; }
.studio-text p:not(.index) { color: var(--ink-2); margin-bottom: 16px; font-size: 1.0625rem; }
.studio-text strong { color: var(--ink); }
.studio-text .btn { margin-top: 8px; }

.studio-facts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.studio-facts li { padding: 22px 0; border-bottom: 1px solid var(--line); }
.studio-facts .index { color: var(--copper); }
.studio-facts h3 { margin: 8px 0 8px; font-size: 1.125rem; }
.studio-facts p:not(.index) { font-size: 0.9375rem; color: var(--ink-2); }

@media (min-width: 900px) {
    .studio-grid { grid-template-columns: 5fr 6fr; gap: 80px; align-items: start; }
    .studio-text { position: sticky; top: 96px; }
}

/* ---------- Process ---------- */
.steps { display: grid; gap: 0; counter-reset: step; border-top: 1px solid var(--line); }
.step { padding: 24px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.step h3 { font-size: 1.25rem; }
.step p:not(.index) { color: var(--ink-2); font-size: 0.9375rem; max-width: 52ch; }

@media (min-width: 900px) {
    .steps { grid-template-columns: repeat(4, 1fr); border-top: 0; }
    .step { padding: 28px 24px 8px 0; border-bottom: 0; border-top: 2px solid var(--line-strong); }
    .step .index { color: var(--copper); }
}

/* ---------- Pricing ---------- */
.why-less { display: grid; gap: 0; border-top: 2px solid var(--line-strong); }
.why-less li { padding: 20px 0; border-bottom: 1px solid var(--line); }
.why-less h3 { font-size: 1.125rem; margin-bottom: 6px; }
.why-less p { font-size: 0.9375rem; color: var(--ink-2); }
.pricing-grid { display: grid; gap: 32px; }
.pricing-grid .section-head { margin-bottom: 0; }
.rates th, .rates td { padding: 14px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rates th { font-weight: 600; color: var(--ink); padding-right: 16px; }
.rates td { font-family: var(--font-mono); font-size: 0.875rem; color: var(--ink-2); text-align: right; white-space: nowrap; }
.rates tr:first-child th, .rates tr:first-child td { border-top: 2px solid var(--line-strong); }
.rates-note { font-size: 0.875rem; color: var(--muted); }

@media (min-width: 900px) {
    .pricing-grid { grid-template-columns: 5fr 6fr; gap: 80px; align-items: start; }
    .rates-note { grid-column: 2; margin-top: -12px; }
}

/* ---------- CTA band ---------- */
.cta { background: var(--ink); color: var(--paper); padding: 80px 0; }
[data-theme="dark"] .cta { background: var(--paper-3); color: var(--ink); }
.cta .accent { color: var(--copper); }
[data-theme="light"] .cta .accent, :root:not([data-theme="dark"]) .cta .accent { color: #d99a56; }
.cta-row { display: grid; gap: 28px; }
.cta p { opacity: 0.8; margin-bottom: 24px; font-size: 1.0625rem; max-width: 46ch; }
@media (min-width: 900px) {
    .cta { padding: 112px 0; }
    .cta-row { grid-template-columns: 6fr 5fr; gap: 64px; align-items: center; }
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 40px; }
.contact-info h2 { margin: 18px 0 18px; }
.contact-info > p:not(.index) { color: var(--ink-2); font-size: 1.0625rem; }
.contact-details { margin-top: 28px; display: grid; gap: 14px; }
.contact-details div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.contact-details dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.contact-details dd { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.contact-details a:hover { color: var(--copper); }

.contact-form {
    padding: 24px 20px;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--paper-2);
}
.form-row { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.01em; }
.field input, .field select, .field textarea {
    width: 100%; padding: 12px 14px;
    font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.hp { position: absolute; left: -9999px; top: -9999px; height: 0; width: 0; overflow: hidden; }
.form-status { margin-top: 14px; font-size: 0.9375rem; font-weight: 600; min-height: 1.5em; }
.form-status.success { color: #2f7d4f; }
.form-status.error { color: #b3372f; }
[data-theme="dark"] .form-status.success { color: #6fc48f; }
[data-theme="dark"] .form-status.error { color: #f08a80; }

@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
    .contact-grid { grid-template-columns: 5fr 6fr; gap: 80px; align-items: start; }
    .contact-form { padding: 36px; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 48px 0 28px; background: var(--paper-2); }
.footer-grid { display: grid; gap: 32px; }
.footer-brand p { margin-top: 14px; max-width: 34ch; font-size: 0.9375rem; color: var(--ink-2); }
.footer-col { display: grid; gap: 10px; align-content: start; }
.footer-col h4 { margin-bottom: 4px; }
.footer-col a { font-size: 0.9375rem; color: var(--ink-2); transition: color 0.2s; overflow-wrap: anywhere; }
.footer-col a:hover { color: var(--copper); }
.footer-bottom {
    margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
    font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted);
}
@media (min-width: 768px) {
    .footer { padding: 64px 0 32px; }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 40px; }
}

/* ---------- Reveal on scroll ---------- */
/* Only hide content when the script has confirmed it is running (html.js). */
html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
html.js .reveal.in-view { opacity: 1; transform: none; }
.reveal[data-delay="60"] { transition-delay: 60ms; }
.reveal[data-delay="80"] { transition-delay: 80ms; }
.reveal[data-delay="100"] { transition-delay: 100ms; }
.reveal[data-delay="120"] { transition-delay: 120ms; }
.reveal[data-delay="140"] { transition-delay: 140ms; }
.reveal[data-delay="160"] { transition-delay: 160ms; }
.reveal[data-delay="180"] { transition-delay: 180ms; }
.reveal[data-delay="240"] { transition-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .btn, .browser, .link-arrow::after { transition: none; }
}
