/* ==========================================================================
   Zain Siddavatam — a small personal site with a 2000s pulse.
   One direction: pale blue tiled page, white panels, boxed widgets,
   Trebuchet headings, Verdana body, Courier labels.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
    --font-heading: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode",
        Verdana, sans-serif;
    --font-body: Verdana, Geneva, "DejaVu Sans", sans-serif;
    --font-mono: "Courier New", Courier, monospace;

    --page-bg: #f3e3d2;
    --grid-line: rgba(255, 255, 255, 0.5);
    --panel: #fffdf9;
    --panel-soft: #fdf6ee;
    --panel-tint: #f9eadb;
    --heading: #4a2a14;
    --fg: #2a211a;
    --fg-soft: #4a3a2d;
    --muted: #7c6654;
    --line: #dcc3ab;
    --line-strong: #bd9a78;
    --link: #0033cc;
    --link-visited: #663399;
    --link-hover: #cc0000;
    --accent: #a8541f;

    --header-grad-a: #fdf4e8;
    --header-grad-b: #f2dcc4;
    --shadow-hard: 2px 2px 0 rgba(120, 80, 40, 0.16);
    --shadow-photo: 3px 3px 0 rgba(120, 80, 40, 0.2);
    --shadow-soft: 1px 1px 0 rgba(120, 80, 40, 0.16);
    --shadow-nav: 0 3px 0 rgba(120, 80, 40, 0.12);

    --max-width: 1000px;
    --sidebar-w: 196px;
    --gap: 18px;
    --gutter: 16px;
    --header-h: 46px;
    --toolbar-h: 44px;
    --text-width: 68ch;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */

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

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

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

body {
    margin: 0;
    background-color: var(--page-bg);
    background-image: linear-gradient(
            var(--grid-line) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            var(--grid-line) 1px,
            transparent 1px
        );
    background-size: 24px 24px;
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
}

body.lightbox-open,
body.nav-open {
    overflow: hidden;
}

::selection {
    background: var(--panel-tint);
    color: var(--fg);
}

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

a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:visited {
    color: var(--link-visited);
}

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

button {
    font: inherit;
    color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading);
}

p {
    margin: 0 0 1em;
}

ul,
ol {
    margin: 0;
    padding: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 4px;
    left: 4px;
    z-index: 999;
    padding: 6px 10px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    color: var(--link);
    font-family: var(--font-mono);
    font-size: 11px;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.icon {
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon [fill="currentColor"] {
    fill: currentColor;
    stroke: none;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.site-header {
    position: relative;
    z-index: 100;
    background: linear-gradient(var(--header-grad-a), var(--header-grad-b));
    border-bottom: 1px solid var(--line-strong);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(var(--max-width), 100% - 2 * var(--gutter));
    height: var(--header-h);
    margin-inline: auto;
}

.primary-nav {
    display: flex;
    align-items: center;
    min-width: 0;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
}

.primary-nav a {
    padding: 4px 0;
    color: var(--link);
    text-decoration: underline;
}

.primary-nav a:visited {
    color: var(--link);
}

.primary-nav a + a {
    margin-left: 11px;
    padding-left: 11px;
    border-left: 1px solid var(--line);
}

.primary-nav a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.primary-nav a[aria-current="page"] {
    color: var(--heading);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}

.header-updated {
    letter-spacing: 0.02em;
}

.header-rss {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: var(--link);
}

.nav-toggle {
    display: none;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--link);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.nav-toggle:hover {
    background: var(--panel-tint);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.site-wrap {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
    width: min(var(--max-width), 100% - 2 * var(--gutter));
    margin: 20px auto 0;
}

.site-wrap--single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 900px;
}

.main-panel {
    min-width: 0;
    padding: 22px 26px 30px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-hard);
}

/* --------------------------------------------------------------------------
   Sidebar widgets
   -------------------------------------------------------------------------- */

.sidebar {
    min-width: 0;
}

.widget {
    margin-bottom: 16px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    margin: 0;
    padding: 5px 8px;
    background: linear-gradient(var(--header-grad-a), var(--header-grad-b));
    border-bottom: 1px solid var(--line-strong);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--heading);
}

.widget-body {
    padding: 8px 9px 10px;
}

.widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-list li {
    position: relative;
    margin: 0 0 5px;
    padding-left: 12px;
    font-size: 11px;
    line-height: 1.45;
}

.widget-list li:last-child {
    margin-bottom: 0;
}

.widget-list li::before {
    content: "»";
    position: absolute;
    top: 0;
    left: 0;
    color: var(--line-strong);
    font-size: 10px;
}

.widget-list--plain li::before {
    content: "·";
}

.widget-list a {
    color: var(--link);
}

.widget-list a:visited {
    color: var(--link-visited);
}

.widget-handle {
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
}

.widget-count {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.widget-note {
    margin: 10px 0 0;
    padding-top: 8px;
    border-top: 1px dotted var(--line);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.5;
}

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

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 24px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px dotted var(--line-strong);
}

.home-copy {
    min-width: 0;
}

.home-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4.4vw, 2.9rem);
    line-height: 1.02;
    letter-spacing: -0.01em;
}

