/*
Theme Name: MIAOU Theme
Theme URI: https://miaou.x10.mx
Author: Walter
Description: A minimal, warm, mobile-first theme for MIAOU Studio.
Version: 1.3
*/

/* --------------------------------------------------
   COLOR PALETTE (GLOBAL TOKENS)
-------------------------------------------------- */
:root {
    --paw-gold: #F2C94C;
    --peach: #F7D9C4;
    --clay: #C97A40;
    --charcoal: #2F2A26;
    --cream: #FFF8F0;

    --radius-soft: 6px;
    --radius-pill: 999px;

    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
}

/* --------------------------------------------------
   GLOBAL ELEMENTS
-------------------------------------------------- */
body {
    background: var(--cream);
    color: var(--charcoal);
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

a {
    color: var(--clay);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--paw-gold);
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-2);
}

.miaou-tight p {
    margin: 0 !important;
    line-height: 1.3;
}

/* --------------------------------------------------
   HEADER + NAVIGATION
-------------------------------------------------- */

/* Header wrapper — MUST stay positioned for mobile menu anchoring */
.site-header {
    background: var(--charcoal);
    color: var(--cream);
    padding: var(--space-2);
    position: relative; /* essential */
    z-index: 999;       /* ensures header sits above content */
}

.header-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative; /* essential anchor for absolute nav */
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.logo svg {
    width: 32px;
    height: 32px;
    fill: var(--cream);
}

/* Hamburger */
.menu-toggle {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--cream);
    border-radius: 2px;
}

/* --------------------------------------------------
   MOBILE NAVIGATION (FIXED + SAFE)
-------------------------------------------------- */

/* Base nav — hidden, but positioned so .active can reveal it */
.site-nav {
    position: absolute; /* anchor to header-inner */
    top: 100%;
    left: 0;
    right: 0;
    background: var(--charcoal);
    padding: var(--space-2);
    display: none;      /* hidden by default */
    z-index: 1000;      /* above header + content */
}

/* Active state — simply reveal */
.site-nav.active {
    display: block;
}

.site-nav .menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    color: var(--cream);
    font-weight: 500;
}

.site-nav a:hover {
    color: var(--paw-gold);
}

/* Desktop nav */
@media (min-width: 768px) {
    .menu-toggle { display: none; }
    .site-nav {
        position: static;
        display: block;
        padding: 0;
        background: none;
    }
    .site-nav .menu {
        flex-direction: row;
        gap: 1.5rem;
    }
}

/* --------------------------------------------------
   HERO IMAGE
-------------------------------------------------- */
.project-hero {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-bottom: var(--space-3);
    text-align: center;
}

.project-hero img {
    width: 100%;
    max-width: 1000px;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* --------------------------------------------------
   POSTS & PAGES
-------------------------------------------------- */
.post, .page {
    margin-bottom: var(--space-4);
}

.post h1,
.page h1 {
    margin-bottom: var(--space-2);
    color: var(--charcoal);
}

.post h1 a,
.page h1 a {
    color: inherit;
}

.content {
    line-height: 1.7;
}

.featured-image {
    margin-bottom: var(--space-3);
}

.featured-image img {
    width: 100%;
    border-radius: var(--radius-soft);
    max-height: 420px;
    object-fit: cover;
}

/* --------------------------------------------------
   TAG PILLS — UNIFIED SYSTEM
-------------------------------------------------- */
.post-tags,
.miaou-tag-cloud,
.miaou-related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
}

/* Pills */
.post-tags a,
.miaou-related-tags a,
.miaou-tag-cloud a {
    background: var(--peach);
    color: var(--charcoal);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    line-height: 1;
    border: 1px solid rgba(0,0,0,0.05);
    display: inline-block;
    transition: background 0.15s ease, color 0.15s ease;
}

.post-tags a:hover,
.miaou-related-tags a:hover,
.miaou-tag-cloud a:hover {
    background: var(--paw-gold);
}

/* Tag cloud sizes */
.miaou-tag-cloud .tag-small { font-size: 0.9rem; opacity: 0.75; }
.miaou-tag-cloud .tag-medium { font-size: 1rem; }
.miaou-tag-cloud .tag-large { font-size: 1.2rem; }

/* Prevent pills from sliding under peach blocks */
.post-tags {
    position: relative;
    z-index: 2;
    margin-top: 0.75rem;
}

/* --------------------------------------------------
   CTA BOX
-------------------------------------------------- */
.miaou-cta {
    background: var(--peach);
    padding: var(--space-4) var(--space-2);
    border-radius: var(--radius-soft);
    text-align: center;
    margin-top: var(--space-4);
}

