/* Rime: Soft and muted pastels for long sessions. */
/* https://github.com/w0x7y/Rime */
:root {
    /* colour names */
    --rime-bg: #23272e;
    --rime-bg-alt: #2b3038;
    --rime-bg-sel: #3a404b;
    --rime-comment: #6b768c;
    --rime-muted: #9aa4b6;
    --rime-fg: #c3ccd9;
    --rime-fg-bright: #dce2eb;
    --rime-white: #f0f3f8;
    --rime-red: #d98a9c;
    --rime-pink: #e8a8cc;
    --rime-yellow: #e4d098;
    --rime-green: #9ad8ac;
    --rime-cyan: #7cc4d0;
    --rime-blue: #7aa4e4;
    --rime-violet: #bb98d6;
    --rime-steel: #7987a1;
}

/* Rime Frost: Frost-white paper under the same cold accents, deepened to read on it. */
:root[data-theme="light"] {
    color-scheme: light;

    --rime-bg: #eef1f5;
    --rime-bg-alt: #e3e7ee;
    --rime-bg-sel: #d2d8e2;
    --rime-comment: #7f899b;
    --rime-muted: #566073;
    --rime-fg: #363d4a;
    --rime-fg-bright: #272d37;
    --rime-white: #181c23;
    --rime-red: #b83d63;
    --rime-pink: #a34396;
    --rime-yellow: #866405;
    --rime-green: #267b4f;
    --rime-cyan: #0f7480;
    --rime-blue: #2e62c0;
    --rime-violet: #7650c4;
    --rime-steel: #5f7090;
}

:root {
    --profile-width: min(100%, 45rem);
    --hero-width: min(100%, 56rem);
    --dashes: "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
}

