/* ==========================================================
   Salah Eddine Benettouati — portfolio
   Theme: "schematic" — ink-navy board, copper traces, mono labels
   ========================================================== */

:root {
    --ink: #0b1220;
    --ink-2: #0f1a2e;
    --surface: #131f36;
    --surface-2: #182844;
    --line: rgba(148, 170, 210, 0.14);
    --line-strong: rgba(148, 170, 210, 0.28);
    --text: #e6ecf5;
    --muted: #93a3bd;
    --copper: #f97316;
    --copper-soft: #fdba74;
    --signal: #34d399;
    --gold: #fbbf24;
    --silver: #cbd5e1;

    --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', sans-serif;
    --font-body: 'IBM Plex Sans Arabic', 'Readex Pro', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius: 14px;
    --nav-h: 72px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text);
    background: var(--ink);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--copper); color: var(--ink); }

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

.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -100px;
    background: var(--copper);
    color: var(--ink);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    z-index: 2000;
    font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.btn-primary {
    background: var(--copper);
    color: var(--ink);
    box-shadow: 0 10px 30px -10px rgba(249, 115, 22, 0.6);
}
.btn-primary:hover { transform: translateY(-2px); background: #fb8a3c; }
.btn-primary i.fa-arrow-left { transition: transform 0.25s var(--ease); }
.btn-primary:hover i.fa-arrow-left { transform: translateX(-4px); }
.btn-ghost {
    border-color: var(--line-strong);
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
}
.btn-ghost:hover { border-color: var(--copper); color: var(--copper-soft); transform: translateY(-2px); }
.btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }

/* ---------- Navigation ---------- */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--nav-h);
    z-index: 1000;
    transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
    border-bottom: 1px solid transparent;
}
.navbar.scrolled {
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--line);
}
.nav-container {
    width: min(1180px, 100% - 2.5rem);
    height: 100%;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.nav-logo { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-display); font-weight: 600; }
.logo-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--copper);
    color: var(--copper);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
}
.nav-menu { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
    display: block;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.95rem;
    transition: color 0.2s, background 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-cta { color: var(--copper); border: 1px solid rgba(249, 115, 22, 0.4); margin-inline-start: 0.5rem; }
.nav-cta:hover { background: var(--copper); color: var(--ink); }

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 0;
    padding: 0.5rem;
    cursor: pointer;
}
.bar { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.hamburger.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h) + 3rem) 0 5rem;
    overflow: hidden;
    background:
        radial-gradient(60rem 40rem at 85% 10%, rgba(249, 115, 22, 0.14), transparent 60%),
        radial-gradient(50rem 40rem at 0% 100%, rgba(52, 211, 153, 0.08), transparent 60%),
        var(--ink);
}
.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    opacity: 0.6;
}
.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    align-items: center;
    gap: 4rem;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: ping 2s infinite;
}
@keyframes ping {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
    80%, 100% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
}
.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.hero-title span { display: block; color: var(--copper); }
.hero-subtitle {
    margin-top: 1rem;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    color: var(--copper-soft);
    min-height: 1.8em;
}
.hero-subtitle.typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-inline-start: 4px;
    vertical-align: -0.15em;
    background: currentColor;
    animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.hero-description { margin-top: 1.25rem; max-width: 36rem; color: var(--muted); }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.25rem; }