/* --------------------------------------------------
   GALLERY
-------------------------------------------------- */
.miaou-gallery {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    background: var(--charcoal);
    padding: var(--space-4) 0;
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    text-align: center;
    color: var(--cream);
}

.miaou-gallery-main {
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.miaou-gallery-main img,
.miaou-gallery-main iframe {
    max-width: 1000px;
    max-height: 100%;
    width: 90vw;
    object-fit: contain;
    border-radius: var(--radius-soft);
}

.miaou-gallery-thumbs {
    margin-top: var(--space-2);
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
}

.miaou-gallery-thumbs img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-soft);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, transform 0.15s;
}

.miaou-gallery-thumbs img.active {
    opacity: 1;
    outline: 2px solid var(--paw-gold);
    transform: scale(1.05);
}

/* --------------------------------------------------
   FORMS + IFRAME FIX
-------------------------------------------------- */

/* Form layout */
.miaou-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

.miaou-form label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
}

.miaou-form input,
.miaou-form textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-soft);
    background: var(--cream);
    font-size: 1rem;
}

.miaou-form button {
    background: var(--charcoal);
    color: var(--cream);
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: var(--radius-soft);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s ease;
}

.miaou-form button:hover {
    background: var(--paw-gold);
    color: var(--charcoal);
}

.miaou-success {
    background: var(--peach);
    color: var(--charcoal);
    padding: var(--space-2);
    border-radius: var(--radius-soft);
    margin-bottom: var(--space-3);
    text-align: center;
    font-weight: 500;
}

/* Responsive iframe — essential */
.miaou-form-wrapper iframe {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
}

/* --------------------------------------------------
   TAG PAGE LISTING
-------------------------------------------------- */
.miaou-tag-post {
    margin-bottom: 2.25rem;
}

.miaou-tag-post-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.miaou-tag-post-link:hover h2 {
    color: var(--clay);
}

/* --------------------------------------------------
   PAGINATION
-------------------------------------------------- */
.miaou-pagination {
    text-align: center;
    margin-top: var(--space-4);
}

.miaou-pagination a {
    color: var(--charcoal);
    padding: 0.4rem 0.8rem;
}

.miaou-pagination .current {
    font-weight: 600;
    color: var(--clay);
}

/* --------------------------------------------------
   FOOTER
-------------------------------------------------- */
.site-footer {
    background: var(--charcoal);
    color: var(--cream);
    text-align: center;
    padding: var(--space-3) var(--space-2);
    font-size: 0.9rem;
    margin-top: var(--space-4);
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto;
}

/* --------------------------------------------------
   LANDING PAGE — CHARCOAL BANNER
   (Safe: fully scoped to landing template)
-------------------------------------------------- */
.page-template-miaou-landing .miaou-charcoal-banner {
    background: var(--charcoal);
    color: var(--cream);
    padding: 4rem 2rem;
    margin: 0 0 4rem 0;
    border-radius: 0;
}

.page-template-miaou-landing .miaou-banner-inner {
    max-width: 720px;
    margin: 0 auto;
}

.page-template-miaou-landing .miaou-banner-big {
    font-size: 2rem;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.page-template-miaou-landing .miaou-banner-small {
    font-size: 1.2rem;
    line-height: 1.4;
    margin: 0;
    opacity: 0.75;
}

/* --------------------------------------------------
   LANDING PAGE — PROJECT SHELF (DYNAMIC)
   (Horizontal scroll, no cards, no snapping)
-------------------------------------------------- */
.page-template-miaou-landing .miaou-project-shelf {
    overflow-x: auto;
    padding: 2rem 0;
    margin-bottom: 4rem;
}

.page-template-miaou-landing .miaou-shelf-inner {
    display: flex;
    gap: 4rem;
    padding: 0 2rem;
}

.page-template-miaou-landing .miaou-shelf-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    min-width: 200px;
}