.home-line {
    min-height: 1.5em;
    margin: 0 0 14px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--fg-soft);
}

.typed {
    color: var(--accent);
}

.typed-cursor {
    color: var(--accent);
    font-weight: 400;
}

.home-intro {
    margin: 0;
    color: var(--fg-soft);
    font-size: 13px;
    line-height: 1.7;
}

.home-figure {
    min-width: 0;
    margin: 0;
}

.home-photo {
    aspect-ratio: 4 / 5;
    padding: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-photo);
    transform: rotate(-1.2deg);
}

.home-photo picture,
.home-photo img {
    width: 100%;
    height: 100%;
}

.home-photo img {
    object-fit: cover;
    object-position: 42% 28%;
}

.home-figure figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    text-align: center;
}

/* Boxed section (Now) */

.box {
    margin-top: 22px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-hard);
}

.box-head {
    margin: 0;
    padding: 6px 10px;
    background: linear-gradient(var(--header-grad-a), var(--header-grad-b));
    border-bottom: 1px solid var(--line-strong);
    font-size: 12px;
    font-weight: 700;
    color: var(--heading);
}

.box-body {
    padding: 10px 14px;
}

.now-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.now-list li {
    position: relative;
    padding: 7px 0 7px 16px;
    border-bottom: 1px dotted var(--line);
    font-size: 13px;
}

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

.now-list li::before {
    content: "▪";
    position: absolute;
    top: 8px;
    left: 0;
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   Page headers
   -------------------------------------------------------------------------- */

.page-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.page-header h1,
.error-page h1 {
    margin: 0;
    font-size: clamp(1.7rem, 3.6vw, 2.35rem);
    line-height: 1.15;
}

.lede {
    max-width: 60ch;
    margin: 10px 0 0;
    color: var(--fg-soft);
    font-size: 13px;
    line-height: 1.65;
}

.page-actions {
    margin: 14px 0 0;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
}

.page-actions a {
    color: var(--link);
}

/* --------------------------------------------------------------------------
   Blog index
   -------------------------------------------------------------------------- */

.blog-page {
    min-width: 0;
}

.year-group {
    margin-top: 22px;
}

.year-label {
    display: inline-block;
    margin: 0 0 8px;
    padding: 2px 8px;
    background: var(--panel-tint);
    border: 1px solid var(--line-strong);
    font-size: 11px;
    font-weight: 700;
    color: var(--heading);
}

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

.post-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: baseline;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    color: var(--fg);
    text-decoration: none;
}

.post-row:visited {
    color: var(--fg);
}

.post-row:hover {
    background: var(--panel-soft);
}

.post-row time {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
}

.post-row-main {
    min-width: 0;
}

.post-row-title {
    display: block;
    color: var(--link);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: underline;
}

.post-row:visited .post-row-title {
    color: var(--link-visited);
}

.post-row:hover .post-row-title {
    color: var(--link-hover);
}

.post-row-excerpt {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.post-row-meta {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    white-space: nowrap;
}

.empty-state {
    margin: 22px 0;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Post
   -------------------------------------------------------------------------- */

.post {
    min-width: 0;
}

.post-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    color: var(--link);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.post-meta {
    margin: 0 0 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.post-header h1 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 3.6vw, 2.25rem);
    line-height: 1.15;
}

.post-header .lede {
    margin-top: 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.tag-list li {
    padding: 2px 6px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
}

.prose {
    max-width: var(--text-width);
    font-size: 13.5px;
    line-height: 1.7;
}

.prose p {
    margin: 0 0 1.2em;
}

.prose h2 {
    margin: 1.8em 0 0.6em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--line);
    font-size: 1.35rem;
}

.prose h3 {
    margin: 1.5em 0 0.5em;
    font-size: 1.1rem;
}

.prose h4 {
    margin: 1.3em 0 0.4em;
    font-size: 1rem;
}

.prose a {
    color: var(--link);
    text-decoration: underline;
}

.prose a:visited {
    color: var(--link-visited);
}

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

.prose ul,
.prose ol {
    margin: 0 0 1.2em;
    padding-left: 1.4em;
}

.prose li {
    margin-bottom: 0.3em;
}

.prose li::marker {
    color: var(--accent);
}

.prose img {
    height: auto;
    margin: 1.5em 0;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--line-strong);
}

.prose blockquote {
    margin: 1.5em 0;
    padding: 0.5em 12px;
    background: var(--panel-soft);
    border-left: 3px solid var(--line-strong);
    color: var(--fg-soft);
}

