/*
Theme Name:   Kadence Child - Federico Gallo
Description:  Child theme for Federico Gallo Photography Portfolio
Template:     kadence
Version:      2.1.3
Text Domain:  kadence-child
*/

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Roboto+Condensed:wght@300;400;500;700&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: #f5f4f0;
    font-family: 'Roboto Condensed', sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none; /* prevent pull-to-refresh bleed on iOS */
}

/* overflow-x intentionally not set on html or body —
   setting either on iOS Safari hijacks the native scroll container
   and causes the "refuses to scroll" stutter. The flex layout
   does not produce horizontal overflow so no clip is needed. */

/* OVERRIDE KADENCE GLOBAL PALETTE & LINK STATES */
:root {
    --global-palette1: #1a1917 !important;
    --global-palette2: #1a1917 !important;
    --global-palette-highlight: #1a1917 !important;
    --global-palette-highlight-alt: #1a1917 !important;
    --global-palette-highlight-alt2: #1a1917 !important;
}
#fg-sidebar a:active,
#fg-sidebar a:focus,
#fg-sidebar .fg-nav-main a:active,
#fg-sidebar .fg-nav-main a:focus,
#fg-sidebar .fg-nav-categories a:active,
#fg-sidebar .fg-nav-categories a:focus {
    color: #1a1917 !important;
    outline: none !important;
}

/* HIDE KADENCE CHROME */
.site-header, .kadence-sticky-header, #masthead,
.site-footer, .entry-hero-section-inner, .entry-header,
.page-title, h1.entry-title, .wp-block-post-title,
.wp-block-navigation, .wp-block-navigation-item,
nav.site-navigation, .primary-menu-container,
ul.menu, .nav-menu, #site-navigation, .main-navigation,
.kadence-navigation, .header-navigation, .mobile-navigation,
.site-above-header-wrap, .site-below-header-wrap,
.site-top-header-wrap, .kadence-breadcrumbs,
.entry-taxonomies, .entry-meta, .entry-footer,
.post-navigation, .comments-area { display: none !important; }

#fg-main > nav, #fg-main > header,
#fg-main .wp-block-navigation, #fg-main ul.menu { display: none !important; }

.site-main, .entry-content-wrap, .content-wrap,
.wp-site-blocks, .container, .site-container,
article, .entry-content, .post-content,
.inner-wrap, #primary, #main,
.wp-block-post-content, .alignfull {
    padding: 0 !important; margin: 0 !important;
    max-width: 100% !important; width: 100% !important;
}

/* LAYOUT */
.site {
    display: flex !important;
    flex-direction: row !important;
    min-height: 100%;
    margin: 0 !important; padding: 0 !important;
}

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
#fg-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    /* Avoid 100vh — on iOS Safari the viewport height changes as the
       address bar shows/hides, causing layout repaint mid-scroll.
       top:0 + bottom:0 achieves the same full-height without that cost. */
    background: var(--fg-sidebar-bg, #ffffff);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: var(--fg-sidebar-padding-v, 80px) var(--fg-sidebar-padding-h, 24px);
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* momentum scroll on iOS */
    /* border-right removed per client request */
}
#fg-sidebar::-webkit-scrollbar { display: none; }
#fg-sidebar { scrollbar-width: none; -ms-overflow-style: none; }

/* Site title */
#fg-sidebar .fg-logo {
    font-family: var(--fg-logo-font, 'Cormorant Garamond', Georgia, serif);
    font-size: var(--fg-logo-size, 18px);
    font-weight: var(--fg-logo-weight, 300);
    font-style: var(--fg-logo-style, italic);
    color: var(--fg-logo-color, #1a1917);
    letter-spacing: 0.04em;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    display: block;
    overflow: visible;
    width: max-content;
    max-width: calc(100% + 20px);
    position: relative;
    left: var(--fg-logo-txt-offset-x, 0);
    top: var(--fg-logo-txt-offset-y, 0);
    transition: opacity 0.25s ease;
}
#fg-sidebar .fg-logo:hover { opacity: 0.55; }
#fg-sidebar .fg-logo img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--fg-logo-image-radius, 0);
    position: relative;
    left: var(--fg-logo-img-offset-x, 0);
    top: var(--fg-logo-img-offset-y, 0);
}
#fg-sidebar .fg-logo::after {
    content: '';
    display: var(--fg-logo-line-display, block);
    width: var(--fg-logo-line-width, 24px);
    height: var(--fg-logo-line-thickness, 1px);
    background: var(--fg-logo-line-color, #1a1917);
    margin-top: var(--fg-logo-line-margin-top, 18px);
    margin-bottom: var(--fg-logo-line-margin-bottom, 40px);
    position: relative;
    left: var(--fg-logo-line-offset, 0px);
    transition: width 0.4s ease;
}
#fg-sidebar .fg-logo:hover::after { width: calc(var(--fg-logo-line-width, 24px) + 20px); }

