:root {
    color-scheme: light;
    --paper: #f6f5ef;
    --ink: #1b1b20;
    --muted: #4e4e57;
    --rule: #cfcdc5;
    --blue: #2939ec;
    --blue-text: #2330bf;
    --blue-pale: #e8eafa;
    --mono: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --gutter: clamp(1.1rem, 4.5vw, 5rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 1rem/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; }
button { font: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul { margin: 0; }
[id] { scroll-margin-top: 6.25rem; }
:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 4px; }
::selection { background: var(--blue); color: white; }

.shell {
    width: min(calc(100% - 2 * var(--gutter)), 83rem);
    margin-inline: auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    z-index: 5;
    top: .75rem;
    left: 1rem;
    padding: .5rem .85rem;
    background: var(--ink);
    color: white;
    transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.navigation {
    min-height: 4.65rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    justify-self: start;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 750;
    letter-spacing: -.035em;
}

.brand-avatar {
    flex: none;
    width: 2rem;
    aspect-ratio: 1;
    background: url("../assets/images/danial-sprite.webp") center 8% / 162% no-repeat;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 2.4rem);
}
.nav-links a, .footer-bottom a {
    font-weight: 630;
    text-decoration: none;
}
.nav-links a:hover { color: var(--blue-text); text-decoration: underline; text-underline-offset: .3em; }
.resume-link { justify-self: end; }

.button, .menu-toggle, .copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 2.95rem;
    padding: .55rem 1.15rem;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    font-weight: 680;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.button:hover, .menu-toggle:hover { background: var(--ink); color: var(--paper); }
.button-small { min-height: 2.55rem; padding: .48rem .85rem; font-size: .9rem; }
.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: var(--blue); border-color: var(--blue); color: white; }

.text-link {
    font-weight: 690;
    text-decoration: underline;
    text-decoration-color: #888793;
    text-underline-offset: .24em;
}
.text-link:hover { color: var(--blue-text); text-decoration-color: currentColor; }

.hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 6.5rem);
    padding-block: clamp(2.7rem, 5vw, 4.7rem);
}

.meta, .timeline-date {
    color: var(--muted);
    font: .87rem/1.5 var(--mono);
}
.hero-location {
    color: var(--blue-text);
    font-weight: 650;
    letter-spacing: .025em;
}
.hero h1 {
    margin: .65rem 0 1.8rem;
    font-size: clamp(5.35rem, 9vw, 8.7rem);
    font-weight: 800;
    line-height: .87;
    letter-spacing: -.067em;
}
.hero h1 span { display: block; }
.hero-role {
    font-size: clamp(1.4rem, 3vw, 2.25rem);
    font-weight: 680;
    line-height: 1.15;
    letter-spacing: -.055em;
}
.hero-description {
    max-width: 30rem;
    margin-top: .8rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.4vw, 1.15rem);
}
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.25rem; margin-top: 1.65rem; }

.hero-art {
    display: grid;
    place-items: center;
}
.hero-art img {
    width: min(100%, 29rem);
    height: auto;
}

.section { padding-block: clamp(3.4rem, 7vw, 7rem); }
.section-heading { margin-bottom: clamp(1.7rem, 3vw, 3rem); }
.section h2, .contact h2 {
    font-size: clamp(2.7rem, 6vw, 6rem);
    font-weight: 780;
    line-height: .98;
    letter-spacing: -.075em;
}
h3 { font-size: clamp(1.19rem, 2vw, 1.5rem); line-height: 1.18; letter-spacing: -.035em; }

.skills-section { background: var(--blue-pale); border-block: 1px solid #d1d5f4; }
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-block: 1px solid #a9ade1;
}
.skills-grid article { padding-block: 1.35rem 1.55rem; }
.skills-grid article + article { border-left: 1px solid #a9ade1; padding-left: clamp(1rem, 2.4vw, 2rem); }
.skills-grid article:not(:last-child) { padding-right: clamp(1rem, 2.4vw, 2rem); }
.skills-grid p { color: var(--muted); margin-block: .42rem .8rem; }
.skill-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .95rem;
    list-style: none;
    padding: 0;
    color: var(--blue-text);
    font: 650 .875rem/1.5 var(--mono);
}
.skill-tools li { display: inline-flex; align-items: center; gap: .35rem; }
.skill-tools img { flex: none; width: 1.05rem; height: 1.05rem; object-fit: contain; }

