/* ==========================================================================
   eddysvensson.se — mono theme
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

@font-face {
    font-family: 'Instrument Serif';
    src: url('../fonts/InstrumentSerif-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Serif';
    src: url('../fonts/InstrumentSerif-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* --- Tokens --------------------------------------------------------------- */
:root {
    /* Colors */
    --bg:       #212121;
    --surface:  #111111;
    --text:     #f2f2f0;
    --muted:    rgba(242, 242, 240, 0.58);
    --border:   rgba(242, 242, 240, 0.12);

    --accent:   #fa8475;

    /* Typography */
    --font:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --serif:    'Instrument Serif', Georgia, serif;
    --base:     16px;
    --lh:       1.5;
    --lh-tight: 1.2;
    --lh-body:  1.35;

    /* Sizing */
    --h1:       2rem;
    --h2:       1.15rem;
    --h3:       0.72rem;
    --body:     1rem;
    --small:    0.85rem;
    --nav:      0.9rem;
    --fw-normal: 450;
    --fw-bold:   600;

    /* Spacing */
    --unit:     1.2rem;
    --gap:      var(--unit);

    /* Radius */
    --radius:   3px;

    /* Motion */
    --ease:     cubic-bezier(0.4, 0, 0.2, 1);
    --speed:    0.12s;

    /* Measures */
    --measure:  36rem;
    --bp:       640px;
}


/* --- Light mode ----------------------------------------------------------- */
html.is-light {
    --bg:      #ffffff;
    --surface: #eae8e2;
    --text:    #18171a;
    --muted:   rgba(24, 23, 26, 0.52);
    --border:  rgba(24, 23, 26, 0.12);
    --accent:   #2a52f3;

}

html.is-light .site-nav {
    background: rgba(242, 242, 242, 0.88);
    border-color: rgba(24, 23, 26, 0.14);
}

html.is-light .site-nav a:hover,
html.is-light .theme-toggle:hover {
    background: rgba(24, 23, 26, 0.07);
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: var(--base); background: var(--bg); }

/* --- Selection ------------------------------------------------------------ */
::selection { background: var(--accent); color: var(--bg); }

/* --- Base ----------------------------------------------------------------- */
body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: var(--lh);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

/* --- Entrance animations -------------------------------------------------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInNav {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Site shell ----------------------------------------------------------- */
.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3rem 5.5rem;
    max-width: 40rem;
    margin: 0 auto;

}

/* --- Header --------------------------------------------------------------- */
.site-header {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    width: auto;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    animation: fadeInNav 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.site-header.is-stuck { /* pill handles its own visual state */ }

/* --- Site name ------------------------------------------------------------ */
.site-name {
    font-size: var(--nav);
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    transition: color var(--speed) ease;
    display: flex;
    align-items: baseline;
    gap: 0.5em;
}

.site-name:hover { color: var(--accent); }

/* --- Annotation ----------------------------------------------------------- */
.annotation {
    display: inline-block;
    font-size: 0.65rem;
    color: var(--muted);
    transform: rotate(-2deg);
    transform-origin: left center;
    transition: color var(--speed) ease;
    pointer-events: none;
}

/* --- Navigation (desktop) ------------------------------------------------- */
.site-nav {
    display: flex;
    gap: 0;
    align-items: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(232, 230, 223, 0.13);
    border-radius: 100px;
    padding: 0.35rem 0.5rem;
}

.site-nav a {
    font-size: var(--nav);
    font-weight: var(--fw-normal);
    color: var(--muted);
    padding: 0.6em;
    border-radius: 100px;
    line-height: 1;
    transition: color var(--speed) ease, background var(--speed) ease;
    letter-spacing: -0.01em;
}

.site-nav a:hover {
    color: var(--text);
    background: rgba(242, 242, 240, 0.07);
}

.site-nav a.is-active {
    color: var(--text);
    background: rgba(232, 230, 223, 0.1);
}

.site-nav a.is-active::after { display: none; }


/* --- Mobile nav ----------------------------------------------------------- */
@media (max-width: 640px) {
    .site-header {
        bottom: 1rem;
    }
}

/* --- Main content --------------------------------------------------------- */
.site-main {
    /* flex: 1; */
    /*padding-top: calc(var(--unit) * 4);
    padding-bottom: calc(var(--unit) * 4);*/
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.08s both;
    align-items: center;
    justify-content: center;
}

.site-main h1 {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin-bottom: calc(var(--unit) * 1.5);
    color: var(--text);
}

/* --- Home avatar ---------------------------------------------------------- */
.site-main.page-home h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-main.page-home h1::before {
    content: '';
    display: block;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-image: url('../images/eddy.png');
    background-size: cover;
    background-position: center top;
    /* border: 2px solid var(--border); */
}

.site-main h2 {
    font-family: var(--serif);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 400;
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    margin-top: calc(var(--unit) * 2.5);
    margin-bottom: var(--unit);
    color: var(--text);
}

.site-main h3 {
    font-size: var(--h3);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: calc(var(--unit) * 2.5);
    margin-bottom: calc(var(--unit) * 0.6);
    color: var(--muted);
}

.site-main p {
    font-size: 1.2rem;
    line-height: var(--lh-body);
    max-width: none;
    margin-bottom: var(--unit);
    color: var(--text);
    font-weight: var(--fw-normal);
}

.site-main em {
    font-style: italic;
    color: var(--muted);
}

.site-main a {
    color: var(--accent);
    transition: color var(--speed) ease;
}

.site-main a:hover {
    color: var(--text);
}

.site-main img { border-radius: var(--radius); }

.site-main hr {
    border: none;
    height: 1px;
    background: var(--border);
    width: 100%;
    margin: calc(var(--unit) * 2) 0;
}

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

/* --- Contact links -------------------------------------------------------- */
.contact-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: var(--unit);
}