@font-face {
    font-family: "Iosevka";
    src: url("../assets/fonts/iosevka-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Iosevka";
    src: url("../assets/fonts/iosevka-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
    scrollbar-width: none;
    accent-color: var(--rime-blue);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    font-family: "Iosevka", ui-monospace, Menlo, Consolas, monospace;
    color: var(--rime-fg);
    padding-inline: 1rem;
    overflow-x: clip;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

html,
body {
    background-color: var(--rime-bg);
}

/* Older Safari ignores scrollbar-width */
::-webkit-scrollbar {
    display: none;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--rime-bg-sel);
    color: var(--rime-fg-bright);
}

:focus-visible {
    outline: 1px dashed var(--rime-blue);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
strong {
    color: var(--rime-fg-bright);
}

a {
    color: var(--rime-blue);
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;

    &:hover {
        color: var(--rime-cyan);
        text-decoration-style: solid;
    }
}

.main-content p a:visited {
    color: var(--rime-violet);
}

.ls-file {
    --ls-color: var(--rime-fg);
}

.ls-dir {
    --ls-color: var(--rime-blue);
}

.ls-exec {
    --ls-color: var(--rime-green);
}

code {
    padding: 0.1em 0.3em;
    background: var(--rime-bg-alt);
    color: var(--rime-green);
}

.hero,
.main-content,
.site-footer {
    width: var(--profile-width);
    margin-inline: auto;
}

.hero {
    --photo-size: 11rem;

    display: grid;
    grid-template-columns: var(--photo-size) minmax(0, 1fr) auto;

    grid-template-areas:
        "picture profile map"
        "nav nav nav"
        "line line line";

    align-items: center;
    gap: 1rem 2rem;
    width: var(--hero-width);
    margin-top: 1rem;

    @media (max-width: 30rem) {
        --photo-size: 7rem;
        column-gap: 1.25rem;
    }

    &::after {
        content: var(--dashes);
        grid-area: line;
        margin-top: -0.5rem;
        overflow: hidden;
        white-space: nowrap;
        line-height: 1;
        color: var(--rime-comment);
    }
}

.profile {
    grid-area: profile;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-picture-wrapper {
    grid-area: picture;
    width: var(--photo-size);
    height: var(--photo-size);
    overflow: hidden;
    background: var(--rime-bg-alt);
}

.pfp {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.profile-name {
    font-size: clamp(2rem, 1rem + 3.25vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.02em;

    /* Small enough to fit the narrow middle column on a phone. */
    @media (max-width: 30rem) {
        font-size: 1.5rem;
    }
}

.profile-handle {
    color: var(--rime-violet);
}

.profile-smiley {
    color: var(--rime-yellow);
}

.profile-about-me {
    margin-top: 0.25rem;
    color: var(--rime-muted);
    text-wrap: balance;
}

.profile-text-israel-map {
    grid-area: map;
    display: flex;
    align-items: center;

    pre {
        margin-inline: 2.5rem;
        font-family: inherit;
        font-size: 0.6rem;
        line-height: 1;
        color: var(--rime-muted);
    }

    @media (max-width: 30rem) {
        flex-direction: column;
        gap: 0.5rem;

        pre {
            margin-inline: 0;
            font-size: 0.45rem;
        }
    }
}

.map-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    line-height: 1.2;

    @media (max-width: 30rem) {
        align-items: center;
    }
}

.map-label-caption {
    font-size: 0.875rem;
    color: var(--rime-yellow);
}

.map-label-place {
    font-size: 1.25rem;
    color: var(--rime-cyan);
}

.nav-row {
    grid-area: nav;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0 2rem;
}

.sparkline {
    display: inline-flex;
    font-size: 0.875rem;
    line-height: 1;

    &:hover {
        opacity: 0.8;
    }

    /* A phone's nav fills the row, so the graph would wrap onto its own line. */
    @media (max-width: 30rem) {
        display: none;
    }
}

.sparkline-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.2em;
    height: 1em;
}

.sparkline-bar {
    width: 0.45em;
    height: calc(var(--level) / 8 * 1em);
    background: var(--rime-green);

    &.is-empty {
        background: var(--rime-comment);
    }
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    font-size: 1.25rem;

    @media (max-width: 30rem) {
        gap: 0.25rem 0.75rem;
        font-size: 0.9375rem;
    }

    a,
    a:hover {
        color: var(--ls-color, var(--rime-fg));
        text-decoration: none;
    }

    a:active {
        opacity: 0.7;
    }

    a:hover {
        text-decoration: underline dotted;
    }

    a[aria-current="page"] {
        text-decoration: underline solid;
    }
}

.main-content {
    flex: 1;
    margin-top: 1rem;

    > * + * {
        margin-top: 0.75rem;
    }

    p,
    li {
        text-wrap: pretty;
    }
}

.prompt {
    font-size: inherit;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.prompt-path {
    color: var(--rime-green);
}

.prompt-symbol {
    color: var(--rime-pink);
}

.prompt-command {
    color: var(--ls-color, var(--rime-blue));
}

.prompt-target {
    color: var(--ls-color, var(--rime-fg-bright));
}

.prompt-error {
    display: block;
    color: var(--rime-red);
}

.status {
    color: var(--rime-muted);
}

.status-loading {
    color: var(--rime-yellow);
}

.repo-list {
    display: grid;
    gap: 1.25rem;
    list-style: none;
}

.repo-head,
.resume-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0 1rem;
}

.repo-meta,
.resume-meta {
    font-size: 0.875rem;
    color: var(--rime-muted);
}

.repo-stars {
    color: var(--rime-yellow);
}

.repo-description {
    max-width: 70ch;
    margin-top: 0.125rem;
    text-wrap: pretty;
}

.commit-date {
    margin-top: 1.25rem;
    font-size: inherit;
    font-weight: 400;
    color: var(--rime-violet);

    &:first-child {
        margin-top: 0;
    }
}

.commit-list {
    margin-top: 0.25rem;
    list-style: none;
}

.commit {
    padding-left: 8ch;
    text-indent: -8ch;
}

.commit-sha {
    color: var(--rime-yellow);
    text-decoration: none;

    &:hover {
        color: var(--rime-yellow);
        text-decoration: underline;
    }
}

.commit-repo {
    color: var(--rime-cyan);
}

.resume-section {
    margin-top: 1.5rem;
}

.resume-name {
    font-size: inherit;

    /* The second value hides the marker from screen readers where supported. */
    &::before {
        content: "# ";
        content: "# " / "";
        color: var(--rime-comment);
    }
}

.resume-contact {
    margin-top: 0.125rem;
    color: var(--rime-comment);
}

.resume-heading {
    font-size: inherit;
    font-weight: 400;
    color: var(--rime-violet);

    &::before {
        content: "## ";
        content: "## " / "";
        color: var(--rime-comment);
    }
}

.resume-entry {
    margin-top: 0.75rem;
}

.resume-title {
    font-size: inherit;
}

.resume-points {
    max-width: 70ch;
    margin-top: 0.25rem;
    list-style: none;

    li {
        padding-left: 2ch;
        text-indent: -2ch;

        &::before {
            content: "- ";
            content: "- " / "";
            color: var(--rime-comment);
        }
    }
}

.resume-label {
    color: var(--rime-cyan);
}

.resume-downloads {
    color: var(--rime-yellow);
}

.socials {
    display: grid;
    gap: 1rem;
}

.socials-list {
    display: grid;
    gap: 0.5rem;
    font-size: 1.25rem;
    list-style: none;

    /* Keeps the longest row (modrinth) on one line. */
    @media (max-width: 30rem) {
        font-size: 1rem;
    }
}

.socials-name {
    display: inline-block;
    min-width: 9ch;
    color: var(--rime-violet);
}

.socials-arrow {
    color: var(--rime-comment);
}

.socials-note {
    font-size: 0.875rem;
    color: var(--rime-muted);
}

.load-more {
    padding: 0.25rem 0.75rem;
    background: none;
    border: 1px dashed var(--rime-comment);
    color: var(--rime-blue);
    cursor: pointer;

    &:hover {
        border-color: var(--rime-blue);
        color: var(--rime-cyan);
    }

    &:disabled {
        cursor: progress;
        opacity: 0.6;
    }
}

.site-footer {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-top: 1rem;
    padding-block: 1.25rem 1.25rem;
    font-size: 0.875rem;
    color: var(--rime-muted);

    &::before {
        content: var(--dashes);
        position: absolute;
        top: 0;
        left: 50%;
        /* As wide as the header above, not the narrower footer. */
        width: min(100vw - 2rem, 56rem);
        transform: translateX(-50%);
        overflow: hidden;
        white-space: nowrap;
        font-size: 1rem;
        line-height: 1;
        color: var(--rime-comment);
    }
}

.theme-switch {
    display: flex;
    gap: 0.5ch;
    color: var(--rime-comment);

    button {
        padding: 0;
        background: none;
        border: none;
        color: var(--rime-muted);
        cursor: pointer;

        &:hover {
            color: var(--rime-blue);
        }

        &[aria-pressed="true"] {
            color: var(--rime-fg-bright);
            text-decoration: underline;
            text-underline-offset: 0.2em;
        }
    }
}

.palette {
    justify-self: end;
    width: 8rem;
    display: flex;
    height: 0.75rem;

    span {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