.projects-section { border-top: 1px solid var(--rule); }
.section-intro {
    max-width: 44rem;
    margin-top: .85rem;
    color: var(--muted);
    font-size: 1.0625rem;
}

.project-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem 1rem;
    margin-bottom: clamp(1.4rem, 3vw, 2.3rem);
}
.project-filters, .project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .85rem; }
.project-filters { gap: .4rem; }
.project-filters button {
    min-height: 2.7rem;
    padding: .45rem .8rem;
    border: 1px solid var(--rule);
    background: var(--paper);
    color: var(--ink);
    font-size: .9rem;
    font-weight: 650;
    cursor: pointer;
}
.project-filters button:hover { border-color: var(--ink); }
.project-filters button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.project-count { white-space: nowrap; }
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3.25rem clamp(1.35rem, 3vw, 3rem);
}
.project-card { display: flex; flex-direction: column; min-width: 0; }
.project-compact { border-top: 1px solid var(--rule); }

.project-visual {
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    place-items: center;
    aspect-ratio: 1.95;
    overflow: hidden;
}
a.project-visual img { transition: scale 220ms ease; }
a.project-visual:hover img { scale: 1.025; }
.project-atlas, .project-tourism { padding: 4%; }
.project-atlas { background: #e4ece9; }
.project-tourism { background: #e8edf0; }
.project-visual img { width: 100%; height: 100%; object-fit: contain; }
.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 1.15rem;
}
.project-body h3 { font-size: clamp(1.65rem, 3vw, 3rem); }
.project-category { margin-bottom: .35rem; }
.project-body > p:not(.meta) { color: var(--muted); max-width: 37rem; margin-block: .55rem .9rem; }
.project-body > .project-insight {
    margin-top: 0;
    padding-left: .85rem;
    border-left: 2px solid var(--rule);
}
.project-insight strong { display: block; color: var(--ink); }
.project-tools { margin-block: auto 1rem; }

.project-archive { margin-top: clamp(2.4rem, 5vw, 4rem); border-block: 1px solid var(--rule); }
.project-archive summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.75rem;
    padding: .65rem .4rem;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}
.project-archive summary::-webkit-details-marker { display: none; }
.project-archive summary:hover { color: var(--blue-text); }
.project-archive summary span::before { content: "+"; color: var(--blue-text); font: 1.4rem/1 var(--mono); }
.project-archive[open] summary span::before { content: "−"; }
.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--rule);
    border-top: 1px solid var(--rule);
}
.archive-grid article { padding: 1.15rem; background: var(--paper); }
.archive-grid .project-category { color: var(--blue-text); margin-bottom: .35rem; font: .85rem/1.5 var(--mono); }
.archive-grid article > p:not(.project-category) { color: var(--muted); }
.archive-grid article > :not(:first-child) { margin-top: .42rem; }
.archive-grid a { display: inline-block; }
.archive-grid a + a { margin-left: .6rem; }

.experience-section { border-block: 1px solid var(--rule); background: #efeee7; }
.timeline { border-top: 1px solid var(--rule); }
.timeline-row {
    display: grid;
    grid-template-columns: minmax(9rem, .32fr) minmax(0, 1fr);
    gap: .5rem 1.5rem;
    padding-block: clamp(1.3rem, 2.9vw, 2rem);
    border-bottom: 1px solid var(--rule);
}
.timeline-date { padding-top: .22rem; }
.timeline-detail h3 { font-size: clamp(1.3rem, 2.4vw, 2rem); }
.organisation { margin-block: .35rem .5rem; font-weight: 650; }
.timeline-detail > p:last-child { color: var(--muted); max-width: 48rem; }

.about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem clamp(1.5rem, 4vw, 4rem);
}
.about-copy, .about-panel { border-top: 1px solid var(--rule); padding-block: 1.3rem .45rem; }
.about-copy { display: flex; gap: 1.25rem; align-items: start; }
.about-copy img { width: clamp(4.25rem, 10vw, 7rem); height: auto; }
.about-copy p, .education-entry p:last-child, .leadership-list span { color: var(--muted); }
.panel-heading { margin-bottom: 1rem; }
.education-entry + .education-entry { margin-top: .9rem; }
.education-entry h4 { margin-top: .2rem; font-size: 1rem; }
.credential-list, .leadership-list { list-style: none; padding: 0; }
.credential-list li + li { margin-top: .35rem; }
.leadership-list li + li { margin-top: .65rem; }
.leadership-list strong { display: block; }

