/* ==========================================================================
   APPLE CLONE - Core Style & Design System
   ========================================================================== */

/* Typography & Variables */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --color-bg-dark: #000000;
    --color-bg-light: #f5f5f7;
    --color-bg-white: #ffffff;

    --color-text-light: #f5f5f7;
    --color-text-dark: #1d1d1f;
    --color-text-muted-dark: #86868b;
    --color-text-muted-light: #a1a1a6;

    --color-link: #0071e3;
    --color-link-hover: #0077ed;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-light: rgba(0, 0, 0, 0.08);

    /* Navigation */
    --nav-height: 44px;
    --nav-bg: rgba(22, 22, 23, 0.8);
    --nav-bg-light: rgba(255, 255, 255, 0.8);
    --nav-blur: blur(20px) saturate(180%);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-medium: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-slow: 0.8s cubic-bezier(0.25, 1, 0.5, 1);

    /* Spacing */
    --section-gap: 12px;
}

/* Reset & Base Elements */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background-color: var(--color-bg-dark);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg-dark);
    color: var(--color-text-dark);
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

ul,
ol {
    list-style: none;
}

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

/* Layout Utilities */
.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 22px;
}

/* ==========================================================================
   1. Glassmorphism Sticky Navigation Bar
   ========================================================================== */
.global-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: var(--nav-bg);
    backdrop-filter: var(--nav-blur);
    -webkit-backdrop-filter: var(--nav-blur);
    z-index: 9999;
    border-bottom: 1px solid var(--color-border);
    transition: background-color var(--transition-medium), border-color var(--transition-medium);
}

.global-nav.scrolled {
    background-color: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
}

.global-nav .nav-container {
    max-width: 1024px;
    height: 100%;
    margin: 0 auto;
    padding: 0 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-list {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item a {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-muted-light);
    letter-spacing: -0.01em;
    display: inline-block;
    transition: color var(--transition-fast), opacity var(--transition-fast);
    opacity: 0.8;
}

.nav-item a:hover {
    color: var(--color-text-light);
    text-decoration: none;
    opacity: 1;
}

.nav-logo svg {
    fill: var(--color-text-muted-light);
    transition: fill var(--transition-fast);
    vertical-align: middle;
}

.nav-logo a:hover svg {
    fill: var(--color-text-light);
}

.nav-icon svg {
    fill: var(--color-text-muted-light);
    transition: fill var(--transition-fast);
}

.nav-icon a:hover svg {
    fill: var(--color-text-light);
}

/* Mobile Navigation Hamburger */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10000;
}

.hamburger-box {
    width: 18px;
    height: 14px;
    display: block;
    position: relative;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 18px;
    height: 1.2px;
    background-color: var(--color-text-muted-light);
    position: absolute;
    transition: transform var(--transition-medium), background-color var(--transition-fast);
}

