/* ==========================================================================
   AKIB JABED — ATELIER EDITION (v3)
   Swiss Editorial Design System with Dark Atelier & Light Print Themes
   ========================================================================== */

:root {
    --bg: #0b0b0c;
    --bg-elevated: #131316;
    --bg-subtle: #1a1a1f;
    --ink: #f4f0e8;
    --ink-muted: #a49e93;
    --ink-faint: #6c675f;
    --hairline: rgba(244, 240, 232, 0.1);
    --hairline-strong: rgba(244, 240, 232, 0.22);
    --accent: #ff4d2e;
    --accent-ink: #ffffff;
    --accent-soft: rgba(255, 77, 46, 0.14);
    --glass: rgba(14, 14, 17, 0.48);
    --nav-ink: #f4f0e8;
    --nav-ink-muted: rgba(244, 240, 232, 0.78);
    --nav-btn-bg: rgba(255, 255, 255, 0.06);
    --shadow-card: 0 20px 50px -20px rgba(0, 0, 0, 0.75);
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f1ea;
    --bg-elevated: #ffffff;
    --bg-subtle: #eae5db;
    --ink: #0f0f12;
    --ink-muted: #3f3b36;
    --ink-faint: #635d55;
    --hairline: rgba(15, 15, 18, 0.13);
    --hairline-strong: rgba(15, 15, 18, 0.26);
    --accent: #df3a1d;
    --accent-ink: #ffffff;
    --accent-soft: rgba(223, 58, 29, 0.1);
    --glass: rgba(245, 242, 235, 0.62);
    --nav-ink: #121214;
    --nav-ink-muted: rgba(18, 18, 20, 0.76);
    --nav-btn-bg: rgba(18, 18, 20, 0.06);
    --shadow-card: 0 20px 44px -22px rgba(18, 18, 20, 0.18);
}

html {
    background-color: var(--bg);
    color: var(--ink);
    color-scheme: dark;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.35s ease, color 0.35s ease;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    overflow-x: clip;
}

.font-display { font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.font-serif-editorial { font-family: 'Instrument Serif', Georgia, serif; }
.font-mono-tech { font-family: 'JetBrains Mono', monospace; }

/* Subtle Editorial Grain Overlay */
.bg-grain {
    background-image: radial-gradient(rgba(244, 240, 232, 0.04) 1px, transparent 0);
    background-size: 28px 28px;
}
html[data-theme="light"] .bg-grain {
    background-image: radial-gradient(rgba(18, 18, 20, 0.05) 1px, transparent 0);
}

.ambient-wash {
    background: radial-gradient(55% 45% at 78% 12%, var(--accent-soft) 0%, transparent 72%);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Surfaces & Borders */
.atelier-header {
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid var(--hairline);
}

.atelier-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--hairline);
    transition: transform 0.45s var(--ease-expo), border-color 0.3s ease, box-shadow 0.45s var(--ease-expo);
}
.atelier-card:hover {
    border-color: var(--hairline-strong);
    box-shadow: var(--shadow-card);
    transform: translateY(-3px);
}

.atelier-pill {
    background-color: var(--bg-subtle);
    border: 1px solid var(--hairline);
    color: var(--ink-muted);
}

.atelier-input {
    background-color: var(--bg);
    border: 1px solid var(--hairline);
    color: var(--ink);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.atelier-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.atelier-input::placeholder { color: var(--ink-faint); }

.text-ink { color: var(--ink); }
.text-ink-muted { color: var(--ink-muted); }
.text-ink-faint { color: var(--ink-faint); }
.text-accent { color: var(--accent); }
.bg-accent { background-color: var(--accent); color: var(--accent-ink); }
.border-hairline { border-color: var(--hairline); }

/* Primary & Secondary Buttons */
.btn-primary {
    background-color: var(--accent);
    color: var(--accent-ink);
    transition: transform 0.25s var(--ease-expo), filter 0.25s ease, box-shadow 0.3s ease;
}
.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 12px 30px -10px rgba(255, 77, 46, 0.55);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--ink);
    border: 1px solid var(--hairline-strong);
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-expo);
}
.btn-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--ink);
    transform: translateY(-1px);
}

/* Editorial Ticker */
@keyframes ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}
.ticker-track {
    display: flex;
    flex-shrink: 0;
    white-space: nowrap;
    will-change: transform;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused !important; }

