/* Muhammad Imran — shared styles for the homepage and the works archive.
   Source Serif 4 for headings, DM Sans for text; the site's purple / teal-blue / light-cyan palette.
   Colours follow the visitor's system light/dark setting. */

:root {
    --font-serif: 'Source Serif 4', Georgia, serif;
    --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --bg: #ffffff;
    --ink: #1e1d1b;
    --ink-2: #5f5b55;
    --ink-3: #6f6b63;
    --purple: #8b3fa0;
    --blue: #227093;
    --cyan: #cff2f6;
    --tint: #f4f9fa;
    --line: rgba(30, 29, 27, 0.1);
    --shadow: rgba(139, 63, 160, 0.14);

    --wrap: 960px;
    --gutter: 40px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e0e10;
        --ink: #ecebe8;
        --ink-2: #aba69e;
        --ink-3: #96918a;
        --purple: #d386ea;
        --blue: #34ace0;
        --cyan: #1b2f35;
        --tint: #16181b;
        --line: rgba(236, 235, 232, 0.11);
        --shadow: rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

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

h1, h2, h3, p, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

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

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 3px;
    border-radius: 4px;
}

.wrap {
    width: 100%;
    max-width: calc(var(--wrap) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 60;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    font-size: 0.875rem;
}
.skip-link:focus { top: 12px; }

/* Small uppercase labels. */
.eyebrow {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    line-height: 1.4;
}

.u {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    transition: color 200ms var(--ease), text-decoration-color 200ms var(--ease);
}
.u:hover {
    color: var(--purple);
    text-decoration-color: currentColor;
}

/* ---------- Progress bar and header ---------- */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--blue));
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 300ms var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 76px;
}

.brand {
    font-family: var(--font-serif);
    font-size: 1.3125rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 30px;
    font-size: 0.875rem;
    color: var(--ink-2);
}
.nav a { transition: color 200ms var(--ease); }
.nav a:hover,
.nav a[aria-current="page"],
.nav .nav-accent { color: var(--purple); }

/* ---------- Hero ---------- */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 56px;
    align-items: end;
    padding: 72px 0 56px;
}

.kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: var(--purple);
}
.kicker::before {
    content: "";
    width: 22px;
    height: 2px;
    background: linear-gradient(90deg, var(--purple), var(--blue));
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2.75rem, 6.6vw, 4.75rem);
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.hero-title span { color: var(--purple); }

.hero-bio {
    font-size: 1.125rem;
    font-weight: 350;
    line-height: 1.6;
    color: var(--ink-2);
}

.cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    font-size: 0.875rem;
    font-weight: 450;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
}
.btn:hover { border-color: var(--purple); color: var(--purple); }
.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}
.btn-primary:hover {
    background: var(--purple);
    border-color: var(--purple);
    color: var(--bg);
}

/* ---------- "Worked with" strip ---------- */

.strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 34px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.strip li {
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    font-weight: 300;
    color: var(--ink-2);
}
.strip .strip-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 6px;
}

/* ---------- Sections ---------- */

.section { padding-top: 88px; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 24px;
    margin-bottom: 28px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.875rem, 3.4vw, 2.25rem);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.section-note { color: var(--ink-3); font-size: 0.9375rem; }

.text-link {
    font-size: 0.875rem;
    color: var(--purple);
    transition: opacity 200ms var(--ease);
}
.text-link:hover { opacity: 0.75; }

/* ---------- Work cards ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 26px;
}

.card a { display: block; }

.card-media {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--tint);
    transition: box-shadow 300ms var(--ease), border-color 300ms var(--ease);
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease);
}
.card a:hover .card-media {
    border-color: color-mix(in srgb, var(--purple) 45%, transparent);
    box-shadow: 0 18px 36px -20px var(--shadow);
}
.card a:hover .card-media img { transform: scale(1.03); }

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: var(--purple);
}
.card-meta span:last-child { color: var(--ink-3); }

.card-title {
    margin-top: 8px;
    font-family: var(--font-serif);
    font-size: 1.375rem;
    font-weight: 320;
    line-height: 1.2;
    letter-spacing: -0.012em;
    transition: color 200ms var(--ease);
}
.card a:hover .card-title { color: var(--purple); }

.card-desc {
    margin-top: 8px;
    font-size: 0.90625rem;
    line-height: 1.55;
    color: var(--ink-2);
}

/* ---------- Training list ---------- */

.training-list { border-top: 1px solid var(--line); }

.training-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 22px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.training-num {
    padding-top: 4px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.training-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 320;
    line-height: 1.25;
    letter-spacing: -0.012em;
}
.training-title a,
.training-title span {
    padding: 0 0.15em;
    margin: 0 -0.15em;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    transition: background-color 220ms var(--ease), color 220ms var(--ease);
}
/* The light-cyan highlight from the original site: on the latest entry, and on hover. */
.training-row:first-child .training-title a,
.training-row:hover .training-title a,
.training-row:hover .training-title span { background: var(--cyan); }

.training-date {
    margin-top: 6px;
    color: var(--ink-3);
}

.training-desc {
    color: var(--ink-2);
    font-size: 0.96875rem;
    line-height: 1.6;
}

/* ---------- Contact ---------- */

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.contact-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 156px;
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--tint);
    transition: border-color 250ms var(--ease), box-shadow 250ms var(--ease), transform 250ms var(--ease);
}
.contact-card:hover {
    border-color: color-mix(in srgb, var(--purple) 45%, transparent);
    box-shadow: 0 18px 36px -22px var(--shadow);
    transform: translateY(-2px);
}
.contact-card .eyebrow { color: var(--purple); }
.contact-card h3 {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: -0.018em;
    line-height: 1.2;
}
.contact-card p {
    margin-top: 22px;
    font-size: 0.875rem;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

/* ---------- Archive page ---------- */

.page-intro { padding: 64px 0 36px; }
.back-link {
    display: inline-block;
    margin-bottom: 26px;
    font-size: 0.875rem;
    color: var(--ink-3);
    transition: color 200ms var(--ease);
}
.back-link:hover { color: var(--purple); }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filters .btn[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.archive-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px 24px;
    padding: 20px 0;
    margin-bottom: 36px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

/* ---------- Photo page ---------- */

.photos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 48px 28px;
    padding-top: 8px;
}

.photo-media {
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--tint);
}
.photo-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease);
}
.photo-media:hover img { transform: scale(1.02); }

.photo figcaption {
    margin-top: 14px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--ink-2);
}
.photo figcaption .eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--purple);
}

@media (max-width: 600px) {
    .photos { grid-template-columns: 1fr; gap: 36px; }
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 112px;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
    color: var(--ink-3);
}
.site-footer .wrap {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 22px;
    padding-bottom: 32px;
}
.site-footer a { transition: color 200ms var(--ease); }
.site-footer a:hover { color: var(--purple); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 56px 0 44px;
    }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .training-row { grid-template-columns: 32px minmax(0, 1fr); row-gap: 8px; }
    .training-desc { grid-column: 2; }
    .contact-cards { grid-template-columns: 1fr; }
    .contact-card { min-height: 0; }
}

@media (max-width: 600px) {
    :root { --gutter: 20px; }
    html { scroll-padding-top: 72px; }
    .site-header .wrap { height: 62px; }
    .brand { font-size: 1.125rem; }
    .nav { gap: 18px; font-size: 0.8125rem; }
    .cards { grid-template-columns: 1fr; gap: 36px; }
    .section { padding-top: 72px; }
    .strip { gap: 6px 22px; }
    .strip-label { width: 100%; }
}

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