.hero-visual { display: grid; justify-items: center; gap: 2rem; }
.chip {
    position: relative;
    width: min(320px, 70vw);
    aspect-ratio: 1;
    padding: 14px;
    border-radius: 28px;
    background: linear-gradient(145deg, var(--surface-2), var(--ink-2));
    border: 1px solid var(--line-strong);
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(249, 115, 22, 0.15);
}
.chip img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; }
.pins {
    position: absolute;
    inset-inline: 15%;
    height: 14px;
    background: repeating-linear-gradient(90deg, var(--copper) 0 6px, transparent 6px 22px);
    opacity: 0.8;
}
.pins-top { top: -14px; border-radius: 2px 2px 0 0; }
.pins-bottom { bottom: -14px; }

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(19, 31, 54, 0.6);
}
.hero-stats div { padding: 1rem 0.75rem; text-align: center; }
.hero-stats div + div { border-inline-start: 1px solid var(--line); }
.hero-stats dd { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 600; color: var(--copper); line-height: 1.2; }
.hero-stats dt { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.hero-stats div { display: flex; flex-direction: column-reverse; }

.scroll-indicator {
    position: absolute;
    bottom: 1.75rem;
    left: 50%;
    translate: -50% 0;
    color: var(--muted);
    animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }

/* ---------- Sections ---------- */
.section { padding: 6.5rem 0; position: relative; }
.section-alt { background: var(--ink-2); border-block: 1px solid var(--line); }

.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 3rem; }
.section-index {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--copper);
    padding: 0.15rem 0.55rem;
    border: 1px solid rgba(249, 115, 22, 0.4);
    border-radius: 6px;
}
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
}
.section-head::after {
    content: '';
    flex: 1;
    height: 1px;
    align-self: center;
    background: linear-gradient(to left, var(--line-strong), transparent);
}

.lead { font-size: 1.2rem; max-width: 52rem; color: var(--text); opacity: 0.9; }

.sub-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 3.5rem 0 1.5rem;
    color: var(--muted);
}

/* ---------- Cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.card {
    position: relative;
    padding: 1.75rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s, transform 0.3s var(--ease);
}
.card:hover { border-color: rgba(249, 115, 22, 0.5); transform: translateY(-4px); }
.card-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.12);
    color: var(--copper);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}
.card h4 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 0.95rem; line-height: 1.7; }
.badge {
    position: absolute;
    top: 1.5rem;
    inset-inline-end: 1.5rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    color: var(--signal);
    border: 1px solid rgba(52, 211, 153, 0.35);
}

/* ---------- Language meters ---------- */
.languages { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem 3rem; }
.language-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: 500; }
.language-header .mono { color: var(--copper-soft); font-size: 0.9rem; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(to left, var(--copper), var(--gold));
    transition: width 1.4s var(--ease);
}
.languages.in-view .meter span { width: var(--value); }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: 1.5rem; padding-inline-start: 2.5rem; }
.timeline::before {
    content: '';
    position: absolute;
    inset-block: 0.5rem;
    inset-inline-start: 19px;
    width: 2px;
    background: repeating-linear-gradient(to bottom, var(--line-strong) 0 6px, transparent 6px 12px);
}
.timeline-item { position: relative; }
.timeline-marker {
    position: absolute;
    inset-inline-start: -2.5rem;
    top: 1.5rem;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ink);
    border: 2px solid var(--copper);
    color: var(--copper);
    font-size: 0.95rem;
    z-index: 1;
}
.timeline-content {
    margin-inline-start: 1.25rem;
    padding: 1.75rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}
.timeline-content h3 { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.5; margin-top: 0.4rem; }
.timeline-content .role { color: var(--copper-soft); font-size: 0.95rem; margin: 0.25rem 0 0.75rem; }
.timeline-content p:not(.role) { color: var(--muted); font-size: 0.97rem; }
.period { font-size: 0.8rem; color: var(--muted); }
.achievements { display: grid; gap: 0.4rem; }
.achievements li { position: relative; padding-inline-start: 1.25rem; color: var(--muted); font-size: 0.95rem; }
.achievements li::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0.75em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--copper);
}

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.75rem; }
.project-card {
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s, transform 0.3s var(--ease);
}
.project-card:hover { border-color: rgba(249, 115, 22, 0.5); transform: translateY(-6px); }
.project-image { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink-2); }
.project-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.project-card:hover .project-image img { transform: scale(1.05); }
.project-content { display: flex; flex-direction: column; gap: 0.85rem; padding: 1.75rem; flex: 1; }
.project-content h3 { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.45; }
.project-content h3 a:hover { color: var(--copper-soft); }
.project-content > p:not(.project-award) { color: var(--muted); font-size: 0.97rem; }
.project-award { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 500; }
.project-award.gold { color: var(--gold); }
.project-award.silver { color: var(--silver); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.tags li {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--muted);
}
.link-arrow { margin-top: auto; display: inline-flex; align-items: center; gap: 0.5rem; color: var(--copper); font-weight: 600; }
.link-arrow i { transition: transform 0.25s var(--ease); }
.link-arrow:hover i { transform: translateX(-5px); }

