:root {
    --font-family: "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --text-color: #333;
    --bg-color: #fff;
    --border-color: #eee;
    --metric-bg: #f5f5f5;
    --media-grid-gap: 16px;
    --media-grid-cols: 3;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #cccccc;
        --bg-color: #0d0d0d;
        --border-color: #222;
        --metric-bg: #1a1a1a;
    }
}

@font-face {
    font-family: "Hiragino Kaku Gothic Pro";
    src: url("fonts/ヒラギノ角ゴ Pro W6.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Hiragino Kaku Gothic Pro";
    src: url("fonts/ヒラギノ角ゴ Pro W3.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

p {
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
    white-space: pre-wrap;
}

a:link,
a:visited,
a:hover {
    color: var(--text-color);
    transition: color 0.1s ease;
}

/*Layout*/

.header {
    width: 100%;
    margin-bottom: 20px;
}

.home-title {
    margin: unset;
}

.content {
    width: 100%;
}

.date {
    font-size: 0.9rem;
    color: #666;
}

/*Metrics*/

.metrics {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.metric {
    background: var(--metric-bg);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric::before {
    content: "🏃";
    font-size: 1rem;
}

/*Media grid*/

.media-grid {
    display: grid;
    grid-template-columns: repeat(var(--media-grid-cols), 1fr);
    gap: var(--media-grid-gap);
    margin: 20px 0 30px 0;
    position: relative;
}

.media-grid img,
.media-grid video,
.media-grid picture {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.media-grid img {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

/*Lightbox*/

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    cursor: pointer;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

/*Home page*/

.album-list {
    width: 100%;
    margin-top: 20px;
}

.journal-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.1s ease-out !important;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.journal-row.visible {
    opacity: 1;
}

.journal-row.hidden {
    display: none;
}

.journal-row:hover {
    background-color: var(--metric-bg);
}

.journal-info {
    flex: 1;
    min-width: 0;
}

.journal-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.journal-text {
    font-size: 1rem;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.journal-count {
    font-size: 0.9rem;
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-out 0.5s both;
}

/*Thumbnails*/

.journal-thumbnails {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.journal-thumbnails img,
.journal-thumbnails video {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #fff;
    transition: transform 0.25s ease, z-index 0.25s ease;
}

.journal-thumbnails img:not(:first-child),
.journal-thumbnails video:not(:first-child) {
    margin-left: -10px;
}

.journal-thumbnails img:nth-child(1) {
    width: 120px;
    height: 120px;
}

.journal-thumbnails img:nth-child(2) {
    width: 70px;
    height: 70px;
}

.journal-thumbnails img:nth-child(3) {
    width: 100px;
    height: 100px;
}

.journal-thumbnails img:nth-child(4) {
    width: 65px;
    height: 65px;
}

.journal-thumbnails img:nth-child(5) {
    width: 90px;
    height: 90px;
}

.journal-thumbnails img:nth-child(1) {
    transform: rotate(-5deg) translateY(8px) scale(1.08);
}

.journal-thumbnails img:nth-child(2) {
    transform: rotate(3deg) translateY(-12px) translateX(-5px) scale(0.95);
}

.journal-thumbnails img:nth-child(3) {
    transform: rotate(-2deg) translateY(4px) scale(1.02);
}

.journal-thumbnails img:nth-child(4) {
    transform: rotate(4deg) translateY(-6px) translateX(8px) scale(0.92);
}

.journal-thumbnails img:nth-child(5) {
    transform: rotate(-1deg) translateY(10px) scale(1.05);
}

.journal-thumbnails img:hover,
.journal-thumbnails video:hover {
    transform: scale(1.2) rotate(0deg) !important;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.journal-thumbnails.layout-2 img:nth-child(1) {
    width: 140px;
    height: 140px;
    transform: rotate(-4deg) translateY(6px) scale(1.04);
}

.journal-thumbnails.layout-2 img:nth-child(2) {
    width: 60px;
    height: 60px;
    transform: rotate(6deg) translateY(-4px);
}

.journal-thumbnails.layout-2 img:nth-child(3) {
    width: 110px;
    height: 110px;
    transform: rotate(-2deg) translateY(2px);
}

.journal-thumbnails.layout-2 img:nth-child(4) {
    width: 70px;
    height: 70px;
    transform: rotate(3deg) translateY(-2px);
}

.journal-thumbnails.layout-2 img:nth-child(5) {
    width: 90px;
    height: 90px;
    transform: rotate(-1deg) translateY(4px);
}

.journal-thumbnails.layout-3 img:nth-child(1) {
    width: 120px;
    height: 120px;
    transform: rotate(0deg) translateY(6px) scale(1.05);
}

.journal-thumbnails.layout-3 img:nth-child(2) {
    width: 100px;
    height: 100px;
    transform: rotate(-3deg) translateY(-6px) scale(0.95);
}

.journal-thumbnails.layout-3 img:nth-child(3) {
    width: 90px;
    height: 90px;
    transform: rotate(5deg) translateY(2px);
}

.journal-thumbnails.layout-3 img:nth-child(4) {
    width: 70px;
    height: 70px;
    transform: rotate(-6deg) translateY(-4px);
}

.journal-thumbnails.layout-3 img:nth-child(5) {
    width: 80px;
    height: 80px;
    transform: rotate(2deg) translateY(6px);
}

.journal-thumbnails.layout-4 img:not(:first-child) {
    margin-left: -14px;
}

.journal-thumbnails.layout-4 img:nth-child(1) {
    width: 130px;
    height: 130px;
}

.journal-thumbnails.layout-4 img:nth-child(2) {
    width: 60px;
    height: 60px;
}

.journal-thumbnails.layout-4 img:nth-child(3) {
    width: 110px;
    height: 110px;
}

.journal-thumbnails.layout-4 img:nth-child(4) {
    width: 70px;
    height: 70px;
}

.journal-thumbnails.layout-4 img:nth-child(5) {
    width: 90px;
    height: 90px;
}

/*Controls*/

.journal-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin: 12px 0 16px 0;
}

.journal-controls input,
.journal-controls select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: var(--font-family);
    font-size: 0.875rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.journal-controls input {
    flex: 1;
    min-width: 160px;
}

.journal-controls input:focus,
.journal-controls select:focus {
    outline: none;
    border-color: var(--text-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 800px) {
    .journal-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .journal-thumbnails {
        width: 100%;
        padding: 0;
    }

    .journal-thumbnails img {
        width: calc(25% - 6px) !important;
        height: 60px !important;
        transform: none !important;
    }

    .journal-thumbnails img:not(:first-child) {
        margin-left: 4px;
    }

    .media-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .media-grid img,
    .media-grid video,
    .media-grid picture {
        height: auto;
        aspect-ratio: 1;
    }
}
