/* ==========================================================
   Portfolio – Kazi Mahfuzur Rahman
   Simple, light, mobile-first. One accent colour.
   ========================================================== */

:root {
    --bg: #FBF9F6;
    --surface: #FFFFFF;
    --ink: #16181D;
    --muted: #5B6270;
    --line: #E6E2DB;
    --accent: #0B7A75;
    --accent-ink: #FFFFFF;
    --accent-soft: #E2F1EF;
    --mark: #FFE08A;
    --warn: #B4472B;
    --ok-bg: #E3F6EA;
    --ok-ink: #14693A;
    --err-bg: #FDE8E4;
    --err-ink: #A52F17;
    --shade: rgba(22, 24, 29, .08);
    --radius: 16px;
    --shadow: 0 1px 2px rgba(22, 24, 29, .04), 0 10px 28px rgba(22, 24, 29, .06);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --wrap: 1120px;
    --gutter: 1.25rem;
}

/* Dark mode (set by the toggle or the visitor's system preference) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F1115;
    --surface: #171A21;
    --ink: #ECEEF2;
    --muted: #A3ABB8;
    --line: #2A2F3A;
    --accent: #2DD4BF;
    --accent-ink: #04201D;
    --accent-soft: rgba(45, 212, 191, .13);
    --mark: #7A5F0B;
    --warn: #F0907A;
    --ok-bg: rgba(34, 197, 94, .15);
    --ok-ink: #86EFAC;
    --err-bg: rgba(248, 113, 113, .15);
    --err-ink: #FCA5A5;
    --shade: rgba(0, 0, 0, .45);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .25);
}

/* Admin pages keep a dark look by swapping the same tokens */
body.admin {
    --bg: #0B0D12;
    --surface: #12151C;
    --ink: #E5E7EB;
    --muted: #94A3B8;
    --line: #262B36;
    --accent: #2DD4BF;
    --accent-ink: #06201D;
    --accent-soft: rgba(45, 212, 191, .12);
}

/* Legacy names used by the admin screens */
body {
    --bg-dark: var(--bg);
    --bg-panel: var(--surface);
    --color-border: var(--line);
    --text-main: var(--ink);
    --text-muted: var(--muted);
    --accent-cyan: var(--accent);
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

h1, h2, h3 {
    margin: 0 0 .6rem;
    line-height: 1.18;
    letter-spacing: -.02em;
    font-weight: 700;
}

p { margin: 0 0 1rem; }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

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

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--ink);
    color: var(--bg);
    padding: .6rem 1rem;
    z-index: 2000;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 48px;
    padding: .7rem 1.4rem;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    font-size: .98rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--accent-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }

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

.btn-small { min-height: 40px; padding: .4rem 1rem; font-size: .9rem; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 1rem;
}

.brand {
    color: var(--ink);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-nav a:not(.btn) {
    color: var(--muted);
    font-weight: 500;
    font-size: .95rem;
}
.site-nav a:not(.btn):hover { color: var(--ink); text-decoration: none; }

.site-nav { margin-left: auto; }

.header-actions {
    display: flex;
    gap: .5rem;
    margin-left: 1rem;
}

.theme-toggle,
.nav-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.theme-toggle { display: inline-flex; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
    display: none;
}

.nav-toggle .bars,
.nav-toggle .bars::before,
.nav-toggle .bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    content: "";
    position: relative;
    transition: transform .2s, opacity .2s;
}
.nav-toggle .bars::before { position: absolute; top: -6px; }
.nav-toggle .bars::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Sections ---------- */
.section {
    padding: 4.5rem 0;
    scroll-margin-top: 64px;
}
.section-alt {
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: inline-block;
    margin-bottom: .75rem;
    color: var(--accent);
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sec-title {
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    margin-bottom: .75rem;
}

.sec-lead {
    max-width: 640px;
    margin-bottom: 2.5rem;
    color: var(--muted);
    font-size: 1.08rem;
}

/* ---------- Hero ---------- */
.hero { padding: 4rem 0 4.5rem; }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    gap: 3.5rem;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 1.25rem;
    padding: .4rem .9rem;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-weight: 600;
    font-size: .88rem;
}
.badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16A34A;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .2);
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.9rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.07;
    margin-bottom: 1.25rem;
}

mark {
    background: linear-gradient(transparent 58%, var(--mark) 58%);
    color: inherit;
    padding: 0 .1em;
}