/* ---------- Tools ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.tool {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s;
}
.tool:hover { border-color: rgba(249, 115, 22, 0.5); }
.tool img, .tool-icon {
    flex: none;
    width: 56px;
    height: 56px;
    object-fit: contain;
    padding: 8px;
    border-radius: 12px;
    background: #f1f5f9;
}
.tool-icon { display: grid; place-items: center; background: rgba(249, 115, 22, 0.12); color: var(--copper); font-size: 1.3rem; }
.tool h3 { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; }
.tool p { color: var(--muted); font-size: 0.88rem; line-height: 1.6; }

/* ---------- Contact ---------- */
.contact-content { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: start; }
.contact-info { display: grid; gap: 0.85rem; }
.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s;
}
a.contact-item:hover { border-color: rgba(249, 115, 22, 0.5); }
.contact-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.contact-item strong { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
.contact-item [dir="ltr"] { text-align: right; overflow-wrap: anywhere; }
.contact-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.12);
    color: var(--copper);
}
.social-icons { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.social-icons a {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    transition: all 0.25s;
}
.social-icons a:hover { background: var(--copper); border-color: var(--copper); color: var(--ink); transform: translateY(-3px); }

.contact-form {
    padding: 2rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.contact-form h3 { font-family: var(--font-display); font-size: 1.35rem; }
.form-intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--muted); }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--ink-2);
    color: var(--text);
    font: inherit;
    font-size: 0.97rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input[dir="ltr"] { text-align: left; }
.form-group textarea { resize: vertical; min-height: 140px; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #5f6f89; }
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}
.hidden-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin-top: 1rem; font-size: 0.95rem; min-height: 1.5em; }
.form-status.success { color: var(--signal); }
.form-status.error { color: #f87171; }

/* ---------- Footer ---------- */
.footer { padding: 3rem 0 2rem; border-top: 1px solid var(--line); }
.footer-content { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; }
.footer-name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.footer-content p:not(.footer-name) { color: var(--muted); font-size: 0.9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--muted); font-size: 0.92rem; }
.footer-links a:hover { color: var(--copper); }
.footer-bottom { text-align: center; color: #5f6f89; font-size: 0.85rem; margin-top: 2rem; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero-inner { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
    .hero-text { display: flex; flex-direction: column; align-items: center; }
    .hero-description { margin-inline: auto; }
    .hero-buttons { justify-content: center; }
    .hero-visual { order: -1; }
    .chip { width: min(240px, 60vw); }
    .contact-content { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .hamburger { display: flex; }
    .logo-text { font-size: 0.95rem; }
    .nav-menu {
        position: fixed;
        top: var(--nav-h);
        inset-inline: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 1rem 1.25rem 1.5rem;
        background: rgba(11, 18, 32, 0.97);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line);
        transform: translateY(-120%);
        visibility: hidden;
        transition: transform 0.35s var(--ease), visibility 0.35s;
    }
    .nav-menu.active { transform: none; visibility: visible; }
    .nav-link { padding: 0.75rem 1rem; font-size: 1rem; border-radius: 10px; }
    .nav-cta { margin: 0.5rem 0 0; text-align: center; }
    .navbar:has(.nav-menu.active) { background: rgba(11, 18, 32, 0.97); }
}

@media (max-width: 600px) {
    body { font-size: 1rem; }
    .section { padding: 4.5rem 0; }
    .section-head { margin-bottom: 2rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .languages { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .contact-form { padding: 1.5rem; }
    .timeline { padding-inline-start: 0; }
    .timeline::before { display: none; }
    .timeline-marker { position: static; margin-bottom: 0.75rem; }
    .timeline-content { margin-inline-start: 0; }
    .footer-content { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}
