/* ==========================================================================
   Balamut.eu — Base Styles
   Minimal, editorial design. Neutral grays, sans-serif, no decoration.
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #222;
    background-color: #fafafa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #444;
    text-decoration: underline;
    text-decoration-color: #ccc;
    text-underline-offset: 2px;
}

a:hover {
    color: #000;
    text-decoration-color: #000;
}

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

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Permalink anchors — hidden by default, visible on heading hover */
.headerlink {
    opacity: 0;
    text-decoration: none;
    margin-left: 0.3em;
    color: #999;
    transition: opacity 0.2s;
}
h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink {
    opacity: 1;
}

p { margin-bottom: 1em; }

ul, ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

/* --- Site Layout --- */
.site-main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Navigation --- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
}

.site-nav__brand {
    font-weight: 700;
    font-size: 1.125rem;
    text-decoration: none;
    color: #222;
}

.site-nav__links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
}

.site-nav__links a {
    text-decoration: none;
    color: #555;
    font-size: 0.9rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.site-nav__links a:hover,
.site-nav__links a.active {
    color: #222;
    border-bottom-color: #222;
}

/* Hamburger toggle — hidden on desktop */
.site-nav__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.site-nav__hamburger,
.site-nav__hamburger::before,
.site-nav__hamburger::after {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    position: relative;
    transition: transform 0.2s;
}

.site-nav__hamburger::before,
.site-nav__hamburger::after {
    content: "";
    position: absolute;
    left: 0;
    width: 24px;
}

.site-nav__hamburger::before { top: -7px; }
.site-nav__hamburger::after { top: 7px; }

/* --- Footer --- */
.site-footer {
    background: #222;
    color: #aaa;
    text-align: center;
    padding: 2rem 1.5rem;
    margin-top: auto;
}

.site-footer__social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.site-footer__social a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
}

.site-footer__social a:hover {
    color: #fff;
}

.site-footer__copy {
    font-size: 0.8rem;
    color: #777;
}

/* --- Homepage --- */
.page-home .hero {
    text-align: center;
    padding: 3rem 1rem;
}

.hero__photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

.hero__name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.hero__tagline {
    font-size: 1.25rem;
    color: #666;
    font-style: italic;
}