.prose blockquote p:last-child {
    margin-bottom: 0;
}

.prose hr {
    margin: 2em 0;
    border: 0;
    border-top: 1px dotted var(--line-strong);
}

.prose code {
    padding: 1px 4px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.prose pre {
    margin: 1.4em 0;
    padding: 12px;
    overflow-x: auto;
    background: var(--code-bg, var(--panel-soft));
    border: 1px solid var(--line-strong);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
}

.prose pre code {
    padding: 0;
    background: none;
    border: 0;
    font-size: inherit;
}

.prose .table-wrapper {
    margin: 1.4em 0;
    overflow-x: auto;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.prose th,
.prose td {
    padding: 6px 8px;
    border: 1px solid var(--line);
    text-align: left;
}

.prose th {
    background: var(--panel-tint);
    font-family: var(--font-heading);
    font-size: 11px;
}

.post-neighbors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.post-neighbors--single {
    grid-template-columns: 1fr;
}

.post-neighbor {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    text-decoration: none;
}

.post-neighbor:visited {
    color: var(--fg);
}

.post-neighbor--next {
    align-items: flex-end;
    text-align: right;
}

.post-neighbor:hover {
    background: var(--panel-tint);
    border-color: var(--line-strong);
}

.post-neighbor-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
}

.post-neighbor-title {
    color: var(--link);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: underline;
}

.post-neighbor:hover .post-neighbor-title {
    color: var(--link-hover);
}

.comments {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.comments-head h2 {
    font-size: 1.2rem;
}

.comments-head p {
    color: var(--muted);
    font-size: 12px;
}

.giscus {
    margin-top: 12px;
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: var(--progress, 0%);
    height: 2px;
    background: var(--accent);
    transition: width 0.1s linear;
}

.code-copy {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 3px 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s var(--ease);
}

.prose pre:hover .code-copy,
.code-copy:focus-visible {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Resume / notice
   -------------------------------------------------------------------------- */

.resume-page {
    min-width: 0;
}

.notice {
    margin-top: 20px;
    padding: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--fg-soft);
    font-size: 12px;
}

.notice p:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Error page
   -------------------------------------------------------------------------- */

.error-page {
    padding: 4px 0 20px;
}

.error-page .page-actions {
    margin-top: 18px;
}

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

.site-footer {
    margin-top: 20px;
    padding-bottom: 26px;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px 8px;
    width: min(var(--max-width), 100% - 2 * var(--gutter));
    margin-inline: auto;
    padding: 11px 0 0;
    border-top: 1px solid var(--line-strong);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.5;
}

.footer-inner a {
    color: var(--link);
}

.footer-name {
    color: var(--heading) !important;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.footer-sep {
    color: var(--line-strong);
}

.footer-copy {
    color: var(--muted);
}

body.page-resume .footer-inner,
body.page-error .footer-inner {
    max-width: 900px;
}

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

@media (max-width: 860px) {
    .site-wrap {
        grid-template-columns: minmax(0, 1fr);
        margin-top: 12px;
    }

    .main-panel {
        order: 1;
    }

    .sidebar {
        order: 2;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .widget {
        margin-bottom: 0;
    }

    .home-hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .home-photo {
        aspect-ratio: 4 / 3;
        max-height: 60vh;
        transform: none;
    }

    .home-photo img {
        object-position: 45% 32%;
    }
}

@media (max-width: 760px) {
    :root {
        --header-h: 44px;
        --toolbar-h: 42px;
    }

    .header-inner {
        gap: 8px;
    }

    .header-updated {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .primary-nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        z-index: 99;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 4px var(--gutter) 10px;
        background: var(--panel);
        border-bottom: 1px solid var(--line-strong);
        box-shadow: var(--shadow-nav);
    }

    .site-header[data-open="true"] .primary-nav {
        display: flex;
    }

    .primary-nav a {
        padding: 8px 2px;
        border-bottom: 1px solid var(--line);
    }

    .primary-nav a + a {
        margin-left: 0;
        padding-left: 2px;
        border-left: 0;
    }

    .primary-nav a:last-child {
        border-bottom: 0;
    }

    .main-panel {
        padding: 16px 15px 22px;
    }

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

    .home-title {
        font-size: clamp(2rem, 11vw, 2.8rem);
    }

    .post-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
        padding: 10px 6px;
    }

    .post-row-meta {
        text-align: left;
    }

    .post-neighbors {
        grid-template-columns: 1fr;
    }

    .post-neighbor--next {
        align-items: flex-start;
        text-align: left;
    }

    .footer-inner {
        font-size: 9px;
    }
}

@media (max-width: 420px) {
    .home-title {
        font-size: 2rem;
    }

    .box-body {
        padding: 8px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