/* GPU-Accelerated Reveal */
.reveal-up {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition: opacity 0.7s var(--ease-expo), transform 0.7s var(--ease-expo);
    will-change: opacity, transform;
}
.reveal-scale {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.98);
    transition: opacity 0.65s var(--ease-expo), transform 0.65s var(--ease-expo);
    will-change: opacity, transform;
}
.is-revealed {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

/* Gallery Adaptive Flex */
.gallery-item { flex: 1 1 auto; }
@media (min-width: 768px) {
    .gallery-item { flex: var(--desktop-flex, 1 1 0%); }
}

.group\/photo.tap-active .photo-overlay {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto;
}

/* Skeleton Loader */
.skeleton-loader {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-subtle) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
    transition: opacity 0.35s ease;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hamburger */
.hamburger-line {
    display: block;
    height: 1.75px;
    background-color: var(--ink);
    border-radius: 999px;
    transition: transform 0.3s var(--ease-expo), width 0.3s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.hamburger-line-1 { width: 100%; }
.hamburger-line-2 { width: 65%; margin-left: auto; }
.hamburger-line-3 { width: 100%; }
#hamburger-icon.open .hamburger-line { background-color: var(--accent); }
#hamburger-icon.open .hamburger-line-1 { transform: translateY(6.5px) rotate(45deg); width: 100%; }
#hamburger-icon.open .hamburger-line-2 { opacity: 0; width: 0%; }
#hamburger-icon.open .hamburger-line-3 { transform: translateY(-6.5px) rotate(-45deg); width: 100%; }

/* Focus Accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal-up, .reveal-scale { opacity: 1 !important; transform: none !important; transition: none !important; }
    .ticker-track, .skeleton-loader { animation: none !important; }
}

/* Prevent iOS Safari auto-zoom when focusing inputs/forms on mobile */
@media (max-width: 767px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* Dynamic-Island Unified Glass Capsule Navigation */
.nav-capsule {
    background: var(--glass);
    backdrop-filter: blur(26px) saturate(190%);
    -webkit-backdrop-filter: blur(26px) saturate(190%);
    border: 1px solid rgba(244, 240, 232, 0.18);
    box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
html[data-theme="light"] .nav-capsule {
    border: 1px solid rgba(15, 15, 18, 0.16);
    box-shadow: 0 16px 38px -12px rgba(15, 15, 18, 0.18), 0 2px 10px -2px rgba(15, 15, 18, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

#desktop-nav-indicator {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    border-radius: 9999px;
    background-color: var(--ink);
    transition: transform 0.38s var(--ease-expo), width 0.38s var(--ease-expo), opacity 0.25s ease;
    pointer-events: none;
    z-index: 0;
}

.desktop-nav-link {
    position: relative;
    z-index: 1;
    color: var(--ink-muted);
    transition: color 0.25s ease;
}
.desktop-nav-link:hover { color: var(--ink); }
.desktop-nav-link.is-active { color: var(--bg); }

/* Smooth 60fps Single-Capsule Mobile Tray Expansion */
#mobile-tray-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.42s var(--ease-expo), opacity 0.3s ease;
    opacity: 0;
}
#mobile-capsule.is-open #mobile-tray-wrap {
    grid-template-rows: 1fr;
    opacity: 1;
}
#mobile-tray-inner {
    overflow: hidden;
}

@keyframes breathLine1 { 0%, 100% { width: 100%; } 50% { width: 58%; } }
@keyframes breathLine2 { 0%, 100% { width: 58%; } 50% { width: 100%; } }
@keyframes breathLine3 { 0%, 100% { width: 100%; } 50% { width: 72%; } }

#hamburger-icon.is-idle .hamburger-line-1 { animation: breathLine1 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
#hamburger-icon.is-idle .hamburger-line-2 { animation: breathLine2 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
#hamburger-icon.is-idle .hamburger-line-3 { animation: breathLine3 3.1s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
#hamburger-icon.open .hamburger-line { animation: none !important; }

.mobile-link-item {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
#mobile-capsule.is-open .mobile-link-item {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s var(--ease-expo) calc(var(--stagger, 0) * 45ms + 80ms),
                transform 0.4s var(--ease-expo) calc(var(--stagger, 0) * 45ms + 80ms),
                background-color 0.2s ease, color 0.2s ease;
}

/* Adaptive Contrast & Translucent Mobile Nav Buttons */
.nav-capsule {
    color: var(--nav-ink);
}
.nav-capsule .desktop-nav-link {
    color: var(--nav-ink-muted);
}
.nav-capsule .desktop-nav-link:hover {
    color: var(--nav-ink);
}
.nav-capsule .desktop-nav-link.is-active {
    color: var(--bg);
}
.nav-btn-glass {
    background-color: var(--nav-btn-bg);
    border: 1px solid var(--hairline);
    color: var(--nav-ink);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.nav-capsule .mobile-link-item {
    color: var(--nav-ink);
}

/* Angular Fine-Grain Card Texture (Cards Only — Buttons & Inputs Stay Crisp) */
.atelier-card {
    background-color: var(--bg-elevated);
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
        linear-gradient(128deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.01) 42%, rgba(0, 0, 0, 0.14) 100%);
    background-size: 160px 160px, 100% 100%;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="light"] .atelier-card {
    background-color: #ffffff;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.024'/%3E%3C/svg%3E"),
        linear-gradient(128deg, #ffffff 0%, #fcfaf6 60%, #f5f1e8 100%);
    background-size: 160px 160px, 100% 100%;
    box-shadow: inset 0 1px 0 #ffffff, 0 8px 24px -18px rgba(15, 15, 18, 0.16);
}

/* Keep Contact Form surface clean & solid without card gradient/noise */
#contact-form {
    background-image: none !important;
    background-color: var(--bg-elevated) !important;
}

/* Crisp, Guaranteed-Contrast Hover States for Social Directory & Work Profile Cards */
.social-icon-box {
    background-color: var(--bg-subtle);
    border: 1px solid var(--hairline);
    color: var(--ink);
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.group:hover .social-icon-box {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.social-action-btn {
    background-color: var(--bg);
    border: 1px solid var(--hairline-strong);
    color: var(--ink);
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.group:hover .social-action-btn {
    background-color: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

/* iOS Edge-to-Edge Fullscreen Safe Area Support (Zero Bottom Tint Bar) */
#main-nav {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    padding-top: 0;
}
@media (max-width: 767px) {
    #back-to-top {
        bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    }
}
