/* =========================================================================
   Maria Net — design tokens
   Values lifted from the approved prototype. Change them here, nowhere else.
   ========================================================================= */

:root {
    /* ---------------------------------------------------------------------
       The palette is these SIX values. Everything below derives from them
       with color-mix, so retuning the whole site is six lines, not thirty.
       Chosen 2026-08-23: warm sand ground, ink-blue accent.
       --------------------------------------------------------------------- */
    --bg:              #e9e1d3;   /* warm sand — the page ground          */
    --bg-alt:          #ded5c4;   /* alternating section bands            */
    --bg-raised:       #f4efe6;   /* cards and panels, lifted off the bg  */
    --fg:              #22252e;   /* near-black with a cool cast          */
    --accent:          #27418c;   /* ink blue                             */
    --on-accent:       #f4f6fd;   /* text sitting on the accent           */

    /* --- derived: lines, from the ground toward the ink ---------------- */
    --bg-input:        var(--bg-raised);
    --line:            color-mix(in oklab, var(--bg) 86%, var(--fg));
    --line-strong:     color-mix(in oklab, var(--bg) 79%, var(--fg));
    --line-control:    color-mix(in oklab, var(--bg) 68%, var(--fg));
    --line-input:      var(--line-control);
    --line-hover:      color-mix(in oklab, var(--bg) 48%, var(--fg));

    /* --- derived: the text ramp, from the ink toward the ground -------- */
    --fg-body:         color-mix(in oklab, var(--fg) 86%, var(--bg));
    --fg-muted:        color-mix(in oklab, var(--fg) 72%, var(--bg));
    --fg-dim:          color-mix(in oklab, var(--fg) 64%, var(--bg));
    --fg-faint:        color-mix(in oklab, var(--fg) 54%, var(--bg));
    --fg-ghost:        color-mix(in oklab, var(--fg) 44%, var(--bg));
    --fg-trace:        var(--fg-ghost);
    --placeholder:     var(--fg-ghost);

    /* --- derived: incidental ------------------------------------------- */
    --accent-cool:     color-mix(in oklab, var(--accent) 58%, var(--fg));
    --mesh-grid:       var(--line);
    --icon-idle:       var(--line-control);
    --danger:          #a4322c;
    --shadow:          0 1px 2px rgb(34 37 46 / .06), 0 10px 28px -14px rgb(34 37 46 / .22);

    /* type */
    --font-display:    'Bricolage Grotesque', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-body:       'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono:       'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* rhythm */
    --gutter:          4.5rem;
    --section-y:       6rem;
    --radius:          2px;

    /* motion */
    --ease:            .18s ease;
}

/* Arabic swaps the type stack; everything else is shared. */
[lang="ar"] {
    --font-display:    'IBM Plex Sans Arabic', 'Noto Kufi Arabic', sans-serif;
    --font-body:       'IBM Plex Sans Arabic', 'Noto Kufi Arabic', sans-serif;
}

/* =========================================================================
   Reset
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
svg { display: block; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: 0; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 0.98;
    margin: 0;
    text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =========================================================================
   Primitives
   ========================================================================= */

