/*
Theme Name: Keiwan Fatehi
Theme URI: https://keiwanfatehi.com
Author: Keiwan Fatehi
Author URI: https://keiwanfatehi.com
Description: A custom, minimal photography portfolio theme for Keiwan Fatehi. Includes Stories, Portfolio, Exhibitions, and a responsive front page experience.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.8.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kfatehi
Tags: photography, portfolio, featured-images, custom-menu, responsive-layout
*/

/* Basic reset */
:root {
    --kf-font-sans: 'Inter', sans-serif;
    --kf-font-serif: 'Playfair Display', serif;

    --kf-color-paper: #fcfbf9;
    --kf-color-charcoal: #1a1a1a;
    --kf-color-soft-gray: #8e8e8e;
}

#kf-lightbox .kf-lightbox__nav--hidden {
    display: none !important;
}

/* Allow text selection site-wide (override any accidental user-select: none). */
html, body {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/* Global text selection highlight */
::selection {
  background: var(--kf-color-charcoal);
  color: var(--kf-color-paper);
}

::-moz-selection {
  background: var(--kf-color-charcoal);
  color: var(--kf-color-paper);
}

/* Alignment helpers (override Tailwind utility classes when needed). */
.kf-text-left {
  text-align: left !important;
}

body {
    margin: 0;
    font-family: var(--kf-font-sans);
    background: var(--kf-color-paper);
    color: var(--kf-color-charcoal);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--kf-font-serif);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* =====================================================
   Global Vernier button (shared CTA)
   ===================================================== */

.kf-btn {
    --kf-btn-fg: var(--kf-color-charcoal);
    --kf-btn-line: var(--kf-btn-fg);
    --kf-btn-muted: rgba(26, 26, 26, 0.30);
    --kf-btn-corner: 8px;
    --kf-btn-tick-offset: 8px;

    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 0 30px;

    background: transparent;
    border: 0;
    color: var(--kf-btn-fg);
    cursor: pointer;
    text-decoration: none;

    font-family: var(--kf-font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;

    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;

    background-repeat: no-repeat;
    background-image:
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line));
    background-position:
        left top,
        left top,
        right top,
        right top,
        left bottom,
        left bottom,
        right bottom,
        right bottom;
    background-size:
        0 1px,
        1px 0,
        0 1px,
        1px 0,
        0 1px,
        1px 0,
        0 1px,
        1px 0;

    transition:
        letter-spacing 700ms ease,
        background-size 300ms cubic-bezier(0.2, 1, 0.3, 1),
        color 300ms ease;
}

.kf-btn::before,
.kf-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 65px;
    height: 12px;
    opacity: 0.5;
    pointer-events: none;

    background-repeat: no-repeat;
    background-image:
        linear-gradient(var(--kf-btn-muted), var(--kf-btn-muted)),
        linear-gradient(var(--kf-btn-muted), var(--kf-btn-muted)),
        linear-gradient(var(--kf-btn-line), var(--kf-btn-line)),
        linear-gradient(var(--kf-btn-muted), var(--kf-btn-muted)),
        linear-gradient(var(--kf-btn-muted), var(--kf-btn-muted));
    background-position:
        0 0,
        16px 2px,
        32px 0,
        48px 2px,
        64px 0;
    background-size:
        1px 12px,
        1px 8px,
        1px 12px,
        1px 8px,
        1px 12px;

    transition:
        transform 1000ms cubic-bezier(0.2, 1, 0.3, 1),
        opacity 300ms cubic-bezier(0.2, 1, 0.3, 1);
}

.kf-btn::before {
    top: var(--kf-btn-tick-offset);
    transform: translateX(-50%) translateX(-36px);
}

.kf-btn::after {
    bottom: var(--kf-btn-tick-offset);
    transform: translateX(-50%) translateX(36px);
}

.kf-btn:hover {
    letter-spacing: 0.3em;
    background-size:
        var(--kf-btn-corner) 1px,
        1px var(--kf-btn-corner),
        var(--kf-btn-corner) 1px,
        1px var(--kf-btn-corner),
        var(--kf-btn-corner) 1px,
        1px var(--kf-btn-corner),
        var(--kf-btn-corner) 1px,
        1px var(--kf-btn-corner);
}

.kf-btn:hover::before,
.kf-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateX(0);
}

.kf-btn:focus-visible {
    outline: 1px solid var(--kf-btn-line);
    outline-offset: 5px;
}

.kf-btn--sm {
    min-height: 52px;
    padding: 0 22px;
    --kf-btn-tick-offset: 6px;
}