.panels {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

.panel {
    flex: 1;
    padding: 2rem;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.panel__icon {
    display: block;
    margin: 0 auto 1rem;
}

.panel__title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.panel__subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.panel__links {
    list-style: none;
    padding: 0;
}

.panel__links li {
    margin-bottom: 0.5rem;
}

.panel__links a {
    font-size: 1rem;
}

.home-links {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.home-links ul {
    list-style: none;
    padding: 0;
}

.home-links li {
    margin-bottom: 0.5rem;
}

/* --- Blog Listing --- */
.blog-listing__title {
    margin-bottom: 2rem;
}

.blog-listing__item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.blog-listing__item:last-child {
    border-bottom: none;
}

.blog-listing__item-title {
    margin-bottom: 0.25rem;
}

.blog-listing__item-title a {
    text-decoration: none;
    color: #222;
}

.blog-listing__item-title a:hover {
    text-decoration: underline;
}

.blog-listing__item-date {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.blog-listing__item-excerpt {
    color: #555;
    font-size: 0.95rem;
}

/* --- Article --- */
.article__header {
    margin-bottom: 2rem;
}

.article__title {
    margin-bottom: 0.25rem;
}

.article__date {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.article__category {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article__content {
    line-height: 1.7;
}

.article__content h2 { margin-top: 2rem; }
.article__content h3 { margin-top: 1.5rem; }

.article__content pre {
    background: #f5f5f5;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.article__content code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 0.875em;
}

.article__content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1rem;
    color: #555;
    margin: 1rem 0;
}

.article__tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.tag {
    display: inline-block;
    font-size: 0.8rem;
    color: #666;
    background: #f0f0f0;
    padding: 0.2em 0.6em;
    margin: 0.2em;
}

/* --- Page --- */
.page-content {
    line-height: 1.7;
}

.page-content h2 { margin-top: 2rem; }
.page-content h3 { margin-top: 1.5rem; }

.page-content img {
    max-width: 200px;
    border-radius: 50%;
    margin: 1rem 0;
}

/* --- Gallery --- */
.page-gallery .site-main,
.page-album .site-main {
    max-width: 1400px;
    background: #808080;
    padding: 2rem;
}

.page-gallery,
.page-album {
    background: #808080;
}

.gallery__title,
.album__title {
    color: #fff;
}

.gallery__empty,
.album__empty {
    color: #ccc;
}

.gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.album-card {
    background: #6a6a6a;
    overflow: hidden;
}

.album-card__link {
    text-decoration: none;
    color: #fff;
    display: block;
}

.album-card__cover {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.album-card__placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: #555;
}

.album-card__info {
    padding: 1rem;
}

.album-card__name {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.album-card__description {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 0.5rem;
}

.album-card__count {
    font-size: 0.8rem;
    color: #aaa;
}

/* --- Album Page --- */
.album__header {
    margin-bottom: 2rem;
}

.album__description {
    color: #ddd;
    margin-bottom: 0.5rem;
}

.album__keywords {
    margin-bottom: 0.75rem;
}

.album__hashtag {
    display: inline-block;
    color: #8ab4f8;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.album__back {
    color: #ccc;
    font-size: 0.9rem;
}

.album__photo-link {
    position: relative;
    display: block;
}

.album__rating {
    position: absolute;
    bottom: 4px;
    right: 4px;
    color: #ffd700;
    font-size: 0.7rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.album__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.album__thumbnail {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.album__photo-link {
    display: block;
}

/* --- Photo Detail --- */
.page-photo {
    background: #1a1a1a;
}

.page-photo .site-main {
    max-width: 1400px;
    background: #1a1a1a;
}

.page-photo .site-header {
    background: #111;
    border-bottom-color: #333;
}

.page-photo .site-nav__brand,
.page-photo .site-nav__links a {
    color: #ccc;
}

.page-photo .site-nav__links a:hover,
.page-photo .site-nav__links a.active {
    color: #fff;
    border-bottom-color: #fff;
}

.page-photo .site-nav__hamburger,
.page-photo .site-nav__hamburger::before,
.page-photo .site-nav__hamburger::after {
    background: #ccc;
}

.photo-detail__image-wrap {
    text-align: center;
    margin-bottom: 1rem;
}

.photo-detail__image {
    max-height: 80vh;
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

.photo-detail__info {
    color: #777;
    max-width: 800px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.photo-detail__title {
    color: #aaa;
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.photo-detail__rating {
    color: #ffd700;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.photo-detail__description {
    color: #bbb;
    margin-bottom: 1rem;
}

.photo-detail__date {
    display: block;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.photo-detail__exif {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.photo-detail__exif-item {
    display: flex;
    flex-direction: column;
}

.photo-detail__exif-item dt {
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photo-detail__exif-item dd {
    font-size: 0.8rem;
    color: #888;
}

.photo-detail__tags {
    margin-bottom: 1.5rem;
}

.photo-detail__tags .tag {
    background: #333;
    color: #ccc;
}

.photo-detail__back {
    color: #888;
    font-size: 0.9rem;
}

.photo-detail__back:hover {
    color: #fff;
}

.page-photo .site-footer {
    background: #111;
    border-top: 1px solid #333;
}

.page-photo .site-footer__social a {
    color: #888;
}

.page-photo .site-footer__social a:hover {
    color: #fff;
}

.page-photo .site-footer__copy {
    color: #666;
}

.photo-detail__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.photo-detail__nav a {
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
}

.photo-detail__nav a:hover {
    color: #fff;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.pagination__link {
    font-size: 0.9rem;
}


/* ==========================================================================
   Responsive Breakpoints
   Mobile: ≤768px | Tablet: 769px–1024px | Desktop: >1024px
   ========================================================================== */

/* --- Mobile (≤768px) --- */
@media (max-width: 768px) {
    /* Navigation: hamburger menu */
    .site-nav__toggle {
        display: block;
    }

    .site-nav__links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid #e0e0e0;
        padding: 1rem 1.5rem;
        gap: 0.75rem;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    }

    .site-nav__links--open {
        display: flex;
    }

    .site-header {
        position: relative;
    }

    /* Homepage: stacked panels */
    .panels {
        flex-direction: column;
        gap: 1rem;
    }

    .hero__name {
        font-size: 1.75rem;
    }

    .hero__tagline {
        font-size: 1rem;
    }

    /* Gallery grid: single column on small mobile */
    .gallery__grid {
        grid-template-columns: 1fr;
    }

    /* Album grid: two columns on mobile */
    .album__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Photo detail: full width */
    .photo-detail__exif {
        grid-template-columns: repeat(2, 1fr);
    }

    /* General spacing */
    .site-main {
        padding: 1.5rem 1rem;
    }
}

/* --- Tablet (769px–1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .gallery__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .album__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Desktop (>1024px) --- */
@media (min-width: 1025px) {
    .gallery__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .album__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Photo page dark nav on mobile --- */
@media (max-width: 768px) {
    .page-photo .site-nav__links {
        background: #111;
        border-bottom-color: #333;
    }
}

/* --- Homepage --- */
.page-home .site-main {
    padding: 0;
    margin-bottom: 0;
}

.home-brain {
    position: relative;
    width: 100%;
    margin-bottom: 0;
}

.home-brain__img {
    width: 100%;
    height: auto;
    display: block;
}

.page-home .panels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

.page-home .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: none;
    text-align: center;
}

.page-home .panel__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.5);
}

.page-home .panel__links {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.page-home .panel__links a {
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 15px rgba(0,0,0,0.5);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 500;
}

.page-home .panel__links a:hover {
    text-decoration: underline;
}

.page-home .panel__links li {
    margin: 0.3rem 0;
}

@media (max-width: 768px) {
    .page-home .panels {
        position: static;
        flex-direction: column;
    }
    .page-home .panel__title { color: #222; text-shadow: none; }
    .page-home .panel__links a { color: #444; text-shadow: none; }
}

/* --- Error Page --- */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 4rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.error-page p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

.error-page a {
    color: #444;
}

/* --- Fullscreen Overlay --- */
.fullscreen-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.fullscreen-overlay--hidden {
    display: none !important;
}

.fullscreen-overlay__img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
}