/* Nav reset */
#fg-sidebar nav { margin-top: 48px; }
#fg-sidebar nav ul { list-style: none; margin: 0; padding: 0; }
#fg-sidebar nav ul li { margin: 0; padding: 0; }

/* Shared nav link style */
.fg-nav-main li,
.fg-nav-categories li {
    position: relative;
}
.fg-nav-main li a,
.fg-nav-categories li a {
    font-family: var(--fg-nav-font, Helvetica, Arial, sans-serif);
    font-size: var(--fg-nav-font-size, 13px);
    font-weight: var(--fg-nav-weight, 300);
    color: #1a1917;
    letter-spacing: 0.01em;
    line-height: 1.8em;
    font-style: normal;
    font-variant: normal;
    text-transform: none;
    text-decoration: none;
    white-space: normal;
    display: block;
    padding: 1px 0;
    position: relative;
    transform: translateX(0);
    transition: color 0.2s ease, transform 0.2s ease;
}

/* Hover */
.fg-nav-main li a:hover,
.fg-nav-categories li a:hover {
    color: #333333;
    transform: translateX(3px);
}

/* Active */
.fg-nav-main li.current-menu-item > a,
.fg-nav-main li.current_page_item > a,
.fg-nav-categories li.active > a {
    color: #1a1917 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

/* Gap between Home/About and categories */
.fg-nav-main { margin-bottom: var(--fg-sep-margin, 32px); }

/* Categories list */
.fg-nav-categories { display: flex; flex-direction: column; }

/* ════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════ */
#fg-main {
    margin-left: 300px;
    width: calc(100% - 300px);
    min-height: 100vh;
    background: #f5f4f0;
    /* Tell iOS Safari this area scrolls vertically —
       prevents the browser from hesitating on touch */
    touch-action: pan-y;
    /* Flex column so footer is always pushed to the bottom */
    display: flex;
    flex-direction: column;
}

/* Smooth page fade-in */
#fg-main {
    animation: fg-fadein 0.45s ease forwards;
}
@keyframes fg-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* MASONRY GRID */
.fg-grid {
    padding: 4px !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    touch-action: pan-y;
}
.fg-grid::after { content: ''; display: block; clear: both; }
.fg-grid-item {
    float: left;
    margin-bottom: 4px;
    overflow: hidden;
    line-height: 0; font-size: 0;
}
.fg-grid-item a { display: block; line-height: 0; overflow: hidden; }

/* Images fade in individually */
.fg-grid-item img {
    width: 100%; height: auto; display: block; cursor: pointer;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fg-grid-item img.fg-img-loaded {
    opacity: 1;
}
.fg-grid-item a:hover img { transform: scale(1.04); }

/* ABOUT PAGE */
.fg-about-content { max-width: 100%; padding: 60px 80px; text-align: left; }
.fg-about-content h1, .fg-about-content h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300; font-style: italic; font-size: 42px;
    color: #1a1a1a; margin: 0 0 40px; line-height: 1.1;
}
.fg-about-content p {
    font-family: 'Roboto Condensed', sans-serif; font-size: 15px; font-weight: 300;
    line-height: 2; color: #1a1917; margin-bottom: 28px; margin-top: 0;
}
.fg-about-content p:empty {
    display: none;
}

/* ═══════════════════════════════════════
   MOBILE NAV — Premium Half-Panel
═══════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.fg-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    flex-shrink: 0;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}
.fg-ham-line {
    display: block;
    height: 1px;
    background: #1a1917;
    transition: width 0.3s ease;
}
.fg-ham-line:nth-child(1) { width: 22px; }
.fg-ham-line:nth-child(2) { width: 14px; }
.fg-ham-line:nth-child(3) { width: 18px; }


/* Half-panel overlay — slides in from right */
#fg-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(80vw, 360px);
    z-index: 99999;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: -12px 0 60px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-direction: column;
}
#fg-mobile-overlay.open {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