.contact-links a {
    font-size: var(--nav);
    font-weight: var(--fw-normal);
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.45em 0.15em 0.25em;
    margin-left: -0.25em;
    border-radius: var(--radius);
    transition: color var(--speed) ease, background var(--speed) ease;
}

/* .contact-links a::before { content: '→ '; opacity: 0.4; transition: opacity var(--speed) ease; } */

/* .contact-links li:nth-child(1) a:hover {
    color: var(--bg);
    background: var(--accent);
}
.contact-links li:nth-child(1) a:hover::before { opacity: 0.7; }

.contact-links li:nth-child(2) a:hover {
    color: var(--bg);
    background: var(--accent);
}
.contact-links li:nth-child(2) a:hover::before { opacity: 0.7; } */

/* --- Now (reading / playing / listening) ---------------------------------- */
.now-section {
    margin-top: calc(var(--unit) * 2);
    display: flex;
    flex-direction: row;
    gap: calc(var(--unit) * 0.5);
}

.now-item {
    flex: 1;
    min-width: 0;
}

.now-link {
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    box-shadow: none;
}

.now-link--empty { cursor: default; }

.now-cover-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.4rem;
    min-height: 0;
}

.now-cover {
    max-width: 85%;
    max-height: 85%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    display: block;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.now-link:not(.now-link--empty):hover .now-cover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
}

.now-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0.6rem 0.7rem;
    min-width: 0;
    border-top: 1px solid var(--border);
}

