:root {
    --primary: #2d3032;
    --secondary: #ffffff;
    --grey: #969899;
    --accent: #C0FFFF;
    --accent-grey: #779899;
    --line: #454749;
    --measure: 42rem;
    --gutter: clamp(1.75rem, 3.5vw, 3rem);
}

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

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

body {
    margin: 0;
    background-color: var(--primary);
    color: var(--secondary);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-grey);
}

/* ---------- Home layout ---------- */

.wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 5vw, 5rem);
    gap: 0;
}

.identity {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    text-align: right;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    padding-right: var(--gutter);
}

/* Vertical divider: crisp white beside the name/icons, fading to grey top and bottom */
.identity::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: linear-gradient(
        to bottom,
        var(--line) 0%,
        var(--secondary) 50%,
        var(--line) 100%
    );
}

.identity h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: normal;
    margin: 0;
    line-height: 1.1;
}

.icons {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    justify-content: flex-end;
}

.icon {
    width: 1.75rem;
    height: 1.75rem;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.icon:hover {
    filter: brightness(70%);
    transform: translateY(-2px);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.75rem;
    padding: 3rem 0 3rem var(--gutter);
    min-width: 0;
}

/* Collapsible section heading (details/summary) */
.block-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    margin: 0 0 0.75rem;
    color: var(--grey);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 0.2s ease;
}

.block-title::-webkit-details-marker {
    display: none;
}

.block-title:hover {
    color: var(--secondary);
}

.block-title h2 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.6;
    color: inherit;
}

/* Custom disclosure triangle that rotates when the section is open */
.block-title::before {
    content: "";
    flex: none;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0.3rem 0 0.3rem 0.4rem;
    border-color: transparent transparent transparent currentColor;
    transition: transform 0.2s ease;
}

.block[open] > .block-title::before {
    transform: rotate(90deg);
}

.block-body {
    max-width: var(--measure);
}

.block-body > p {
    margin: 0 0 0.5rem;
}

.block-body > p:last-child {
    margin-bottom: 0;
}

.block-note {
    color: var(--grey);
    font-size: 0.9rem;
}

.block-body > .block-note {
    margin: 0 0 0.75rem;
}

.rss-link {
    margin: -0.35rem 0 0.75rem;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.rss-link a {
    color: var(--grey);
}

.rss-link a:hover {
    color: var(--accent);
}

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: var(--measure);
}

.list li {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.list li:first-child {
    padding-top: 0;
}

.list li:last-child {
    border-bottom: none;
}

.list li a {
    font-size: 1.2rem;
}

/* Grey out the ".zaki.me" part of a tool link, keeping the subdomain accent-coloured */
.tld {
    color: var(--grey);
}

.list-empty {
    color: var(--grey);
}

.list-note {
    display: block;
    color: var(--grey);
    font-size: 0.95rem;
    margin-top: 0.15rem;
}

/* Plain link list: no separators, no notes, tight spacing */
.list--plain li {
    padding: 0.2rem 0;
    border-bottom: none;
}

.list--plain li a {
    font-size: 1.05rem;
}

/* ---------- Writing / blog pages ---------- */

.post {
    max-width: var(--measure);
    margin: 0 auto;
    padding: clamp(2.5rem, 8vw, 5rem) clamp(1.25rem, 5vw, 2rem);
}

.post .back {
    display: inline-block;
    color: var(--grey);
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

.post .back:hover {
    color: var(--accent);
}

.post-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.post h1 {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    font-weight: normal;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

.post-date {
    color: var(--grey);
    font-size: 0.95rem;
}

.post-body {
    font-size: 1.08rem;
    line-height: 1.75;
}

.post-body p,
.post-body ul,
.post-body ol {
    margin: 0 0 1.4rem;
}

.post-body h2 {
    font-size: 1.4rem;
    font-weight: normal;
    margin: 2.5rem 0 1rem;
}

.post-body h3 {
    font-size: 1.15rem;
    font-weight: bold;
    margin: 2rem 0 0.75rem;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

.post-body li {
    margin-bottom: 0.5rem;
}

.post-body blockquote {
    margin: 1.6rem 0;
    padding-left: 1.2rem;
    border-left: 3px solid var(--accent-grey);
    color: var(--grey);
}

.post-body code {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.post-body pre {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 0 0 1.4rem;
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    color: var(--grey);
    font-size: 0.95rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
    .wrapper {
        flex-direction: column;
        gap: 0;
        padding: 0 1.5rem;
        min-height: 0;
    }

    .identity {
        position: static;
        height: auto;
        flex: none;
        width: fit-content;
        align-self: center;
        align-items: flex-end;
        text-align: right;
        padding: 2.5rem 0 2rem;
    }

    .identity::after {
        display: none;
    }

    .icons {
        gap: 0.8rem;
    }

    .icon {
        width: 1.4rem;
        height: 1.4rem;
    }

    .icon:hover {
        transform: none;
        filter: none;
    }

    .content {
        justify-content: flex-start;
        padding: 2.5rem 0 3.5rem;
        gap: 1.75rem;
        position: relative;
    }

    /* Horizontal divider: same grey→white→grey fade as the desktop vertical rule */
    .content::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(
            to right,
            var(--line) 0%,
            var(--secondary) 50%,
            var(--line) 100%
        );
    }

    .block-body,
    .list {
        max-width: none;
    }
}