.shell {
    max-width: 90rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.mono {
    font-family: var(--font-mono);
    font-size: .6875rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

[lang="ar"] .mono { letter-spacing: 0; }

.eyebrow { color: var(--accent); }

.lede {
    font-size: 1.1875rem;
    line-height: 1.6;
    color: var(--fg-muted);
    max-width: 52ch;
}

.section {
    padding-block: var(--section-y);
    border-block-start: 1px solid var(--line);
}

.section--alt { background: var(--bg-alt); }

.section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3rem;
    margin-block-end: 3.5rem;
}

.section__title { font-size: 2.875rem; max-width: 22ch; }

/* buttons ---------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5625rem;
    min-height: 44px;
    padding-inline: 1.375rem;
    border-radius: var(--radius);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--ease), border-color var(--ease), color var(--ease);
}

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { filter: brightness(1.08); }

.btn--ghost {
    border: 1px solid var(--line-control);
    color: var(--fg-muted);
    font-weight: 400;
}
.btn--ghost:hover { border-color: var(--fg); color: var(--fg); }

.btn--lg { min-height: 52px; padding-inline: 1.75rem; font-size: .9375rem; }

.btn--block { width: 100%; }

.btn[disabled] {
    background: var(--line-control);
    color: var(--fg-faint);
    cursor: not-allowed;
    filter: none;
}

/* arrow glyph flips with direction */
.arrow { flex-shrink: 0; }
[dir="rtl"] .arrow { transform: scaleX(-1); }

/* =========================================================================
   Header
   ========================================================================= */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
    padding-block: 1.25rem;
    border-block-end: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: .6875rem;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.brand__net { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 2rem; }
.nav a {
    font-size: .9375rem;
    color: var(--fg-dim);
    transition: color var(--ease);
}
.nav a:hover, .nav a[aria-current] { color: var(--fg); }

.header__end { display: flex; align-items: center; gap: 1rem; }

.lang {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--fg-faint);
}
.lang a { transition: color var(--ease); }
.lang a:hover { color: var(--fg); }
.lang a[aria-current] { color: var(--accent); }

.burger {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-control);
    border-radius: var(--radius);
    cursor: pointer;
}

.drawer { display: none; }
.drawer[data-open] {
    display: block;
    background: var(--bg-raised);
    border-block-end: 1px solid var(--line);
}
.drawer a {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding-inline: 1.25rem;
    border-block-end: 1px solid var(--line);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1875rem;
}
.drawer__cta { padding: 1.25rem; }

/* =========================================================================
   Hero
   ========================================================================= */

.hero {
    display: grid;
    grid-template-columns: 1fr 30rem;
    gap: 4rem;
    align-items: center;
    padding-block: 6rem 5.5rem;
}

.hero__title {
    font-size: 4.625rem;
    max-width: 15ch;
    margin-block: 1.75rem;
}

.hero__actions { display: flex; align-items: center; gap: .875rem; margin-block-start: 2.5rem; }