.hero-lead {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.15rem;
    margin-bottom: 1.75rem;
}
.hero-lead strong { color: var(--ink); }

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    margin-bottom: 1.5rem;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    color: var(--muted);
    font-size: .9rem;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat {
    padding: 1.4rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat b {
    display: block;
    margin-bottom: .35rem;
    color: var(--accent);
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
}
.stat span {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.4;
    display: block;
}

/* ---------- Cards ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1.25rem;
}

.card {
    display: flex;
    flex-direction: column;
    padding: 1.6rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card h3 { font-size: 1.2rem; }
.card p { color: var(--muted); }
.card > :last-child { margin-bottom: 0; }

.card form { margin-top: 1rem; }

/* 4 projects look best as a 2 x 2 grid on wide screens */
@media (min-width: 760px) {
    .cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

a.card { color: var(--ink); }
a.card:hover { text-decoration: none; border-color: var(--accent); }

.label {
    margin-bottom: .6rem;
    color: var(--warn);
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.result {
    margin-top: auto !important;
    padding: .8rem 1rem;
    background: var(--accent-soft);
    border-radius: 12px;
    color: var(--ink) !important;
    font-size: .95rem;
}
.result::before {
    content: "✓ ";
    color: var(--accent);
    font-weight: 800;
}
.problem p:not(.label):not(.result) { margin-bottom: 1.1rem; }

/* ---------- Tags ---------- */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 0 0 1.1rem;
    padding: 0;
    list-style: none;
}
.tag {
    padding: .25rem .7rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font-size: .82rem;
    font-weight: 500;
}

/* ---------- Projects ---------- */
.project .kicker {
    margin-bottom: .4rem;
    color: var(--accent);
    font-size: .8rem;
    font-weight: 700;
}
.project .why {
    padding-left: .9rem;
    border-left: 3px solid var(--accent);
    color: var(--ink);
}
.project .why b { color: var(--accent); }
.project .tags { margin-top: auto; padding-top: .5rem; }
.links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.links a { font-weight: 600; }

/* ---------- Background (experience + education) ---------- */
.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.role h3 { margin-bottom: .2rem; font-size: 1.3rem; }
.role .meta {
    margin-bottom: 1rem;
    color: var(--accent);
    font-weight: 600;
    font-size: .95rem;
}
.role ul:not(.tags), .edu ul:not(.tags) {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--muted);
}
.role li { margin-bottom: .5rem; }

.edu h3 { font-size: 1.15rem; margin-bottom: .2rem; }

/* ---------- Skills ---------- */
.skill-group h3 { font-size: 1.1rem; margin-bottom: .25rem; }
.skill-group .hint { margin-bottom: 1rem; font-size: .93rem; }
.skill-group .tags { margin-bottom: 0; }
.skill-group .tag {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--accent);
    font-weight: 600;
    font-size: .88rem;
    padding: .35rem .85rem;
}

/* ---------- Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 2rem;
    align-items: start;
}

.contact-list { display: grid; gap: .8rem; }

.contact-item {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
}
.contact-item:hover { border-color: var(--accent); text-decoration: none; }
.contact-item small {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.contact-item span {
    display: block;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 600;
    font-size: .92rem;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: .8rem 1rem;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    font-size: 1rem; /* 16px stops iOS zoom on focus */
}
.form-group input { min-height: 48px; }
.form-group textarea { min-height: 150px; resize: vertical; }
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.char-count { margin-top: .3rem; text-align: right; color: var(--muted); font-size: .8rem; }

.submit-status {
    display: none;
    margin-bottom: 1rem;
    padding: .8rem 1rem;
    border-radius: 12px;
    font-size: .93rem;
    font-weight: 500;
}
.submit-status.ok { display: block; background: var(--ok-bg); color: var(--ok-ink); }
.submit-status.err { display: block; background: var(--err-bg); color: var(--err-ink); }

.send-button { width: 100%; }
.send-button[disabled] { opacity: .6; cursor: wait; }

/* ---------- Footer ---------- */
.site-footer {
    padding: 2rem 0 2.5rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .9rem;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem;
}

/* ---------- Generic pages (privacy, error, admin) ---------- */
.page { padding: 3rem 0 4rem; min-height: 60vh; }
.section-title { font-size: 1.5rem; margin-bottom: 1.5rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--muted); }
.text-main { color: var(--ink); }

.admin-table-wrapper { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    padding: .8rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

/* ==========================================================
   Tablet
   ========================================================== */
@media (max-width: 900px) {
    .hero { padding: 2.5rem 0 3rem; }
    .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .two-col,
    .contact-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   Phone
   ========================================================== */
@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; }
    .header-actions { margin-left: auto; }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: .5rem var(--gutter) 1.25rem;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 16px 30px var(--shade);
    }
    .site-nav.open { display: flex; }

    .site-nav a:not(.btn) {
        padding: .95rem .25rem;
        border-bottom: 1px solid var(--line);
        color: var(--ink);
        font-size: 1.05rem;
    }
    .site-nav .btn { margin-top: 1rem; }
}

@media (max-width: 600px) {
    :root { --gutter: 1.1rem; }

    .section { padding: 3rem 0; }
    .sec-lead { margin-bottom: 1.75rem; font-size: 1rem; }

    .hero-lead { font-size: 1.05rem; }
    .hero-actions .btn { width: 100%; }

    .stats { gap: .75rem; }
    .stat { padding: 1.1rem 1rem; }

    .card { padding: 1.3rem; }
    .footer-inner { flex-direction: column; }
}

@media (max-width: 360px) {
    .stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