.kf-btn--invert {
    --kf-btn-fg: #ffffff;
    --kf-btn-line: #ffffff;
    --kf-btn-muted: rgba(255, 255, 255, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .kf-btn,
    .kf-btn::before,
    .kf-btn::after {
        transition: none !important;
    }
}

/* =====================================================
   Global sidebar navigation (hamburger + off-canvas)
   ===================================================== */

.kf-hamburger-btn {
    position: fixed;
    top: calc(32px + env(safe-area-inset-top));
    left: calc(32px + env(safe-area-inset-left));
    z-index: 100000;
    border: 0;
    background: transparent;
    padding: 12px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--kf-color-charcoal);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.kf-hamburger-btn--on-dark {
    color: #ffffff;
    mix-blend-mode: difference;
}

@media (max-width: 768px) {
    .kf-hamburger-btn {
        top: calc(16px + env(safe-area-inset-top));
        left: calc(16px + env(safe-area-inset-left));
    }
}

.kf-hamburger-btn__lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.kf-hamburger-btn__line {
    display: block;
    width: 32px;
    height: 2px;
    background: currentColor;
    transition: width 300ms ease, transform 300ms ease, opacity 300ms ease;
}

.kf-hamburger-btn:hover .kf-hamburger-btn__line--1 {
    width: 40px;
}

.kf-hamburger-btn:hover .kf-hamburger-btn__line--2 {
    width: 24px;
}

body.kf-sidebar-open .kf-hamburger-btn__line--1 {
    transform: rotate(45deg) translate(5px, 6px);
}

body.kf-sidebar-open .kf-hamburger-btn__line--2 {
    opacity: 0;
}

body.kf-sidebar-open .kf-hamburger-btn__line--3 {
    transform: rotate(-45deg) translate(5px, -6px);
}

.kf-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease;
}

body.kf-sidebar-open .kf-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.kf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 320px;
    z-index: 99999;
    background: var(--kf-color-paper);
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: translateX(-100%);
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.kf-sidebar-open .kf-sidebar {
    transform: translateX(0);
}