.hamburger-inner {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-inner::before {
    content: '';
    top: -5px;
}

.hamburger-inner::after {
    content: '';
    bottom: -5px;
}

/* Open state for hamburger */
.menu-open .hamburger-inner {
    background-color: transparent !important;
}

.menu-open .hamburger-inner::before {
    transform: translateY(5px) rotate(45deg);
    background-color: var(--color-text-light);
}

.menu-open .hamburger-inner::after {
    transform: translateY(-5px) rotate(-45deg);
    background-color: var(--color-text-light);
}

/* Fullscreen Menu Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000000;
    z-index: 9998;
    padding: 80px 48px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    overflow-y: auto;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mobile-nav-item {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.mobile-nav-overlay.active .mobile-nav-item {
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-item a {
    font-size: 28px;
    font-weight: 600;
    color: #f5f5f7;
    letter-spacing: -0.015em;
    transition: color var(--transition-fast);
}

.mobile-nav-item a:hover {
    color: var(--color-bg-white);
    text-decoration: none;
}

/* ==========================================================================
   2. Main Layout and Section Spacing
   ========================================================================== */
main {
    margin-top: var(--nav-height);
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
    background-color: var(--color-bg-dark);
}

/* ==========================================================================
   3. Premium Hero Banners
   ========================================================================== */
.hero-section {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    min-height: 580px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 55px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-align: center;
    z-index: 1;
}

/* Dark Theme Hero (e.g., iPhone 16 Pro, Apple Watch) */
.hero-theme-dark {
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
}

.hero-theme-dark .hero-title {
    color: var(--color-bg-white);
}

.hero-theme-dark .hero-subtitle {
    color: var(--color-text-light);
}

/* Light Theme Hero (e.g., iPhone 16) */
.hero-theme-light {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
}

.hero-theme-light .hero-title {
    color: var(--color-text-dark);
}

.hero-theme-light .hero-subtitle {
    color: #1d1d1f;
}

.hero-content {
    max-width: 600px;
    padding: 0 20px;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-size: 56px;
    font-weight: 600;
    line-height: 1.07143;
    letter-spacing: -0.005em;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 28px;
    font-weight: 400;
    line-height: 1.14286;
    letter-spacing: 0.007em;
    margin-bottom: 12px;
}

.hero-extra-text {
    font-size: 19px;
    font-weight: 400;
    color: var(--color-text-muted-dark);
    margin-bottom: 20px;
    letter-spacing: 0.011em;
}

/* Action CTAs */
.hero-ctas {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 20px;
}

.btn-primary {
    display: inline-block;
    padding: 11px 22px;
    font-size: 17px;
    font-weight: 400;
    border-radius: 980px;
    background-color: var(--color-link);
    color: var(--color-text-light);
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover {
    background-color: var(--color-link-hover);
    text-decoration: none;
    transform: scale(1.02);
}

.btn-secondary {
    display: inline-block;
    padding: 11px 22px;
    font-size: 17px;
    font-weight: 400;
    border-radius: 980px;
    border: 1px solid var(--color-link);
    color: var(--color-link);
    background-color: transparent;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.btn-secondary:hover {
    background-color: var(--color-link);
    color: var(--color-text-light);
    text-decoration: none;
    transform: scale(1.02);
}

.btn-link {
    font-size: 21px;
    font-weight: 400;
    color: var(--color-link);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-link::after {
    content: '›';
    font-size: 26px;
    line-height: 1;
    display: inline-block;
    transition: transform var(--transition-fast);
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link:hover::after {
    transform: translateX(3px);
}

/* Scroll indicator on heroes */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 2;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-theme-light .scroll-indicator {
    color: rgba(0, 0, 0, 0.4);
}

.scroll-indicator svg {
    fill: currentColor;
    animation: bounce 2s infinite;
}

/* ==========================================================================
   4. Promotional Grid
   ========================================================================== */
.promo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--section-gap);
    width: 100%;
    padding: 0 var(--section-gap);
    background-color: var(--color-bg-dark);
}

.promo-card {
    position: relative;
    height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 50px;
    text-align: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    background-color: var(--color-bg-light);
}

.promo-card-dark {
    background-color: #0c0c0d;
    color: var(--color-text-light);
}

.promo-card-dark .promo-title {
    color: var(--color-bg-white);
}

.promo-card-light {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
}

.promo-card-light .promo-title {
    color: var(--color-text-dark);
}

.promo-content {
    max-width: 360px;
    padding: 0 20px;
    z-index: 2;
    pointer-events: none;
    /* Allows hover zoom on background when hovering text */
}

.promo-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.promo-logo svg {
    fill: currentColor;
}

.promo-title {
    font-size: 40px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.005em;
    margin-bottom: 6px;
}

.promo-subtitle {
    font-size: 19px;
    font-weight: 400;
    line-height: 1.21053;
    letter-spacing: 0.012em;
    margin-bottom: 12px;
}

.promo-theme-logo-sub {
    font-size: 21px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.promo-ctas {
    display: flex;
    justify-content: center;
    gap: 16px;
    pointer-events: auto;
    /* Re-enable pointer events for links */
}

/* Background image elements in heroes and promo cards for zoom effects */
.bg-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform var(--transition-slow);
}

/* Custom styling for specific cards */
/* Apple TV+ dynamic overlay */
.promo-tv {
    justify-content: flex-end;
    padding-bottom: 50px;
}

.promo-tv .promo-content {
    max-width: 500px;
}

/* Trade In custom background styling if image fails to load */
.promo-tradein-fallback {
    background: radial-gradient(circle at center, #ffffff 0%, #f5f5f7 100%);
}

.promo-tradein-graphic {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 200px;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   5. Apple-Style Footer
   ========================================================================== */
.global-footer {
    background-color: var(--color-bg-light);
    color: var(--color-text-muted-dark);
    font-size: 12px;
    line-height: 1.33337;
    font-weight: 400;
    letter-spacing: -0.01em;
    padding: 0 0 30px 0;
    border-top: 1px solid var(--color-border-light);
}

.footer-notes {
    padding: 17px 0 11px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--color-text-muted-dark);
}

.footer-notes p {
    margin-bottom: 9px;
}

.footer-notes a {
    color: #424245;
    text-decoration: underline;
}

.footer-notes a:hover {
    color: var(--color-text-dark);
}

/* Footer Link Columns Grid */
.footer-directory {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    padding: 20px 0;
}

.directory-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.directory-section-title {
    color: var(--color-text-dark);
    font-weight: 600;
    margin-bottom: 6px;
}

.directory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.directory-list-item a {
    color: #515154;
    transition: color var(--transition-fast);
}

.directory-list-item a:hover {
    color: var(--color-text-dark);
    text-decoration: none;
}

/* Footer Shop Bar and Legal Bar */
.footer-shop {
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    color: var(--color-text-muted-dark);
}

.footer-shop a {
    color: var(--color-link);
    text-decoration: none;
}

.footer-shop a:hover {
    text-decoration: underline;
}

.footer-legal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text-muted-dark);
    flex-wrap: wrap;
    gap: 10px;
}

.legal-copyright {
    margin-right: 30px;
}

.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 10px;
}

.legal-link-item {
    position: relative;
    display: flex;
    align-items: center;
}

.legal-link-item a {
    color: #515154;
}

.legal-link-item a:hover {
    color: var(--color-text-dark);
    text-decoration: none;
}

.legal-link-item:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    margin-left: 10px;
}

