/* ==========================================================================
   Global Theme Variables
   ========================================================================== */
:root {
    --bg-color: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --header-bg: rgba(245, 245, 247, 0.85);
    --header-border: rgba(0, 0, 0, 0.08);
    --btn-bg: rgba(255, 255, 255, 0.75);
    --btn-border: rgba(0, 0, 0, 0.12);
    --btn-stroke: #1d1d1f;
    --toggle-track: #e5e5ea;
    --toggle-knob: #ffffff;
    --toggle-border: rgba(0, 0, 0, 0.1);
    --icon-color: #6e6e73;
    --link-color: #0066cc;
}

.dark-mode {
    --bg-color: #000000;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a6;
    --header-bg: rgba(20, 20, 20, 0.85);
    --header-border: rgba(255, 255, 255, 0.15);
    --btn-bg: rgba(30, 30, 30, 0.75);
    --btn-border: rgba(255, 255, 255, 0.2);
    --btn-stroke: #ffffff;
    --toggle-track: #3a3a3c;
    --toggle-knob: #000000;
    --toggle-border: rgba(255, 255, 255, 0.2);
    --icon-color: #a1a1a6;
    --link-color: #2997ff;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light-mode-forced) {
        --bg-color: #000000;
        --text-primary: #ffffff;
        --text-secondary: #a1a1a6;
        --header-bg: rgba(20, 20, 20, 0.85);
        --header-border: rgba(255, 255, 255, 0.15);
        --btn-bg: rgba(30, 30, 30, 0.75);
        --btn-border: rgba(255, 255, 255, 0.2);
        --btn-stroke: #ffffff;
        --toggle-track: #3a3a3c;
        --toggle-knob: #000000;
        --toggle-border: rgba(255, 255, 255, 0.2);
        --icon-color: #a1a1a6;
        --link-color: #2997ff;
    }
}

/* ==========================================================================
   Base Resets
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-bottom: 60px;
    overflow-x: hidden;
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    outline: none;
}

button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

svg {
    display: block;
    shape-rendering: geometricPrecision;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--header-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hamburger-btn {
    display: none;
    position: relative;
    width: 32px;
    height: 32px;
}

.hamburger-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    stroke: var(--text-primary);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    opacity: 0.75;
    transition: opacity 0.2s ease, text-decoration-color 0.2s ease;
}

.nav-link:hover {
    opacity: 1;
    text-decoration-color: var(--text-primary);
}

.nav-link.active {
    opacity: 1;
    font-weight: 700;
    text-decoration-color: transparent;
}

/* ==========================================================================
   Theme Toggle Switch
   ========================================================================== */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-icon-container {
    position: relative;
    width: 20px;
    height: 20px;
}

.toggle-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    color: var(--icon-color);
    transition: color 0.3s ease;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--toggle-track);
    border: 1px solid var(--toggle-border);
    border-radius: 30px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: var(--toggle-knob);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked+.slider::before {
    transform: translateX(22px);
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */
.mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    width: 100%;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--header-border);
    padding: 20px 5%;
    flex-direction: column;
    gap: 16px;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.mobile-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-nav-link {
    font-size: 1.05rem;
    font-weight: 300;
    color: var(--text-primary);
    text-decoration: none;
    opacity: 0.75;
}

.mobile-nav-link.active {
    font-weight: 700;
    opacity: 1;
}

/* ==========================================================================
   Unified Page Container
   ========================================================================== */
.home-page {
    display: block;
    padding: 90px 5% 0 5%;
    width: 100%;
}

.text-wrapper {
    max-width: 800px;
}

.title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
}

.app-tagline {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

.paragraph {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.link-text {
    color: var(--link-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.link-text:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Home Page Specifics (Carousel & App Store)
   ========================================================================== */
.app-store-wrapper {
    margin-top: 10px;
}

.app-store-img {
    height: clamp(42px, 5.5vw, 54px);
    width: auto;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-store-img:hover {
    transform: scale(1.03);
    opacity: 0.9;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    margin-top: 6px;
}

.carousel-fade-left,
.carousel-fade-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 67px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-fade-left {
    left: 0;
    background: linear-gradient(to right, var(--bg-color) 0%, rgba(255, 255, 255, 0) 100%);
}

.carousel-fade-right {
    right: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, var(--bg-color) 100%);
}

.dark-mode .carousel-fade-left {
    background: linear-gradient(to right, var(--bg-color) 0%, rgba(0, 0, 0, 0) 100%);
}

.dark-mode .carousel-fade-right {
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, var(--bg-color) 100%);
}

.carousel-fade-left.visible,
.carousel-fade-right.visible {
    opacity: 1;
}

.carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 8px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel-img {
    height: clamp(380px, 62vh, 600px);
    width: auto;
    border-radius: 25px;
    flex-shrink: 0;
    object-fit: cover;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background-color: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 50%;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.2s ease, background-color 0.3s ease;
}

.nav-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-btn.visible:hover {
    transform: translateY(-50%) scale(1.08);
}

.carousel-icon-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
}

.nav-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--btn-stroke);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.prev-btn {
    left: 49px;
}

.next-btn {
    right: 49px;
}

/* ==========================================================================
   Responsive Queries
   ========================================================================== */
@media (max-width: 550px) {
    .header-nav {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .mobile-menu {
        display: flex;
    }

    .home-page {
        padding-top: 80px;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }

    .prev-btn {
        left: 8px;
    }

    .next-btn {
        right: 8px;
    }

    .carousel-fade-left,
    .carousel-fade-right {
        display: none !important;
    }
}