.now-label {
    font-size: calc(var(--small) * 0.75);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.now-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.now-title {
    font-size: var(--small);
    font-weight: var(--fw-bold);
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-meta {
    font-size: calc(var(--small) * 0.9);
    color: var(--muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-empty {
    font-size: var(--small);
    color: var(--muted);
}

/* --- Profile image -------------------------------------------------------- */
.profile-image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    object-fit: cover;
    margin-bottom: var(--unit);
    border: 1px solid var(--border);
}

/* --- Info ----------------------------------------------------------------- */
.site-main.page-info p { line-height: var(--lh-body); }

.now-archive-link {
    margin-top: calc(var(--unit) * 1.2);
    font-size: var(--small);
}

/* --- Photos --------------------------------------------------------------- */

.page-photos {
   flex: 1;
}

.photo-year { margin-bottom: var(--unit); }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.photo-item {
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    border-radius: 0;
    box-shadow: none;
    transition: opacity 0.2s ease;
}

.photo-item:hover { opacity: 0.75; }

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Year nav ------------------------------------------------------------- */
.year-nav {
    display: flex;
    align-items: center;
    gap: var(--gap);
    margin-bottom: var(--unit);
}

.year-nav-link {
    font-size: 1.1rem;
    font-weight: var(--fw-normal);
    color: var(--muted);
    transition: color var(--speed) ease;
    letter-spacing: -0.01em;
}

a.year-nav-link:hover { color: var(--text); }

.year-nav-link.is-active {
    color: var(--text);
    font-weight: var(--fw-bold);
}

.no-photos { color: var(--muted); }

/* --- Photo archive index -------------------------------------------------- */
.photo-archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.photo-archive-item {
    border-bottom: 1px solid var(--border);
}

.photo-archive-item:first-child {
    border-top: 1px solid var(--border);
}

.photo-archive-link {
    display: flex;
    align-items: center;
    gap: var(--unit);
    padding: calc(var(--unit) * 0.65) 0;
    text-decoration: none !important;
    color: var(--text);
    transition: color var(--speed) ease;
}

.photo-archive-link:hover {
    color: var(--accent);
    text-decoration: none !important;
}

.photo-archive-year {
    font-weight: var(--fw-bold);
    font-size: var(--h2);
    flex-shrink: 0;
}

.photo-archive-count {
    color: var(--muted);
    font-size: var(--small);
    flex-shrink: 0;
}

.photo-archive-thumbs {
    display: flex;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.photo-archive-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
    opacity: 0.85;
    transition: opacity var(--speed) ease;
}

.photo-archive-link:hover .photo-archive-thumb {
    opacity: 1;
}

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1003;
    background: rgba(10, 10, 9, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox-img-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lightbox.is-open .lightbox-img.is-loaded { opacity: 1; }

.lightbox-close {
    position: absolute;
    top: var(--unit);
    right: var(--unit);
    background: none;
    border: none;
    color: rgba(232, 230, 224, 0.38);
    font-size: 1rem;
    font-family: var(--font);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color var(--speed) ease;
    z-index: 10;
}

.lightbox-close:hover { color: #e8e6e0; }

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(232, 230, 224, 0.38);
    font-size: 1rem;
    font-family: var(--font);
    cursor: pointer;
    padding: var(--unit);
    line-height: 1;
    transition: color var(--speed) ease;
    z-index: 10;
    user-select: none;
}

.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-prev:hover,
.lightbox-next:hover { color: #e8e6e0; }

.lightbox-counter {
    position: absolute;
    bottom: var(--unit);
    left: var(--unit);
    font-size: var(--small);
    color: rgba(232, 230, 224, 0.38);
    font-family: var(--font);
}

.lightbox-date {
    position: absolute;
    bottom: var(--unit);
    right: var(--unit);
    font-size: var(--small);
    color: rgba(232, 230, 224, 0.38);
    font-family: var(--font);
}

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

/* --- Lab ------------------------------------------------------------------ */
.lab-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lab-list li {
    border-bottom: 1px solid var(--border);
    padding: calc(var(--unit) * 0.5) 0;
}

.lab-list li:first-child {
    border-top: 1px solid var(--border);
}

.lab-list a {
    font-size: 1.2rem;
    font-weight: var(--fw-bold);
    color: var(--accent);
    text-decoration: none !important;
    transition: color var(--speed) ease;
}

.lab-list a:hover {
    color: var(--text);
    text-decoration: none !important;
}

/* --- Lab gallery ---------------------------------------------------------- */
.lab-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-top: calc(var(--unit) * 2);
}

.lab-item {
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.lab-item:hover { opacity: 0.75; }
.lab-item:hover { transform: none; box-shadow: none; }

.lab-item img,
.lab-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-item--video { cursor: default; }
.lab-item--video:hover { opacity: 1; }

.lab-empty {
    color: var(--muted);
    grid-column: 1 / -1;
    font-size: var(--small);
}

/* --- Log archive ---------------------------------------------------------- */
/* Log list */
.log-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.log-list-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--unit);
    padding: calc(var(--unit) * 0.5) 0;
    border-bottom: 1px solid var(--border);
}

.log-list-item:first-child {
    border-top: 1px solid var(--border);
}

.log-list-link {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
    text-decoration: none !important;
    color: var(--text);
    min-width: 0;
    transition: color var(--speed) ease;
}

.log-list-link:hover {
    color: var(--accent);
    text-decoration: none !important;
}

.log-list-title {
    font-weight: var(--fw-bold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-list-sub {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-list-sub::before {
    content: '—';
    margin-right: 0.5em;
}

.log-list-tag {
    font-size: 0.7rem;
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
    width: 5.5em;
}

.log-tag--reading { color: var(--accent); }
.log-tag--music   { color: var(--accent); }
.log-tag--games   { color: var(--accent); }

.log-list-date {
    color: var(--muted);
    font-size: var(--small);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.log-empty {
    color: var(--muted);
    font-size: var(--small);
}

/* --- Footer --------------------------------------------------------------- */
.site-footer { display: none; }

.theme-toggle {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0.6em;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--speed) ease, background var(--speed) ease;
    line-height: 1;
}

.theme-toggle:hover { color: var(--text); background: rgba(242, 242, 240, 0.07); }

.theme-toggle svg { display: block; }

.theme-toggle .icon-moon { display: none; }
html.is-light .theme-toggle .icon-sun  { display: none; }
html.is-light .theme-toggle .icon-moon { display: block; }

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

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
    .site { padding: 2rem 1.25rem 4.5rem; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
    .lab-gallery { grid-template-columns: repeat(2, 1fr); }
    .log-list-sub { display: none; }
    .log-list-tag { width: auto; }
    .photo-archive-thumb { width: 36px; height: 36px; }
    .lightbox-prev, .lightbox-next { font-size: 0.9rem; }
    .lightbox-img { max-width: 95vw; max-height: 80vh; }
    .now-section {
        flex-direction: column;
        gap: calc(var(--unit) * 0.4);
    }
    .now-item {
        display: flex;
        flex-direction: row;
        gap: 0;
    }
    .now-link {
        flex-direction: row;
        aspect-ratio: unset;
        width: 100%;
    }
    .now-cover-wrap {
        flex: 0 0 72px;
        height: 72px;
        padding: 0.7rem;
    }
    .now-info {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.7rem;
    }
}