.kf-sidebar__nav {
    margin-top: 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.kf-sidebar__link {
    font-family: var(--kf-font-serif);
    font-size: 30px;
    line-height: 1.1;
    color: var(--kf-color-charcoal);
    text-decoration: none;
}

.kf-sidebar__link:hover {
    color: var(--kf-color-soft-gray);
}

.kf-sidebar__footer {
    font-family: var(--kf-font-sans);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(26, 26, 26, 0.45);
}

.kf-sidebar__meta-link {
    display: inline-block;
    font-family: var(--kf-font-sans);
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(26, 26, 26, 0.45);
    text-decoration: none;
    margin-bottom: 14px;
}

.kf-sidebar__meta-link:hover {
    color: rgba(26, 26, 26, 0.70);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.kf-sidebar__copyright {
    font-family: var(--kf-font-sans);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(26, 26, 26, 0.45);
}

@media (max-width: 520px) {
    .kf-sidebar {
        width: 280px;
        padding: 36px;
    }
}

/* Slider Styles */
.slider {
    display: flex;
    transition: transform 1s ease-in-out;
    height: 100vh;
}

.slide {
    flex: 0 0 100%;
    position: relative;
    cursor: pointer;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.slide:hover img {
    transform: scale(1.05);
    filter: brightness(70%);
}

/* Info box bottom-left */
.info-box {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: white;
    color: black;
    padding: 1.5rem;
    max-width: 300px;
    z-index: 10;
    font-size: 1rem;
}

/* Slider controls */
.slider-controls button {
    background: white;
    color: black;
    border: none;
    padding: 0.5rem 1rem;
    font-weight: bold;
}

.slider-controls button:hover {
    background: black;
    color: white;
}

/* Immersive fullscreen */
.immersive {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 50;
    overflow-y: auto;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

.immersive.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.immersive-hero {
    position: relative;
    width: 100%;
    height: 100vh;
}

.immersive-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.immersive-content {
    padding: 4rem 2rem;
    max-width: 900px;
    margin: auto;
    color: white;
}

.immersive-content img {
    width: 100%;
    margin-bottom: 2rem;
    border: none;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 1.5s infinite;
    font-size: 2rem;
    color: white;
    opacity: 0.8;
}

@keyframes bounce {
    0%, 100% {
        transform: translate(-50%, 0);
    }
    50% {
        transform: translate(-50%, 10px);
    }
}

/* Enhanced photo metadata styling */
.photo-metadata {
    margin-bottom: 2rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.camera-settings,
.additional-details,
.story-context {
    margin-top: 1rem;
}

.camera-settings h4,
.additional-details h4 {
    color: white;
    margin-bottom: 0.5rem;
}

.camera-settings .grid > div,
.additional-details .grid > div {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Enhanced meta box styling in admin */
.enhanced-meta-box {
    max-width: 800px;
}

.gallery-item fieldset {
    background: white;
    border-radius: 8px;
}

.gallery-item input, 
.gallery-item textarea {
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

.gallery-item input:focus, 
.gallery-item textarea:focus {
    border-color: var(--kf-color-charcoal);
    outline: none;
    box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.35);
}

.gallery-item {
    position: relative;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.gallery-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-item h5 {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--kf-color-charcoal);
}

.gallery-item fieldset {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    background: #fff;
}

.gallery-item fieldset legend {
    font-weight: bold;
    color: #333;
    padding: 0 10px;
}

.gallery-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.gallery-item input[type="text"],
.gallery-item input[type="date"],
.gallery-item textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.gallery-item input[type="text"]:focus,
.gallery-item input[type="date"]:focus,
.gallery-item textarea:focus {
    border-color: var(--kf-color-charcoal);
    box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.35);
}

/* Button styling */
.button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
}

.button:hover {
    background: #005a87;
}

.button-primary {
    background: #0073aa;
}

.button-primary:hover {
    background: #005a87;
}

.remove-gallery-item {
    background: #dc3545 !important;
    color: white !important;
}

.remove-gallery-item:hover {
    background: #c82333 !important;
}

/* Image preview */
[data-image-preview] {
    border: 2px solid #ddd;
    border-radius: 8px;
    max-width: 200px;
    height: auto;
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .info-box {
        max-width: 200px;
        padding: 1rem;
    }
    
    .immersive-content {
        padding: 2rem 1rem;
    }
    
    .camera-settings .grid,
    .additional-details .grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-item {
        padding: 15px;
    }
    
    /* Mobile slider adjustments */
    .slider {
        height: 100vh;
    }
    
    .slide img {
        object-fit: cover;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Print styles */
@media print {
    .immersive {
        position: relative;
        width: 100%;
        height: auto;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    
    .slider-controls {
        display: none;
    }
    
    .immersive-hero {
        height: auto;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .info-box {
        background: black;
        color: white;
        border: 2px solid white;
    }
    
    .immersive {
        background: black;
    }
    
    .immersive-content {
        color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .slider {
        transition: none;
    }
    
    .slide img {
        transition: none;
    }
    
    .slide:hover img {
        transform: none;
    }
    
    .scroll-indicator {
        animation: none;
    }
    
    .immersive {
        transition: none;
    }
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.pt-4 {
    padding-top: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.space-y-12 > * + * {
    margin-top: 3rem;
}

.border-b {
    border-bottom-width: 1px;
}

.border-t {
    border-top-width: 1px;
}

.border-white {
    border-color: white;
}

.inline-block {
    display: inline-block;
}

.bg-white {
    background-color: white;
}

.bg-black {
    background-color: black;
}

.bg-opacity-70 {
    background-opacity: 0.7;
}

.text-black {
    color: black;
}

.text-gray-300 {
    color: #d1d5db;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.text-sm {
    font-size: 0.875rem;
}

.absolute {
    position: absolute;
}

.relative {
    position: relative;
}

.fixed {
    position: fixed;
}

.top-6 {
    top: 1.5rem;
}

.right-8 {
    right: 2rem;
}

.bottom-4 {
    bottom: 1rem;
}

.right-6 {
    right: 1.5rem;
}

.z-50 {
    z-index: 50;
}

/* Flexbox utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.h-screen {
    height: 100vh;
}

.w-full {
    width: 100%;
}

.w-1\/5 {
    width: 20%;
}

.w-4\/5 {
    width: 80%;
}

/* WordPress specific overrides */
#wpadminbar {
    display: none !important;
}

html {
    margin-top: 0 !important;
}

/* Border utilities */
.border {
    border-width: 1px;
}

.border-black {
    border-color: black;
}

.border-r {
    border-right-width: 1px;
}

/* Spacing utilities */
.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.space-x-2 > * + * {
    margin-left: 0.5rem;
}

/* Hover transitions */
.hover\:pl-2:hover {
    padding-left: 0.5rem;
}

.transition-all {
    transition: all 0.3s ease;
}

/* Tracking utilities */
.tracking-widest {
    letter-spacing: 0.1em;
}

.tracking-wide {
    letter-spacing: 0.025em;
}

/* WordPress admin bar removal for logged in users */
body.admin-bar {
    margin-top: 0 !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar {
        margin-top: 0 !important;
    }
}

/* Smooth fade animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =====================================================
   Global minimal lightbox (image-only)
   ===================================================== */

#kf-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    padding: 24px;
}

#kf-lightbox.kf-lightbox--open {
    display: flex;
}

#kf-lightbox .kf-lightbox__img {
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 16px 50px rgba(0,0,0,0.45);
    touch-action: pan-y pinch-zoom;
    -webkit-user-drag: none;
    user-select: none;
}

#kf-lightbox {
    touch-action: pan-y pinch-zoom;
}

#kf-lightbox .kf-lightbox__nav,
#kf-lightbox .kf-lightbox__close {
    position: absolute;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    user-select: none;
}

#kf-lightbox .kf-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: 44px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#kf-lightbox .kf-lightbox__prev { left: 16px; }
#kf-lightbox .kf-lightbox__next { right: 16px; }

#kf-lightbox .kf-lightbox__close {
    top: 12px;
    right: 16px;
    font-size: 40px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#kf-lightbox .kf-lightbox__nav:hover,
#kf-lightbox .kf-lightbox__close:hover {
    color: rgba(255, 255, 255, 1);
}
