/* ============================================================
   TEKTUR THEME — main.css
   Colours:
     Header bg:        #2C3947
     Header links:     #E8EDF2
     Header hover:     #C2A56D
     Page bg:          #E8EDF2
     Page links:       #2C3947
     Page link hover:  #C2A56D
     Drop shadow:      #C2A56D
     Site background:  #547A95
     Text:             #1E2830  (derived dark)
     Muted text:       #5A6A78  (derived mid)
     Border:           #C8D2DA  (derived light)
     Footer bg:        #2C3947  (matches header)
   ============================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Onest', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #1E2830;
    background-color: #547A95;
    min-height: 100vh;
}

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

a {
    color: #2C3947;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}
a:hover, a:focus-visible { color: #C2A56D; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Tektur', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: #1E2830;
}

/* ---------- Layout ---------- */
.site-wrap {
    display: flex;
    justify-content: center;
    padding: 2.5rem 1rem 3rem;
}

.site-main {
    width: 100%;
    max-width: 1000px;
    background: #E8EDF2;
    border-radius: 12px;
    overflow: hidden;

    /* Drop shadow: top and right only */
    box-shadow: 6px -6px 0 0 #C2A56D;
}

/* Remove drop shadow below 1000px */
@media (max-width: 999px) {
    .site-main {
        box-shadow: none;
        border-radius: 0;
    }

    .site-wrap {
        padding: 0;
    }
}

/* ---------- Header ---------- */
.site-header {
    background-color: #2C3947;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header__inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    gap: 1rem;
}

.site-header__site-name,
.site-header__logo-link {
    font-family: 'Tektur', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #E8EDF2;
    text-decoration: none;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.site-header__site-name:hover,
.site-header__logo-link:hover { color: #C2A56D; }

.site-header__logo { height: 36px; width: auto; }

/* Nav */
.site-header__nav {
    display: flex;
    align-items: center;
}

.site-header__menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.site-header__menu-item { position: relative; }

.site-header__menu-item > a {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: #E8EDF2;
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    display: block;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}
.site-header__menu-item > a:hover,
.site-header__menu-item > a:focus-visible,
.site-header__menu-item.is-active > a {
    color: #C2A56D;
    background: rgba(255,255,255,0.07);
}

/* Submenu */
.site-header__submenu {
    list-style: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #2C3947;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    min-width: 160px;
    padding: 0.4rem 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
}
.site-header__menu-item.has-submenu:hover .site-header__submenu,
.site-header__menu-item.has-submenu:focus-within .site-header__submenu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.site-header__submenu li a {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.82rem;
    color: #E8EDF2;
    text-decoration: none;
    padding: 0.4rem 1rem;
    display: block;
    transition: color 0.2s;
}
.site-header__submenu li a:hover { color: #C2A56D; }

/* Hamburger */
.site-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.site-header__hamburger:hover { background: rgba(255,255,255,0.1); }
.site-header__hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #E8EDF2;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
    transform-origin: center;
}
/* Open state */
.site-header__hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header__hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.site-header__hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 700px) {
    .site-header__hamburger { display: flex; }

    .site-header__nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #2C3947;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 0.75rem 1.25rem 1rem;
        z-index: 99;
    }
    .site-header__nav.is-open { display: flex; flex-direction: column; align-items: flex-start; }

    .site-header__menu { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
    .site-header__menu-item { width: 100%; }
    .site-header__menu-item > a { width: 100%; padding: 0.6rem 0.5rem; }

    .site-header__submenu {
        position: static;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        border: none;
        border-left: 2px solid #C2A56D;
        border-radius: 0;
        padding: 0 0 0 0.75rem;
        margin-left: 0.5rem;
        display: none;
    }
    .site-header__menu-item.has-submenu.is-open .site-header__submenu { display: block; }
}

/* ---------- Post List (index / tag / author) ---------- */
.post-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 2rem;
}