/* Dark backdrop behind the panel */
#fg-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.4s ease;
}
#fg-mobile-backdrop.open {
    display: block;
    opacity: 1;
}

/* Close button */
.fg-mobile-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #1a1917;
    opacity: 0.4;
    transition: opacity 0.2s ease;
    line-height: 0;
}
.fg-mobile-close:hover { opacity: 1; }

/* Menu content wrapper */
.fg-mobile-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    padding: 64px 32px 48px;
    min-height: 100%;
}

/* Site name at top of panel */
.fg-mobile-site-name {
    display: block;
    font-family: var(--fg-logo-font, 'Cormorant Garamond', Georgia, serif);
    font-size: var(--fg-logo-size, 18px);
    font-weight: var(--fg-logo-weight, 300);
    font-style: var(--fg-logo-style, italic);
    color: var(--fg-logo-color, #1a1917);
    letter-spacing: 0.1em;
    line-height: 1.2;
    text-decoration: none;
    margin-bottom: 48px;
    transition: opacity 0.25s ease;
}
.fg-mobile-site-name:hover { opacity: 0.45; }

/* Section label — hidden */
.fg-mobile-label {
    display: none;
}

/* Primary links (Home, About) */
.fg-mobile-primary {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
.fg-mobile-primary li {
    overflow: hidden;
    transform: translateY(16px);
    opacity: 0;
    transition:
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 60ms + 60ms),
        opacity   0.4s ease                           calc(var(--i) * 60ms + 60ms);
}
#fg-mobile-overlay.open .fg-mobile-primary li {
    transform: translateY(0);
    opacity: 1;
}
.fg-mobile-primary li a {
    display: block;
    font-family: var(--fg-nav-font, Helvetica, Arial, sans-serif);
    font-size: var(--fg-nav-font-size, 13px);
    font-weight: var(--fg-nav-weight, 300);
    font-style: normal;
    color: #1a1917;
    text-decoration: none;
    padding: 10px 0;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: normal;
    position: relative;
    transition: opacity 0.2s ease;
}
.fg-mobile-primary li a:hover { opacity: 0.45; }
.fg-mobile-primary li a.active {
    color: #1a1917;
    font-weight: 600;
}

/* Divider between primary and categories */
.fg-mobile-divider {
    display: block;
    width: 32px;
    height: 1px;
    background: rgba(0,0,0,0.15);
    margin: 28px auto 28px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.4s ease 0.3s;
}
#fg-mobile-overlay.open .fg-mobile-divider {
    opacity: 1;
}

/* Category links */
.fg-mobile-categories {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
.fg-mobile-categories li {
    overflow: hidden;
    transform: translateY(12px);
    opacity: 0;
    transition:
        transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--j) * 45ms + 180ms),
        opacity   0.35s ease                           calc(var(--j) * 45ms + 180ms);
}
#fg-mobile-overlay.open .fg-mobile-categories li {
    transform: translateY(0);
    opacity: 1;
}
.fg-mobile-categories li a {
    display: block;
    font-family: var(--fg-nav-font, Helvetica, Arial, sans-serif);
    font-size: var(--fg-nav-font-size, 13px);
    font-weight: var(--fg-nav-weight, 300);
    font-style: normal;
    font-variant: normal;
    text-transform: none;
    letter-spacing: 0.01em;
    color: #1a1917;
    text-decoration: none;
    padding: 10px 0;
    line-height: 1;
    white-space: normal;
    position: relative;
    transition: opacity 0.2s ease;
}
.fg-mobile-categories li a:hover { opacity: 0.45; }
.fg-mobile-categories li a.active {
    color: #1a1917;
    font-weight: 600;
}

/* Scroll lock — iOS safe */
body.fg-menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    left: 0 !important;
}
html.fg-menu-open {
    overflow: hidden !important;
}

/* ════════════════════════════════════════════
   RESPONSIVE — LARGE DESKTOP (1400px+)
════════════════════════════════════════════ */
@media (min-width: 1400px) {
    #fg-sidebar {
        width: 320px;
    }
    #fg-main {
        margin-left: 320px;
        width: calc(100% - 320px);
    }
}

