/* The site's console look — a transfer-dialog: black field, hairline grid, one mono
   face, no colour. Built for the homepage; courses, community and the quiz sit on the
   same sheet (see "Sub-pages" below). */
:root {
    --bg: var(--palette-surface-0c0c0c);
    --line: var(--palette-line-2a2a2a);
    --ink: var(--palette-fg-f2f2f2);
    --text: var(--palette-fg-c4c4c4);
    --dim: var(--palette-fg-858585);
    --ghost: var(--palette-grid-3a3a3a);
    --col-a: 220px;
    --col-c: 280px;
    --mono: 'Carbon', 'IBM Plex Mono', Menlo, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color-scheme: var(--reading-scheme, dark);
}

body {
    font-family: var(--mono);
    font-size: calc((14.5px) * var(--text-scale, 1));
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
}

:focus-visible {
    outline: 1px solid var(--ink);
    outline-offset: 3px;
}

/* Site nav, dark */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 70;
    background: var(--palette-surface-rgba-12-12-12-88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.site-nav .sn-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.site-nav a {
    font-size: calc((12px) * var(--text-scale, 1));
    letter-spacing: .16em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--dim);
    transition: color .2s;
}

.site-nav .sn-brand,
.site-nav a:hover,
.site-nav .sn-links a.on {
    color: var(--ink);
}

.site-nav .sn-links {
    display: flex;
    gap: 26px;
}

/* Frame */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 72px 40px 56px;
}

.label {
    font-size: calc((12px) * var(--text-scale, 1));
    font-weight: 400;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink);
}

.small {
    font-size: calc((11px) * var(--text-scale, 1));
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
}

.dots i {
    font-style: normal;
    animation: blink 1.4s steps(1) infinite;
}

.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0%, 60% { opacity: 1; }
    61%, 100% { opacity: .15; }
}

/* The panel: identity row over commit activity + actions, drawn with shared hairlines */
.panel {
    display: grid;
    grid-template-columns: var(--col-a) minmax(0, 1fr) var(--col-c);
    grid-template-areas:
        "a b c"
        "g g f";
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.cell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 22px 24px 24px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    animation: cell-in .7s cubic-bezier(.2, .7, .2, 1) both;
}

.c-a { grid-area: a; }
.c-b { grid-area: b; animation-delay: .06s; }
.c-c { grid-area: c; animation-delay: .12s; }
.c-g { grid-area: g; animation-delay: .18s; }
.c-f { grid-area: f; animation-delay: .24s; }

@keyframes cell-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.cell .foot {
    margin-top: auto;
    padding-top: 20px;
}

/* A — portrait inside the loader ring */
.profile-photo {
    position: relative;
    width: 168px;
    height: 168px;
    margin: 14px auto 0;
}

.profile-photo svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    stroke: var(--ink);
    stroke-width: 2.3;
    stroke-linecap: round;
    animation: ring 4s steps(40) infinite;
}

@keyframes ring {
    to { transform: rotate(360deg); }
}

/* offline: the loader stops and the cell goes quiet */
.is-offline .dots {
    display: none;
}

.is-offline .profile-photo svg {
    animation: none;
    opacity: .3;
}

.is-offline .profile-photo img {
    opacity: .55;
}

/* the doodle is black ink on white; invert(.953) lands its paper exactly on --bg */
.profile-photo img {
    position: absolute;
    inset: 24px;
    width: calc(100% - 48px);
    height: calc(100% - 48px);
    border-radius: 50%;
    object-fit: cover;
    filter: invert(.953);
}

/* B — identity + year bar */
/* sized so "Anand Jigmedsanjaa (AJ)" holds one line on desktop; when it must wrap,
   the nbsp in the markup keeps "(AJ)" with the surname */
.header-info h1 {
    margin-top: 14px;
    font-size: calc((clamp(24px, 2.7vw, 30px)) * var(--text-scale, 1));
    font-weight: 400;
    letter-spacing: -.01em;
    line-height: 1.15;
    color: var(--ink);
}

.tagline {
    margin-top: 6px;
    font-size: calc((12px) * var(--text-scale, 1));
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
}

.bar {
    position: relative;
    height: 38px;
    margin-top: 26px;
    color: var(--ghost);
    background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px);
}

.bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--p, 0%);
    color: var(--ink);
    background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px);
    animation: fill 1.5s steps(36) .5s both;
}

@keyframes fill {
    from { width: 0; }
}

.bar-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: calc((13px) * var(--text-scale, 1));
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink);
}