@media (min-width: 600px) {
    .post-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

.post-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #C8D2DA;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
    .post-card { margin-bottom: 0; }
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(44,57,71,0.12);
}

.post-card__image-link { display: block; aspect-ratio: 16/9; overflow: hidden; }
.post-card__image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.post-card__image-link:hover .post-card__image { transform: scale(1.03); }

.post-card__body { padding: 1.1rem 1.25rem 1.25rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.post-card__title { font-size: 1.05rem; font-weight: 700; }
.post-card__title a { color: #1E2830; text-decoration: none; }
.post-card__title a:hover { color: #C2A56D; }

.post-card__excerpt { font-size: 0.9rem; color: #5A6A78; line-height: 1.6; flex: 1; }

.post-card__meta { font-family: 'Spline Sans Mono', monospace; font-size: 0.78rem; color: #5A6A78; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; }
.post-card__meta-sep { color: #C8D2DA; }
.post-card__author { color: #5A6A78; }

/* ---------- Article (post / page) ---------- */
.article { background: #E8EDF2; }

.article__hero {
    width: 100%;
    aspect-ratio: 16/6;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

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

.article__body {
    padding: 2rem 2.5rem 3rem;
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .article__body { padding: 1.5rem 1.25rem 2rem; }
}

.article__header { margin-bottom: 1.5rem; }

.article__title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: #1E2830;
    margin-bottom: 0.75rem;
}

.article__meta {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.82rem;
    color: #5A6A78;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.article__meta-sep { color: #C8D2DA; }
.article__author { color: #5A6A78; text-decoration: none; }
.article__author:hover { color: #C2A56D; }
.article__tag { color: #5A6A78; text-decoration: none; }
.article__tag:hover { color: #C2A56D; }

/* Article content typography */
.article__content {
    font-size: 1rem;
    line-height: 1.8;
    color: #1E2830;
}
.article__content h1,
.article__content h2,
.article__content h3,
.article__content h4 { margin: 2rem 0 0.75rem; }
.article__content p { margin-bottom: 1.25rem; }
.article__content a { color: #2C3947; }
.article__content a:hover { color: #C2A56D; }
.article__content ul,
.article__content ol { margin: 0 0 1.25rem 1.5rem; }
.article__content li { margin-bottom: 0.4rem; }
.article__content blockquote {
    border-left: 4px solid #C2A56D;
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: rgba(194,165,109,0.08);
    border-radius: 0 6px 6px 0;
    color: #5A6A78;
    font-style: italic;
}
.article__content code {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.88em;
    background: #d4dce4;
    padding: 0.15em 0.4em;
    border-radius: 4px;
}
.article__content pre {
    background: #2C3947;
    color: #E8EDF2;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}
.article__content pre code { background: none; padding: 0; color: inherit; }
.article__content img { border-radius: 8px; margin: 1.5rem 0; }
.article__content hr { border: none; border-top: 1px solid #C8D2DA; margin: 2rem 0; }
.article__content table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.article__content th,
.article__content td { padding: 0.6rem 0.9rem; border: 1px solid #C8D2DA; text-align: left; }
.article__content th { background: #d4dce4; font-family: 'Tektur', sans-serif; }

/* ---------- Post Navigation ---------- */
.post-nav {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2.5rem 2rem;
    border-top: 1px solid #C8D2DA;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .post-nav { padding: 1.25rem; }
}

.post-nav__link {
    flex: 1;
    min-width: 140px;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border: 1px solid #C8D2DA;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.post-nav__link--next { text-align: right; margin-left: auto; }
.post-nav__link:hover { border-color: #C2A56D; box-shadow: 0 2px 8px rgba(194,165,109,0.2); }
.post-nav__label { font-family: 'Spline Sans Mono', monospace; font-size: 0.75rem; color: #5A6A78; text-transform: uppercase; letter-spacing: 0.05em; }
.post-nav__title { font-family: 'Tektur', sans-serif; font-size: 0.9rem; color: #1E2830; font-weight: 600; }

/* ---------- Archive Header ---------- */
.archive-header {
    padding: 2.5rem 2.5rem 1.5rem;
    border-bottom: 1px solid #C8D2DA;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
.archive-header__title { font-size: clamp(1.4rem, 3vw, 2rem); }
.archive-header__desc { color: #5A6A78; font-size: 0.95rem; max-width: 60ch; }
.archive-header__avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid #C2A56D; }

/* ---------- Subpages ---------- */
.subpages { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #C8D2DA; }
.subpages__title { font-size: 1.1rem; margin-bottom: 0.75rem; }
.subpages__list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.subpages__list a { color: #2C3947; text-decoration: none; font-weight: 500; }
.subpages__list a:hover { color: #C2A56D; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 2rem 2rem;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #C8D2DA;
    text-decoration: none;
    color: #2C3947;
    background: #fff;
    transition: border-color 0.2s, color 0.2s;
}
.pagination a:hover { border-color: #C2A56D; color: #C2A56D; }
.pagination .is-active,
.pagination .pagination__current {
    background: #2C3947;
    color: #E8EDF2;
    border-color: #2C3947;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #2C3947;
    color: #E8EDF2;
    padding: 1.25rem 1.25rem;
}
.site-footer__inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}
.site-footer__copy {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.8rem;
    color: rgba(232,237,242,0.6);
}

/* ---------- 404 Error Page ---------- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    gap: 1rem;
}

.error-page__code {
    font-family: 'Tektur', sans-serif;
    font-size: clamp(5rem, 15vw, 9rem);
    font-weight: 700;
    color: #C2A56D;
    line-height: 1;
}

.error-page__title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: #1E2830;
}

.error-page__message {
    color: #5A6A78;
    font-size: 1rem;
    max-width: 40ch;
}

.error-page__home {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: #2C3947;
    color: #E8EDF2;
    text-decoration: none;
    border-radius: 8px;
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.error-page__home:hover {
    background: #C2A56D;
    color: #1E2830;
}

/* ---------- Accessibility ---------- */
:focus-visible {
    outline: 2px solid #C2A56D;
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: #C2A56D;
    color: #1E2830;
    padding: 0.5rem 1rem;
    border-radius: 0 0 6px 6px;
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.85rem;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus { top: 0; }
/* =========================================
   Gallery
   ========================================= */

.gallery-wrapper {
    margin: 2rem 0;
}

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

.gallery__item {
    margin: 0;
    overflow: hidden;
    border-radius: 6px;
}

.gallery__item a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gallery__item img:hover {
    transform: scale(1.03);
}

.gallery__item figcaption {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    color: #547A95;
    font-family: 'Onest', sans-serif;
}

/* Wide variant — breaks out slightly */
.gallery-wrapper--wide .gallery {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* Full-width variant */
.gallery-wrapper--full {
    width: 100%;
}

.gallery-wrapper--full .gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
/* =========================================
   Pagination
   ========================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1.5rem;
    flex-wrap: wrap;
}

.pagination__pages {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.4rem;
}

.pagination__page,
.pagination__current,
.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.6rem;
    border-radius: 6px;
    font-family: 'Spline Sans Mono', monospace;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.pagination__page {
    background: transparent;
    color: #2C3947;
    border: 1px solid #2C3947;
}

.pagination__page:hover {
    background: #C2A56D;
    border-color: #C2A56D;
    color: #E8EDF2;
}

.pagination__current {
    background: #2C3947;
    color: #E8EDF2;
    border: 1px solid #2C3947;
    font-weight: 600;
}

.pagination__link {
    background: transparent;
    color: #2C3947;
    border: 1px solid #2C3947;
    font-size: 0.85rem;
}

.pagination__link:hover {
    background: #C2A56D;
    border-color: #C2A56D;
    color: #E8EDF2;
}