/* ════════════════════════════════════════════
   RESPONSIVE — TABLET LANDSCAPE (1025px–1279px)
════════════════════════════════════════════ */
@media (max-width: 1279px) and (min-width: 1025px) {
    #fg-sidebar {
        width: 240px;
    }
    #fg-main {
        margin-left: 240px;
        width: calc(100% - 240px);
    }
    #fg-sidebar .fg-logo {
        font-size: calc(var(--fg-logo-size, 18px) * 0.9);
    }
}

/* ════════════════════════════════════════════
   RESPONSIVE — TABLET PORTRAIT (769px–1024px)
════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {
    #fg-sidebar {
        width: 200px;
        padding: 48px 20px;
    }
    #fg-main {
        margin-left: 200px;
        width: calc(100% - 200px);
        padding-top: 40px;
    }
    #fg-sidebar .fg-logo {
        font-size: calc(var(--fg-logo-size, 18px) * 0.85);
    }
    .fg-about-content {
        max-width: 100%;
        padding: 40px 48px;
    }
    .fg-about-content h1,
    .fg-about-content h2 {
        font-size: 32px;
    }
}

/* ════════════════════════════════════════════
   RESPONSIVE — MOBILE (768px and below)
════════════════════════════════════════════ */
@media (max-width: 768px) {
    #fg-sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 100% !important;
        height: calc(56px + env(safe-area-inset-top));
        flex-direction: row;
        align-items: flex-end; /* push content below the notch */
        justify-content: flex-end;
        padding: 0 20px;
        padding-bottom: 0;
        padding-top: env(safe-area-inset-top);
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        overflow: visible;
        z-index: 9998;
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    #fg-sidebar .fg-logo {
        display: none !important;
    }
    #fg-sidebar .fg-logo::after { display: none; }
    #fg-sidebar > nav { display: none !important; }
    .fg-mobile-toggle {
        display: flex;
        margin-left: 0;
    }
    #fg-main {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: calc(56px + env(safe-area-inset-top)) !important;
    }
    .site { flex-direction: column !important; }
    .fg-about-content {
        max-width: 100%;
        padding: 32px 28px !important;
    }
    .fg-about-content h1,
    .fg-about-content h2 {
        font-size: 28px;
        margin-bottom: 24px;
    }
    .fg-about-content p {
        font-size: 14px;
        line-height: 1.8;
    }
    .fg-grid {
        padding: 0 4px 4px 4px !important;
    }
    .fg-grid-item {
        margin-bottom: 4px !important;
    }
}

/* Separator between Home/About and projects */
.fg-nav-categories-wrap {
    border-top-width: var(--fg-sep-thickness, 1px);
    border-top-style: solid;
    border-top-color: var(--fg-sep-color, #dedad3);
    border-top-width: var(--fg-sep-show, 1px);
    margin-top: var(--fg-sep-margin, 16px) !important;
    padding-top: var(--fg-sep-padding, 16px) !important;
}

/* ── Visual polish & alignment ── */

/* Top spacing — grid starts with breathing room */
#fg-main {
    padding-top: 52px;
}

/* Grid padding matches sidebar top */
.fg-grid {
    padding: 0 8px 8px 8px !important;
}

/* Consistent 6px gap between images */
.fg-grid-item {
    margin-bottom: 6px !important;
}

/* Sizer invisible */
.fg-grid-sizer {
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: left !important;
}

/* Prevent layout shift — reserve space before image loads */
.fg-grid-item {
    background: #eeece8;
}
.fg-grid-item img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
}

/* About page top spacing consistency */
.fg-about-content {
    padding-top: 52px !important;
}

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */


#fg-footer {
    padding: 28px 8px;
    text-align: center;
    margin-top: auto;
}
#fg-footer p {
    margin: 0;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #9e9b97;
    letter-spacing: 0.01em;
    line-height: 1;
}
#fg-footer a {
    color: #9e9b97;
    text-decoration: none;
    transition: color 0.2s ease;
}
#fg-footer a:hover {
    color: #1a1917;
}
@media (max-width: 768px) {
    #fg-footer { padding: 20px; }
}
