/* The plain site: one column, one typeface, black on white, no boxes.
   The 3D world under /64/ keeps its own styles. */

@font-face {
    /* Lilita One, the 3D world's own face, for the "64" alone */
    font-family: 'Lilita One';
    src: url('/assets/fonts/lilita-one-latin.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0030-0039;
}

:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --muted: #6b6b6b;
    --rule: #e4e4e4;
    --accent: #0e6380;          /* the ocean at its surface */
    --accent-hover: #094a60;
    --paper: #ffffff;           /* polaroid frames */
    --table: #f3f1ec;           /* the gallery's tabletop */
    --code-bg: #f4f4f2;
    --max: 46rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121416;
        --text: #e8e6e3;
        --muted: #9b9b9b;
        --rule: #2b2e32;
        --accent: #6cc3df;
        --accent-hover: #a4ddee;
        --table: #1b1e22;
        --code-bg: #1e2124;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

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

img { max-width: 100%; height: auto; }

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ----- top ----- */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1.25rem;
    padding: 1.25rem 0 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.top .brand {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.top ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.1rem;
    margin: 0;
    padding: 0;
}

.top ul a {
    color: var(--text);
    text-decoration: none;
}

.top ul a:hover,
.top ul a[aria-current="page"] { color: var(--accent); }

.top ul a[aria-current="page"] { font-weight: 600; }

/* ----- masthead ----- */
.masthead {
    display: grid;
    grid-template-columns: 1fr 10rem;
    gap: 1rem 2.5rem;
    align-items: start;
    margin: 2.5rem 0 1.25rem;
}

.masthead h1 {
    margin: 0 0 0.4rem;
    font-size: 2.7rem;
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.masthead h1 strong { font-weight: 700; }

.lede {
    margin: 0 0 0.9rem;
    color: var(--muted);
    font-size: 1.1rem;
}

.contact {
    margin: 0;
    font-size: 0.95rem;
}

.contact .sep {
    color: var(--muted);
    padding: 0 0.3rem;
}

.masthead .polaroid {
    --r: 2.5deg;
    width: 100%;
    margin-top: 0.35rem;
}

@media (max-width: 560px) {
    .masthead {
        grid-template-columns: 1fr 7rem;
        gap: 0.75rem 1.25rem;
        margin-top: 1.75rem;
    }

    .masthead h1 { font-size: 2.1rem; }
}

.bio p { margin: 0 0 0.9rem; }

/* ----- sections ----- */
section { margin: 2.75rem 0; }

h2 {
    margin: 0 0 0.9rem;
    font-size: 1.7rem;
    font-weight: 300;
    letter-spacing: -0.01em;
}

.rows {
    display: grid;
    grid-template-columns: 6.75rem 1fr;
    column-gap: 1rem;
    row-gap: 0.5rem;
    margin: 0;
}

.rows time,
.rows .when {
    color: var(--muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rows p { margin: 0; }

.entry { margin: 0 0 1.35rem; }

.entry h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.7rem;
    margin: 0 0 0.25rem;
    font-size: 1.08rem;
    font-weight: 600;
}

.entry h3 .when {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.entry p { margin: 0 0 0.3rem; }

.tags {
    font-size: 0.9rem;
}

.tags a { margin-right: 0.6rem; }

.more {
    margin: 0.9rem 0 0;
    font-size: 0.95rem;
}

/* ----- polaroids (the portrait on the front page, and the gallery) ----- */
.polaroid {
    display: block;
    box-sizing: border-box;
    background: var(--paper);
    padding: 8px 8px 26px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 8px 20px rgba(0, 0, 0, 0.14);
    transform: rotate(var(--r, 0deg));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
    color: #2b2b2b;
}

.polaroid img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #ddd;
}

.polaroid:hover,
.polaroid:focus-visible {
    transform: rotate(0deg) translateY(-3px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22), 0 16px 32px rgba(0, 0, 0, 0.18);
    z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
    .polaroid { transition: none; }
}

/* the gallery */
.gallery h1 {
    margin: 2rem 0 0.5rem;
    font-weight: 300;
    font-size: 2.2rem;
}

.gallery h1.hand {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: 2.6rem;
    font-weight: 500;
}

.polaroids {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.25rem 1.75rem;
    margin: 1.25rem -1rem 0;
    padding: 2.5rem 1.25rem 3rem;
    background: var(--table);
}

.polaroids .polaroid {
    width: 230px;
    margin: 0;
    padding-bottom: 14px;
    cursor: zoom-in;
}

.polaroids figcaption {
    margin-top: 0.55rem;
    min-height: 2.2rem;
    text-align: center;
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: 1.3rem;
    line-height: 1.15;
    color: #333;
}

.polaroids .polaroid:nth-child(6n+1) { --r: -3deg; }
.polaroids .polaroid:nth-child(6n+2) { --r: 2deg; }
.polaroids .polaroid:nth-child(6n+3) { --r: -1.5deg; }
.polaroids .polaroid:nth-child(6n+4) { --r: 3.5deg; }
.polaroids .polaroid:nth-child(6n+5) { --r: -2.5deg; }
.polaroids .polaroid:nth-child(6n+6) { --r: 1deg; }

@media (max-width: 560px) {
    .polaroids { gap: 1.75rem 1rem; padding: 2rem 0.75rem 2.5rem; }
    .polaroids .polaroid { width: 150px; }
    .polaroids figcaption { font-size: 1.1rem; }
}

dialog.lightbox {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 96vw;
    max-height: 96vh;
}

dialog.lightbox::backdrop { background: rgba(10, 14, 20, 0.86); }

dialog.lightbox figure {
    margin: 0;
    background: var(--paper);
    padding: 14px 14px 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

dialog.lightbox img {
    display: block;
    max-width: min(90vw, 1100px);
    max-height: 78vh;
    width: auto;
    height: auto;
}

dialog.lightbox figcaption {
    margin-top: 0.6rem;
    text-align: center;
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: 1.5rem;
    color: #333;
}

dialog.lightbox .close {
    position: absolute;
    top: -0.2rem;
    right: 0;
    border: 0;
    background: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

/* ----- posts ----- */
.post header { margin: 2.25rem 0 1.5rem; }

.post h1 {
    margin: 0 0 0.35rem;
    font-size: 2.1rem;
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.post-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.post-body > * + * { margin-top: 1rem; }

.post-body h2 { margin-top: 2rem; font-size: 1.4rem; font-weight: 600; }
.post-body h3 { margin-top: 1.5rem; font-size: 1.15rem; font-weight: 600; }

.post-body blockquote {
    margin: 1rem 0;
    padding: 0 0 0 1rem;
    border-left: 3px solid var(--rule);
    color: var(--muted);
}

.post-body pre,
.post-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--code-bg);
}

.post-body code { padding: 0.1em 0.3em; }

.post-body pre {
    padding: 0.8rem 1rem;
    overflow-x: auto;
}

.post-body pre code { padding: 0; background: none; }

.post-body figure { margin: 1.25rem 0; }

.post-body figcaption { color: var(--muted); font-size: 0.9rem; }

/* ----- the résumé page (its content is shared with the 3D world) ----- */
.resume { margin: 2.25rem 0 0; }

.resume .prop-stage { display: none; }

.resume-header { margin-bottom: 1.75rem; }

.resume-name {
    margin: 0 0 0.2rem;
    font-size: 2.1rem;
    font-weight: 300;
    line-height: 1.15;
}

.resume-title {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.resume-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    font-size: 0.95rem;
}

.resume-section { margin: 1.75rem 0; }

.resume-section-title {
    margin: 0 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--rule);
    font-size: 1.3rem;
    font-weight: 300;
}

.resume-entry { margin: 0 0 1.1rem; }

.resume-entry-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.2rem 1rem;
}

.resume-entry-title { font-weight: 600; }

.resume-entry-date {
    color: var(--muted);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.resume-entry-subtitle {
    margin: 0.1rem 0 0.35rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.resume-entry ul {
    margin: 0;
    padding-left: 1.2rem;
}

.resume-entry li { margin: 0.2rem 0; }

.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
}

@media (max-width: 560px) {
    .skills-grid { grid-template-columns: 1fr; }
}

.skill-category h4 {
    margin: 0 0 0.15rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.skill-category p {
    margin: 0;
    font-size: 0.95rem;
}

.save-wrap { margin: 1.5rem 0 0; }

.save-link .hud-label::before { content: ''; }

/* ----- footer ----- */
footer.site {
    margin: 3.5rem 0 3rem;
    padding: 1rem 3rem 0 0;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.9rem;
}

footer.site p { margin: 0; }

/* ----- the 64 ----- */
.sixtyfour {
    position: fixed;
    right: 0.9rem;
    bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    font-family: 'Lilita One', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
    color: var(--muted);
    opacity: 0.45;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
}

.sixtyfour:hover,
.sixtyfour:focus-visible {
    color: var(--accent);
    opacity: 1;
    transform: translateY(-2px) rotate(-6deg);
}

.flood {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 125vh;
    z-index: 60;
    pointer-events: none;
    background: linear-gradient(to top, #061b2a 0%, #0e6380 55%, #35a3c2 92%, #bfe9f4 100%);
    transform: translateY(103%);
    will-change: transform;
}

html.flooding .flood {
    /* to 0, not past it: the sheet is anchored at the bottom, so any
       overshoot upward would bare the foot of the page again */
    transform: translateY(0);
    transition: transform 0.9s cubic-bezier(0.22, 0.7, 0.25, 1);
}

html.flooding .wrap {
    opacity: 0.6;
    transition: opacity 0.9s;
}

/* ----- print ----- */
@media print {
    .top, footer.site, .sixtyfour, .flood, .more { display: none !important; }
    body { font-size: 11pt; color: #000; background: #fff; }
    a { color: #000; text-decoration: none; }
    .resume-section-title { border-color: #000; }
}