.hero__panel {
    position: relative;
    border: 1px solid var(--line);
    background: var(--bg-raised);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* -------------------------------------------------------------------------
   Hero network visual.

   Sequence: the grid fades up, the routes draw themselves in, the nodes pop
   once their route arrives, then packets travel the routes on a loop. Labels
   are real HTML rather than SVG <text>, so they stay crisp, translatable and
   RTL-safe -- the old SVG labels collided with the paths.

   All CSS and inline SVG, no animation library.
   ------------------------------------------------------------------------- */

.netviz { position: relative; }
.netviz__svg { display: block; width: 100%; height: auto; }

/* fine grid, masked so it dissolves toward the edges instead of hitting them */
.netviz__grid-line { stroke: var(--line); stroke-width: 1; fill: none; }

/* a soft pool of accent behind the network, for depth */
.netviz__glow-stop-in  { stop-color: var(--accent); stop-opacity: .10; }
.netviz__glow-stop-out { stop-color: var(--accent); stop-opacity: 0; }

/* routes: pathLength="1" normalises every path so one keyframe draws them all */
.netviz__route-stop-a { stop-color: var(--accent); stop-opacity: .25; }
.netviz__route-stop-b { stop-color: var(--accent); stop-opacity: .95; }

.netviz__route {
    /* The gradient reference lives on the element as a presentation attribute,
       not here: a bare url(#id) inside an EXTERNAL stylesheet can resolve
       against the stylesheet's own URL rather than the document, which breaks
       SVG paint-server references. In the markup it is unambiguous. */
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: netviz-draw 1.2s cubic-bezier(.65, 0, .35, 1) forwards;
}
.netviz__route { animation-delay: .1s; }

@keyframes netviz-draw { to { stroke-dashoffset: 0; } }

/* nodes pop in after their route reaches them */
.netviz__node,
.netviz__halo {
    transform-box: fill-box;
    transform-origin: center;
}

.netviz__node {
    fill: var(--bg-raised);
    stroke: var(--accent);
    stroke-width: 2;
    scale: 0;
    animation: netviz-pop .55s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.netviz__node--1 { animation-delay: .30s; }
.netviz__node--2 { animation-delay: .62s; }
.netviz__node--3 { animation-delay: .90s; }
.netviz__node--4 { animation-delay: 1.20s; }

@keyframes netviz-pop { to { scale: 1; opacity: 1; } }

/* a slow breathing ring on each major node */
.netviz__halo {
    fill: var(--accent);
    opacity: 0;
    animation: netviz-halo 3.4s ease-out infinite;
}
.netviz__halo--1 { animation-delay: 1.6s; }
.netviz__halo--2 { animation-delay: 2.4s; }
.netviz__halo--3 { animation-delay: 3.2s; }
.netviz__halo--4 { animation-delay: 4.0s; }

@keyframes netviz-halo {
    0%        { scale: 1;   opacity: .20; }
    70%, 100% { scale: 2.8; opacity: 0; }
}

/* packets ride the routes. offset-path on an SVG child works in the SVG's
   own coordinate system, so this scales with the panel. */
.netviz__packet {
    fill: var(--accent);
    offset-rotate: 0deg;
    opacity: 0;
    animation: netviz-travel 3.8s linear infinite;
}
.netviz__packet--1,
.netviz__packet--2 {
    offset-path: path("M 56 316 L 172 236 L 300 176 L 420 84");
}
.netviz__packet--1 { animation-delay: 1.5s; }
.netviz__packet--2 { animation-delay: 3.4s; animation-duration: 4.4s; }

@keyframes netviz-travel {
    0%        { offset-distance: 0%;   opacity: 0; }
    10%       { opacity: 1; }
    88%       { opacity: 1; }
    100%      { offset-distance: 100%; opacity: 0; }
}

/* labels: HTML, positioned as a percentage of the panel so they track the
   nodes at any width */
.netviz__label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: .625rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--fg-faint);
    white-space: nowrap;
    opacity: 0;
    translate: -50% 0;
    animation: netviz-fade .7s ease forwards;
}
.netviz__label--1 { inset-inline-start: 11.7%; inset-block-start: 84%; animation-delay: .50s; }
.netviz__label--2 { inset-inline-start: 35.8%; inset-block-start: 64%; animation-delay: .82s; }
.netviz__label--3 { inset-inline-start: 62.5%; inset-block-start: 49%; animation-delay: 1.10s; }
.netviz__label--4 { inset-inline-start: 87.5%; inset-block-start: 26%; animation-delay: 1.40s; }

@keyframes netviz-fade { to { opacity: 1; } }

/* One switch for the whole sequence: hold the finished state, drop the loops. */
@media (prefers-reduced-motion: reduce) {
    .netviz__route  { animation: none; stroke-dashoffset: 0; }
    .netviz__node   { animation: none; scale: 1; opacity: 1; }
    .netviz__label  { animation: none; opacity: 1; }
    .netviz__halo   { animation: none; opacity: 0; }
    .netviz__packet { animation: none; opacity: 0; }
}

/* =========================================================================
   Services
   ========================================================================= */

.services { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5rem; align-items: start; }

.services__list { border-block-start: 1px solid var(--line); }

.svc {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    min-height: 44px;
    padding: 1.625rem 1.375rem;
    text-align: start;
    cursor: pointer;
    border-block-end: 1px solid var(--line);
    border-inline-start: 2px solid transparent;
    transition: background var(--ease), border-color var(--ease);
}
.svc__num { flex-shrink: 0; color: var(--fg-ghost); transition: color var(--ease); }
.svc__title {
    flex-grow: 1;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--fg-dim);
    transition: color var(--ease);
}
.svc__arrow { flex-shrink: 0; color: var(--icon-idle); transition: color var(--ease); }

.svc:hover .svc__title { color: var(--fg); }