.page-template-miaou-landing .miaou-shelf-item .title {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.page-template-miaou-landing .miaou-shelf-item .desc {
    opacity: 0.7;
    font-size: 1rem;
    line-height: 1.3;
}

/* Tiny “→ all projects” link */
.page-template-miaou-landing .miaou-shelf-more {
    display: block;
    margin: 1rem 2rem 0;
    font-size: 0.95rem;
    opacity: 0.7;
    text-decoration: none;
}

.page-template-miaou-landing .miaou-shelf-more:hover {
    opacity: 1;
}

/* --------------------------------------------------
   LANDING PAGE — CHARCOAL BANNER
-------------------------------------------------- */
.miaou-charcoal-banner {
    background: var(--charcoal);
    color: var(--cream);
    padding: 4rem 2rem;
    margin: 0 0 4rem 0;
    border-radius: 0;
}

.miaou-banner-inner {
    max-width: 720px;
    margin: 0 auto;
}

.miaou-banner-big {
    font-size: 2rem;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.miaou-banner-small {
    font-size: 1.2rem;
    line-height: 1.4;
    margin: 0;
    opacity: 0.75;
}

/* --------------------------------------------------
   LANDING PAGE — PROJECT SHELF
-------------------------------------------------- */
.miaou-project-shelf {
    overflow-x: auto;
    padding: 2rem 0;
    margin-bottom: 4rem;
}

.miaou-shelf-inner {
    display: flex;
    gap: 4rem;
    padding: 0 2rem;
}

.miaou-shelf-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    min-width: 200px;
}

.miaou-shelf-item .title {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.miaou-shelf-item .desc {
    opacity: 0.7;
    font-size: 1rem;
    line-height: 1.3;
}

/* Tiny “→ all projects” link */
.miaou-shelf-more {
    display: block;
    margin: 1rem 2rem 0;
    font-size: 0.95rem;
    opacity: 0.7;
    text-decoration: none;
}

.miaou-shelf-more:hover {
    opacity: 1;
}

/* --------------------------------------------------
   LANDING PAGE — WORD CLOUD CONSTELLATION
-------------------------------------------------- */
.miaou-landing-cloud {
    margin-top: 4rem;
    margin-bottom: 2rem;
    padding: 0 2rem;
    background: none;
}

.miaou-landing-cloud .tagcloud a {
    opacity: 0.7;
    margin: 0.3rem 0.6rem;
    font-size: 0.9rem !important;
    display: inline-block;
    transform: rotate(-1deg);
}

.miaou-landing-cloud .tagcloud a:nth-child(odd) {
    transform: rotate(1deg);
}

/* --------------------------------------------------
   MOSAIC GRID (4x4)
-------------------------------------------------- */
.miaou-mosaic {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 1rem;
}

/* Mosaic tile */
.mosaic-item {
    position: relative;
    cursor: pointer;
    overflow: visible;
    transition: transform 0.2s ease;
}

/* SVG icon */
.mosaic-icon img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

/* Hover card (hidden by default) */
.mosaic-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    background: var(--cream);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--radius-soft);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hover effect (desktop only) */
@media (hover: hover) {
    .mosaic-item:hover .mosaic-hover {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1);
        z-index: 10;
    }

    .mosaic-item:hover .mosaic-icon img {
        opacity: 0.2;
    }
}

/* --------------------------------------------------
   MOBILE — TAP TO EXPAND INLINE
-------------------------------------------------- */
@media (max-width: 768px) {

    /* 4×4 grid stays intact */
    .miaou-mosaic {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    /* Each tile stays positioned for expansion */
    .mosaic-item {
        position: relative;
    }

    /* Expanded tile spans full width */
    .mosaic-item.expanded {
        grid-column: span 4;
    }

    /* Expanded drawer (full width, compact) */
    .mosaic-item.expanded .mosaic-hover {
        position: relative;
        width: 100%;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        margin-top: 0.5rem;
        background: var(--cream);
        border: 1px solid rgba(0,0,0,0.05);
        border-radius: var(--radius-soft);
        padding: 0.75rem 1rem;
    }

    /* Shrink SVG when expanded */
    .mosaic-item.expanded .mosaic-icon img {
        width: 50px;          /* was full width — now compact */
        height: auto;
        opacity: 0.9;         /* no fade-out on mobile */
        margin: 0 auto 0.5rem;
        display: block;
    }

    /* Center the icon */
    .mosaic-item.expanded .mosaic-icon {
        display: flex;
        justify-content: center;
    }

    /* Compact title */
    .mosaic-item.expanded .mosaic-hover h3 {
        font-size: 1.1rem;
        margin: 0.3rem 0 0.4rem;
        text-align: center;
    }

    /* Compact description */
    .mosaic-item.expanded .mosaic-hover p {
        font-size: 0.9rem;
        line-height: 1.3;
        margin: 0 0 0.4rem;
        text-align: center;
    }

    /* Center the link */
    .mosaic-item.expanded .mosaic-link {
        display: block;
        text-align: center;
        margin-top: 0.4rem;
    }
}