.legal-country {
    margin-left: auto;
}

.legal-country a {
    color: #515154;
}

.legal-country a:hover {
    color: var(--color-text-dark);
    text-decoration: none;
}

/* ==========================================================================
   6. UI Elements & Utilities
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background-color: rgba(22, 22, 23, 0.85);
    backdrop-filter: var(--nav-blur);
    -webkit-backdrop-filter: var(--nav-blur);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--color-text-light);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium), visibility var(--transition-medium), transform var(--transition-fast);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: scale(1.08);
    background-color: var(--color-bg-dark);
    border-color: rgba(255, 255, 255, 0.25);
}

.back-to-top svg {
    fill: currentColor;
    transition: transform var(--transition-fast);
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

/* SVG Icon Helper Styles */
.svg-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* ==========================================================================
   7. Live Update Accents (WWDC, Ribbon, TV Carousel)
   ========================================================================== */
.ribbon-banner {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ribbon-banner a {
    color: var(--color-link);
    text-decoration: none;
}

.ribbon-banner a:hover {
    text-decoration: underline;
}

.text-rainbow {
    background: linear-gradient(90deg, #ff7b00, #ff007b, #9d00ff, #00bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Horizontal TV+ Carousel Section */
.tv-carousel-section {
    position: relative;
    width: 100%;
    height: 550px;
    background-color: #000000;
    overflow: hidden;
    cursor: pointer;
}

.carousel-nav-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.85) 100%);
}

.tv-carousel-header {
    display: flex;
    align-items: center;
}

.tv-carousel-content {
    max-width: 600px;
    margin-bottom: 40px;
    color: var(--color-text-light);
    transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.btn-tv-stream {
    font-size: 15px;
    padding: 10px 24px;
    font-weight: 500;
    background-color: var(--color-bg-white);
    color: var(--color-bg-dark);
}

.btn-tv-stream:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.02);
}

/* Carousel controls */
.carousel-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.carousel-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.carousel-indicator-dot.active {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.btn-carousel-playpause {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: color var(--transition-fast);
}

.btn-carousel-playpause:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Promo Grid Vector Graphics centering */
.promo-child-safety {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    justify-content: space-between;
    padding-bottom: 30px;
}

.promo-mac-students {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    justify-content: space-between;
    padding-bottom: 30px;
}

.promo-safety-graphic,
.promo-students-graphic {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    z-index: 1;
}

/* Custom WWDC 26 overrides */
#wwdc26 {
    background-color: #000000;
}

#wwdc26 .bg-image-wrapper {
    height: 100%;
    display: flex;
    align-items: flex-end;
}

#wwdc26 .bg-image {
    object-position: bottom center;
    max-height: 55%;
    /* Keeps space for text above products */
    width: auto;
    max-width: 90%;
    margin: 0 auto;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

#wwdc26:hover .bg-image {
    transform: translateX(-50%) scale(1.02);
    /* Custom scale that preserves translation */
}

/* Align laptop and devices to the bottom of the section to keep text legible on light space */
#macbook-air-m5 .bg-image-wrapper,
#iphone-lineup .bg-image-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background-color: #000000;
}

#macbook-air-m5 .bg-image,
#iphone-lineup .bg-image {
    height: 60%;
    width: auto;
    object-fit: contain;
    object-position: bottom center;
}

.hero-title-wwdc {
    font-size: 80px !important;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(180deg, #ffffff 40%, #c8c8cc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.35);
    margin-bottom: 8px;
    display: block;
}