.svc[aria-selected="true"] {
    background: var(--bg-raised);
    border-inline-start-color: var(--accent);
}
.svc[aria-selected="true"] .svc__num,
.svc[aria-selected="true"] .svc__arrow { color: var(--accent); }
.svc[aria-selected="true"] .svc__title { color: var(--fg); }

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.svc-detail__title { font-size: 1.875rem; margin-block: 1.375rem 1.125rem; }
.svc-detail__body { color: var(--fg-muted); margin-block-end: 1.875rem; }

.svc-detail__points {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    padding-block-start: 1.75rem;
    border-block-start: 1px solid var(--line-strong);
}
.svc-detail__points li { display: flex; align-items: flex-start; gap: .8125rem; }
.svc-detail__points svg { flex-shrink: 0; margin-block-start: .25rem; stroke: var(--accent); }
.svc-detail__points span { font-size: .9375rem; line-height: 1.5; color: var(--fg-body); }

.svc-panel[hidden] { display: none; }

/* =========================================================================
   Process
   ========================================================================= */

.process { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; }
.step { padding-block-start: 1.5rem; border-block-start: 2px solid var(--line-control); }
.step:first-child { border-block-start-color: var(--accent); }
.step__title { font-size: 1.375rem; margin-block: 1rem .75rem; }
.step p { font-size: .9375rem; line-height: 1.6; color: var(--fg-dim); }

/* =========================================================================
   Engagement
   ========================================================================= */

.eng-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.eng-card { padding: 2.125rem; }
.eng-card--lead { border-color: var(--accent); }
.eng-card--lead .mono { color: var(--accent); }
.eng-card .mono { color: var(--fg-faint); margin-block-end: 1.375rem; }
.eng-card__title { font-size: 1.5rem; margin-block-end: .875rem; }
.eng-card p { font-size: .9375rem; line-height: 1.65; color: var(--fg-muted); }

/* =========================================================================
   Work
   ========================================================================= */

.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }

.work {
    display: block;
    padding: 2rem;
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    box-shadow: var(--shadow);
    transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.work:hover {
    border-color: var(--line-hover);
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgba(16, 24, 42, .05), 0 16px 32px -14px rgba(16, 24, 42, .16);
}
.work:hover .arrow { transform: translateX(4px); }
[dir="rtl"] .work:hover .arrow { transform: scaleX(-1) translateX(4px); }

.work__shot {
    height: 9.375rem;
    margin-block-end: 1.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: var(--bg);
    color: var(--fg-faint);
}
/* Fill the box and let object-fit letterbox the artwork inside it.
   max-height: 100% alone does NOT work here: as a grid item the image gets
   min-height: auto, which resolves to its intrinsic height and overrides the
   max, so a tall logo pushes straight out of the frame. Explicit min-* of 0
   plus a definite height is what actually constrains it. */
.work__shot img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}

/* A card with no website is not a link, so it must not offer link affordances. */
.work--static { cursor: default; }
.work--static:hover {
    border-color: var(--line-strong);
    transform: none;
    box-shadow: var(--shadow);
}
.work__meta { color: var(--fg-faint); margin-block-end: .875rem; }
.work__title { font-size: 1.375rem; margin-block-end: .75rem; }
.work p { font-size: .9375rem; line-height: 1.6; color: var(--fg-dim); margin-block-end: 1.375rem; }
.work__more {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--accent);
}

/* =========================================================================
   Contact band
   ========================================================================= */

.contact { display: grid; grid-template-columns: 1fr 25rem; gap: 4.5rem; align-items: center; }
.contact__title { font-size: 3.375rem; max-width: 20ch; margin-block-end: 1.375rem; }
.contact__lede { font-size: 1.125rem; max-width: 48ch; }

.contact-card { display: flex; flex-direction: column; gap: .875rem; }
.contact-card__mail { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--accent); }
.contact-card hr { border: 0; border-block-start: 1px solid var(--line-strong); margin-block: .375rem; width: 100%; }
.contact-card span { font-size: .9375rem; color: var(--fg-muted); }