/* C — clock readout */
.readout {
    margin-top: 6px;
    font-size: calc((27px) * var(--text-scale, 1));
    letter-spacing: .02em;
    line-height: 1.3;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.c-c .foot {
    color: var(--ink);
    font-size: calc((17px) * var(--text-scale, 1));
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* F — actions */
.actions {
    display: grid;
    gap: 7px;
    margin-top: 14px;
}

.actions a {
    display: block;
    padding: 7px 12px;
    border: 1px solid var(--dim);
    font-size: calc((13px) * var(--text-scale, 1));
    letter-spacing: .1em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    color: var(--ink);
    transition: background .15s, color .15s, border-color .15s;
}

.actions a:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

/* G — commit activity: GitHub's green-on-white chart, inverted to grey-on-black */
.c-g .head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.c-g .head a {
    text-decoration: none;
}

.c-g .head a:hover {
    color: var(--ink);
}

.github-chart {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 22px;
    filter: invert(1) grayscale(1) brightness(1.5);
}

.legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.legend .scale {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend .scale i {
    width: 9px;
    height: 9px;
    background: var(--ink);
}

.legend .scale i:nth-child(1) { opacity: .1; margin-left: 4px; }
.legend .scale i:nth-child(2) { opacity: .3; }
.legend .scale i:nth-child(3) { opacity: .5; }
.legend .scale i:nth-child(4) { opacity: .75; }
.legend .scale i:nth-child(5) { margin-right: 4px; }

/* Process log — the experience list, on the panel's column lines */
.experience,
.sheet {
    margin-top: 56px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    animation: cell-in .7s cubic-bezier(.2, .7, .2, 1) .42s both;
}

.log-head {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.experience-item {
    display: grid;
    grid-template-columns: var(--col-a) minmax(0, 1fr) 150px;
}

.experience-item > * {
    padding: 20px 24px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.experience-date {
    font-size: calc((11.5px) * var(--text-scale, 1));
    letter-spacing: .08em;
    line-height: 1.7;
    text-transform: uppercase;
    color: var(--ink);
}

.experience-date span {
    display: block;
    color: var(--dim);
}

.experience-item p strong {
    font-weight: 500;
    color: var(--ink);
}

.status {
    font-size: calc((11.5px) * var(--text-scale, 1));
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
    white-space: nowrap;
}

.is-active .status {
    color: var(--ink);
}

.live-dot,
.past-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 9px;
    vertical-align: 1px;
    border: 1px solid var(--dim);
}

.live-dot {
    border-color: var(--ink);
    background: var(--ink);
    animation: blink 1.4s steps(1) infinite;
}

.is-past p {
    color: var(--dim);
}

.is-past p strong {
    color: var(--text);
}

.is-past .experience-date {
    color: var(--text);
}

.colophon {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
}

@media (max-width: 900px) {
    :root {
        --col-a: 190px;
        --col-c: 230px;
    }

    .profile-photo {
        width: 142px;
        height: 142px;
    }

    .profile-photo img {
        inset: 20px;
        width: calc(100% - 40px);
        height: calc(100% - 40px);
    }

    .readout {
        font-size: calc((23px) * var(--text-scale, 1));
    }
}

@media (max-width: 720px) {
    .site-nav .sn-inner {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 6px 16px;
    }

    .site-nav .sn-links {
        gap: 11px;
        flex-wrap: wrap;
    }

    .site-nav a {
        font-size: calc((10.5px) * var(--text-scale, 1));
        letter-spacing: .07em;
    }

    .container {
        padding: 28px 16px 40px;
    }

    .panel {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "a c"
            "b b"
            "g g"
            "f f";
    }

    .cell {
        min-height: 0;
        padding: 16px 16px 18px;
    }

    .c-a,
    .c-c {
        min-height: 196px;
    }

    .profile-photo {
        width: min(128px, 100%);
        height: auto;
        aspect-ratio: 1;
    }

    .profile-photo img {
        inset: 14%;
        width: 72%;
        height: 72%;
    }

    .header-info h1 {
        font-size: calc((clamp(22px, 7.4vw, 28px)) * var(--text-scale, 1));
    }

    .readout {
        font-size: calc((clamp(15px, 5.3vw, 20px)) * var(--text-scale, 1));
    }

    .c-c .foot {
        font-size: calc((13px) * var(--text-scale, 1));
    }

    .c-g {
        overflow: hidden;
    }

    .actions {
        grid-template-columns: 1fr 1fr;
    }

    .actions a:first-child {
        grid-column: 1 / -1;
    }

    .experience {
        margin-top: 36px;
    }

    .log-head {
        padding: 14px 16px;
    }

    .experience-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .experience-item > * {
        padding: 14px 16px;
    }

    .experience-date {
        border-right: 0;
        border-bottom: 0;
        padding-bottom: 0;
    }

    .status {
        order: 2;
        border-bottom: 0;
        padding-bottom: 0;
    }

    .experience-item p {
        order: 3;
        grid-column: 1 / -1;
        padding-top: 8px;
    }
}

/* ── Sub-pages (courses, community, quiz) ─────────────────────────────────────
   Same cells, same hairlines. A page opens with a two-cell .panel.duo, then
   stacks .sheet blocks: a .log-head, then rows that share the sheet's borders. */
.panel.duo {
    grid-template-columns: minmax(0, 1fr) var(--col-c);
    grid-template-areas: none;
}

.panel.duo .cell:nth-child(2) { animation-delay: .06s; }

.header-info .sub {
    margin-top: 16px;
    max-width: 60ch;
}

.log-head {
    gap: 16px;
}

.log-head h2 {
    font-weight: 400;
}

.log-head .small {
    flex-shrink: 0;
    white-space: nowrap;
}

.sheet-row {
    padding: 20px 24px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.sheet-row.lede {
    max-width: none;
    color: var(--text);
}

.sheet-row.punch {
    font-size: calc((16px) * var(--text-scale, 1));
    color: var(--ink);
}

.sheet-row.links a,
.status a:not(.btn),
.colophon a {
    color: var(--ink);
    text-decoration: none;
}

.colophon a {
    color: inherit;
    margin-left: 18px;
}

.sheet-row.links a:hover,
.status a:not(.btn):hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.colophon a:hover {
    color: var(--ink);
}

/* wide-status: the third column sits on the panel's right-hand line */
@media (min-width: 721px) {
    .sheet.wide .experience-item {
        grid-template-columns: var(--col-a) minmax(0, 1fr) var(--col-c);
    }
}

a.experience-item {
    text-decoration: none;
    transition: background .15s;
}

a.experience-item:hover {
    background: var(--palette-surface-rgba-255-255-255-035);
}

.status .soon {
    color: var(--dim);
}

/* key / value rows: the <strong> is the key cell, the rest of the line the value */
.kv-list {
    list-style: none;
}

.kv-list li > span {
    display: grid;
    grid-template-columns: var(--col-a) minmax(0, 1fr);
    column-gap: 24px;
    padding: 20px 24px 22px 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.kv-list li strong {
    margin: -20px 0 -22px;
    padding: 20px 24px 22px;
    border-right: 1px solid var(--line);
    font-size: calc((11.5px) * var(--text-scale, 1));
    font-weight: 400;
    letter-spacing: .08em;
    line-height: 1.7;
    text-transform: uppercase;
    color: var(--ink);
}

.kv {
    display: grid;
    grid-template-columns: var(--col-a) minmax(0, 1fr);
}

.kv > * {
    padding: 20px 24px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

/* two columns inside a sheet, split by one hairline */
.two {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.two > div {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.two .sheet-row,
.two .kv-list li > span {
    border-right: 0;
}

.two .kv-list li > span {
    display: block;
    padding: 18px 24px 20px;
}

.two .kv-list li:last-child > span {
    border-bottom: 0;
}

.two .kv-list li strong {
    display: block;
    margin: 0 0 4px;
    padding: 0;
    border: 0;
}

/* buttons: the homepage action, plus a filled one for the single primary CTA */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid var(--dim);
    background: transparent;
    font: inherit;
    font-size: calc((13px) * var(--text-scale, 1));
    letter-spacing: .1em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.btn:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.btn.solid {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.btn.solid:hover {
    background: transparent;
    color: var(--ink);
}

.btn:disabled {
    opacity: .3;
    cursor: not-allowed;
    pointer-events: none;
}

.actions .btn {
    display: block;
}

.tag {
    display: inline-block;
    margin-left: 10px;
    padding: 0 7px;
    border: 1px solid var(--dim);
    font-size: calc((10.5px) * var(--text-scale, 1));
    letter-spacing: .08em;
    line-height: 1.7;
    text-transform: uppercase;
    vertical-align: 2px;
    color: var(--ink);
}

@media (max-width: 720px) {
    .panel.duo {
        grid-template-columns: minmax(0, 1fr);
    }

    .sheet {
        margin-top: 36px;
    }

    .sheet-row,
    .kv > *,
    .two .kv-list li > span {
        padding: 14px 16px;
    }

    .kv-list li > span {
        display: block;
        padding: 14px 16px;
    }

    .kv-list li strong {
        display: block;
        margin: 0 0 4px;
        padding: 0;
        border: 0;
    }

    .kv,
    .two {
        grid-template-columns: minmax(0, 1fr);
    }

    /* wide-status rows stack: date, text, then the links or button */
    .sheet.wide .experience-date {
        grid-column: 1 / -1;
        border-right: 1px solid var(--line);
    }

    .sheet.wide .experience-item p {
        border-bottom: 0;
        padding-bottom: 6px;
    }

    .sheet.wide .status {
        order: 4;
        grid-column: 1 / -1;
        padding-top: 6px;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--line);
        white-space: normal;
    }

    .colophon a {
        margin-left: 12px;
    }
}

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