.contact { padding-top: clamp(3rem, 7vw, 6rem); background: var(--ink); color: var(--paper); }
.contact-main {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 1.55rem 2.5rem;
    padding-bottom: clamp(2.2rem, 4.5vw, 3.8rem);
}
.contact h2 { font-size: clamp(3.1rem, 8vw, 8rem); }
.contact p { margin-top: .8rem; color: #d3d1cd; }
.contact :focus-visible { outline-color: #b4bcff; }
.contact .text-link:hover { color: #b4bcff; }
.email-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .55rem 1rem;
}
.email-link {
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 650;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.email-link:hover { text-decoration: underline; }
.copy-button { min-width: 4.6rem; min-height: 2rem; padding: .34rem .55rem; border-color: #a7a5a9; color: var(--paper); font-size: .83rem; }
.copy-button:hover { color: var(--ink); background: var(--paper); }
.social-links { display: flex; flex-wrap: wrap; gap: .45rem 1.05rem; margin-top: .7rem; }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .55rem 1rem;
    padding-block: 1rem;
    border-top: 1px solid #55555b;
    color: #d3d1cd;
    font-size: .9rem;
}
.footer-bottom a:hover { color: white; text-decoration: underline; }

.image-dialog {
    width: min(69rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    padding: clamp(.75rem, 2vw, 1.35rem);
    border: 1px solid var(--rule);
    color: var(--ink);
    background: var(--paper);
    overscroll-behavior: contain;
}
.image-dialog::backdrop { background: #18181cce; }
.dialog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .75rem;
}
.dialog-toolbar h2 { font-size: 1rem; }
.dialog-image { width: auto; max-height: 74dvh; object-fit: contain; margin-inline: auto; }

@media (max-width: 960px) {
    .navigation { gap: .85rem; }
    .hero-layout { gap: 2rem; }
    .hero h1 { font-size: clamp(4.8rem, 11.5vw, 7rem); }
}

@media (max-width: 760px) {
    [id] { scroll-margin-top: 4.85rem; }
    .navigation {
        display: flex;
        position: relative;
        flex-wrap: wrap;
        min-height: 4rem;
        justify-content: space-between;
        gap: .6rem;
        padding-block: .5rem;
    }
    .menu-toggle { margin-left: auto; min-height: 2.6rem; padding: .4rem .64rem; font-size: .9rem; }
    .menu-toggle span { width: .7rem; height: .52rem; border-block: 1px solid currentColor; }
    .nav-links { order: 4; flex: 1 0 100%; flex-wrap: wrap; gap: .3rem 1rem; }
    .nav-links a { display: block; padding: .4rem .1rem; }
    .navigation:has(.menu-toggle:not([hidden])) .nav-links {
        position: absolute;
        z-index: 1;
        inset: 100% 0 auto;
        gap: .2rem .95rem;
        padding: .55rem .8rem;
        background: var(--paper);
        border: 1px solid var(--rule);
    }

    .hero-layout { grid-template-columns: minmax(0, 1fr); padding-top: 2.75rem; }
    .hero h1 { font-size: clamp(3.25rem, 12vw, 6.6rem); line-height: .98; letter-spacing: -.068em; margin-bottom: 1rem; }
    .hero h1 span { display: inline; }
    .hero-art img { width: min(86%, 25rem); }

    .skills-grid { grid-template-columns: minmax(0, 1fr); }
    .skills-grid article + article { border-left: 0; border-top: 1px solid #a9ade1; padding-left: 0; }
    .skills-grid article:not(:last-child) { padding-right: 0; }
    .skills-grid p { max-width: 34rem; margin-bottom: .6rem; }
    .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .contact-main { grid-template-columns: minmax(0, 1fr); }
    .contact-actions { justify-self: start; max-width: 100%; }
}

@media (max-width: 540px) {
    .brand { gap: .4rem; }
    .brand-avatar { width: 1.55rem; }
    .menu-toggle, .resume-link { padding-inline: .55rem; }
    .nav-links a { font-size: .94rem; }
    .hero-actions { gap: .75rem 1rem; }
    .hero-actions .button { padding-inline: .75rem; }
    .project-grid, .archive-grid, .timeline-row, .about-grid { grid-template-columns: minmax(0, 1fr); }
    .project-grid { gap: 2.5rem; }
    .project-visual { aspect-ratio: 1.65; }
    .timeline-date { padding-top: 0; }
}

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