/* =========================================================================
   Brief form
   ========================================================================= */

.brief { display: grid; grid-template-columns: 1fr 25rem; gap: 4rem; align-items: start; }
.brief__form { display: flex; flex-direction: column; gap: 2.75rem; }

.field__head { display: flex; align-items: baseline; gap: .875rem; margin-block-end: 1.25rem; }
.field__num { color: var(--accent); }
.field__label { font-size: 1.375rem; }
.field__hint { color: var(--fg-ghost); margin-block: -.75rem 1.25rem; padding-inline-start: 2.25rem; }

.chips { display: flex; flex-wrap: wrap; gap: .625rem; }
.chip {
    min-height: 44px;
    padding-inline: 1.25rem;
    border: 1px solid var(--line-control);
    border-radius: var(--radius);
    font-size: .9375rem;
    color: var(--fg-muted);
    cursor: pointer;
    transition: border-color var(--ease), color var(--ease);
}
.chip:hover { border-color: var(--fg-dim); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }

input[type="text"], input[type="email"], textarea {
    font: inherit;
    width: 100%;
    background: var(--bg-raised);
    border: 1px solid var(--line-input);
    border-radius: var(--radius);
    color: var(--fg);
    padding: .875rem 1rem;
    min-height: 48px;
    outline: none;
    transition: border-color var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 8.125rem; resize: vertical; }

.brief__submit { display: flex; align-items: center; gap: 1.25rem; padding-block-start: .5rem; }
.brief__submit span { font-size: .875rem; color: var(--fg-faint); }

.summary__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1rem;
    border-block-end: 1px solid var(--line-strong);
}
.summary__value { font-size: .9375rem; color: var(--fg-trace); text-align: end; }
.summary__value[data-set] { color: var(--fg); font-weight: 500; }

.summary__note {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-block-start: 1.625rem;
    padding: 1rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}
.summary__note svg { flex-shrink: 0; stroke: var(--accent); }
.summary__note p { font-size: .875rem; line-height: 1.5; color: var(--fg-body); }

.summary__alt { margin-block-start: 1.625rem; padding-block-start: 1.625rem; border-block-start: 1px solid var(--line-strong); }

.form-errors { color: var(--danger); font-size: .875rem; margin-block-start: .5rem; }

.flash {
    padding: 1rem 1.25rem;
    margin-block-end: 2rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--fg);
}
.flash--error { border-color: var(--danger); }

/* =========================================================================
   Footer
   ========================================================================= */

.footer {
    padding-block: 2.75rem;
    border-block-start: 1px solid var(--line);
    background: var(--bg-alt);
}
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 2.5rem; }
.footer .nav a { font-size: .875rem; }

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 64rem) {
    :root { --gutter: 2rem; --section-y: 4rem; }

    .hero { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero__title { font-size: 3rem; max-width: none; }
    .services { grid-template-columns: 1fr; gap: 2rem; }
    .process { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .eng-grid, .work-grid { grid-template-columns: 1fr; }
    .contact, .brief { grid-template-columns: 1fr; gap: 2.5rem; }
    .contact__title { font-size: 2.5rem; }
    .section__head { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
}

@media (max-width: 48rem) {
    :root { --gutter: 1.25rem; }

    .nav--main, .header__end .btn, .header__end .lang { display: none; }
    .burger { display: grid; }
    .header__end .lang--mobile { display: flex; }

    .hero { padding-block: 2.75rem 3rem; }
    .hero__title { font-size: 2.5rem; }
    .hero__actions { flex-direction: column; align-items: stretch; }
    .lede { font-size: 1rem; }

    .section__title, .contact__title { font-size: 2rem; }
    .process { grid-template-columns: 1fr; }

    .card { padding: 1.5rem; }
    .svc { padding: 1.25rem; }
    .svc__title { font-size: 1.125rem; }

    .grid-2 { grid-template-columns: 1fr; }
    .footer__inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
}
