/* File: css/style.css */
/*
 * ============================================
 *   MAIN STYLESHEET — PORTFOLIO WEBSITE
 * ============================================
 *
 * This is the central stylesheet that defines:
 * 1. CSS Custom Properties (Design Tokens)
 * 2. CSS Reset / Normalize
 * 3. Base Typography
 * 4. Layout Utilities
 * 5. Page Header (Inner pages)
 * 6. Section Headers
 * 7. CTA Section
 * 8. Accessibility Helpers
 * 9. Back to Top Button
 *
 * Component-specific styles live in css/components/
 * This file is loaded on EVERY page.
 */


/* ==========================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ==========================================

   All colors, fonts, spacing, and other design
   values are defined here as CSS variables.

   This makes it easy to:
   - Switch between dark/light themes
   - Maintain consistent design
   - Update values in one place
   ========================================== */

:root {
    /* ---- Color Palette (Dark Theme — Default) ---- */
    --bg-primary:       #0a192f;
    --bg-secondary:     #112240;
    --bg-tertiary:      #1a2f4e;
    --bg-card:          #112240;

    --text-heading:     #ccd6f6;
    --text-primary:     #a8b2d1;
    --text-secondary:   #8892b0;
    --text-on-accent:   #0a192f;

    --accent-primary:   #64ffda;
    --accent-secondary: #7b89f4;
    --accent-gradient:  linear-gradient(135deg, #64ffda, #7b89f4);

    --border-color:     rgba(255, 255, 255, 0.08);
    --border-hover:     rgba(100, 255, 218, 0.3);

    /* ---- Typography ---- */
    --font-primary:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:      'Fira Code', 'Consolas', monospace;

    --fs-xs:    0.75rem;
    --fs-sm:    0.875rem;
    --fs-base:  1rem;
    --fs-md:    1.125rem;
    --fs-lg:    1.25rem;
    --fs-xl:    1.5rem;
    --fs-2xl:   2rem;
    --fs-3xl:   2.5rem;
    --fs-4xl:   3rem;

    /* ---- Spacing ---- */
    --space-xs:   0.5rem;
    --space-sm:   0.75rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2rem;
    --space-2xl:  3rem;
    --space-3xl:  4rem;

    /* ---- Layout ---- */
    --max-width:      1200px;
    --header-height:  4.5rem;

    /* ---- Borders ---- */
    --radius-sm:   6px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-full: 9999px;

    /* ---- Shadows ---- */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg:  0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.4);

    /* ---- Transitions ---- */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* ---- Z-Index Scale ---- */
    --z-dropdown:   100;
    --z-header:     500;
    --z-sticky:     1000;
    --z-overlay:    900;
    --z-modal:      1000;
    --z-preloader:  9999;
}

/* ---- Light Theme Overrides ---- */
[data-theme="light"] {
    --bg-primary:       #f8fafc;
    --bg-secondary:     #ffffff;
    --bg-tertiary:      #f1f5f9;
    --bg-card:          #ffffff;

    --text-heading:     #1e293b;
    --text-primary:     #475569;
    --text-secondary:   #64748b;
    --text-on-accent:   #ffffff;

    --accent-primary:   #0066cc;
    --accent-secondary: #6366f1;
    --accent-gradient:  linear-gradient(135deg, #0066cc, #6366f1);

    --border-color:     rgba(0, 0, 0, 0.08);
    --border-hover:     rgba(0, 102, 204, 0.3);

    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg:  0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.12);
}


/* ==========================================
   2. CSS RESET
   ==========================================

   Strips browser default styles so every
   element starts from a clean, predictable base.
   ========================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-primary);
    font-size: var(--fs-base);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

img,
picture,
video,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

input,
textarea,
select {
    font: inherit;
}


/* ==========================================
   3. BASE TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    line-height: 1.2;
    font-weight: 700;
}

p {
    margin-bottom: 1em;
}

p:last-child {
    margin-bottom: 0;
}

::selection {
    background: var(--accent-primary);
    color: var(--text-on-accent);
}

code, pre {
    font-family: var(--font-mono);
}

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-accent {
    color: var(--accent-primary);
}


/* ==========================================
   4. LAYOUT UTILITIES
   ========================================== */

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
}

main {
    padding-top: 0;
}


/* ==========================================
   5. SECTIONS
   ==========================================
   Used on almost every page for content blocks.
   The + selector reduces spacing when sections
   are stacked directly on top of each other.
   ========================================== */

.section {
    padding: var(--space-2xl) 0;
}

.section + .section {
    padding-top: var(--space-lg);
}


/* ==========================================
   6. SECTION HEADERS
   ==========================================
   The label / title / subtitle pattern used
   above most content grids.
   ========================================== */

.section__header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section__label {
    display: inline-block;
    font-size: var(--fs-xs);
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-sm);
}

.section__title {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.2;
}


/* ==========================================
   7. PAGE HEADER (All inner pages)
   ==========================================
   Every inner page (About, Services, Portfolio,
   Shop, Blog, Contact, Testimonials) uses this
   for the title/breadcrumb area at the top.

   Because the <header> navbar is position: fixed,
   page content starts at y=0 and would hide behind
   the navbar. The padding-top pushes content down
   so it clears the navbar.
   ========================================== */

.page-header {
    position: relative;
    padding-top: calc(var(--header-height) + 3rem);
    padding-bottom: var(--space-xl);
    overflow: hidden;
    margin-bottom: 0;
}

.page-header__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.page-header__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.06;
}

.page-header__blob--1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    right: -100px;
}

.page-header__blob--2 {
    width: 300px;
    height: 300px;
    background: var(--accent-secondary);
    bottom: -50px;
    left: -50px;
}

.page-header__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(100, 255, 218, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 255, 218, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

[data-theme="light"] .page-header__grid {
    background-image:
        linear-gradient(rgba(0, 102, 204, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 102, 204, 0.04) 1px, transparent 1px);
}

.page-header__content {
    position: relative;
    z-index: 1;
}

.page-header__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: var(--space-sm);
    line-height: 1.1;
}

.page-header__subtitle {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.7;
    margin-bottom: 0;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
}

.breadcrumbs a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.breadcrumbs a:hover {
    opacity: 0.8;
}

.breadcrumbs__separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

.breadcrumbs__current {
    color: var(--text-secondary);
}


/* ==========================================
   8. CTA SECTION
   ==========================================
   Used on testimonials, services, portfolio,
   and other pages for the bottom call-to-action.
   ========================================== */

.cta-section {
    position: relative;
    text-align: center;
    overflow: hidden;
}

.cta-section__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.cta-section__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.06;
}

.cta-section__blob--1 {
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
    top: -150px;
    left: -100px;
}

.cta-section__blob--2 {
    width: 400px;
    height: 400px;
    background: var(--accent-secondary);
    bottom: -100px;
    right: -100px;
}

.cta-section__content {
    position: relative;
    z-index: 1;
    max-width: 650px;
    margin: 0 auto;
}

.cta-section__title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: var(--space-md);
    line-height: 1.2;
}

.cta-section__text {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
}

.cta-section__actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}


/* ==========================================
   9. ACCESSIBILITY
   ========================================== */

/* Screen-reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link */
.skip-link {
    position: fixed;
    top: -100%;
    left: var(--space-md);
    z-index: calc(var(--z-preloader) + 1);
    padding: var(--space-sm) var(--space-lg);
    background: var(--accent-primary);
    color: var(--text-on-accent);
    font-weight: 600;
    font-size: var(--fs-sm);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

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

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ==========================================
   10. BACK TO TOP BUTTON
   ========================================== */

.back-to-top {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: var(--z-dropdown);
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-base);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    border-color: var(--accent-primary);
    background: rgba(100, 255, 218, 0.05);
}

.back-to-top__arrow {
    position: absolute;
    color: var(--accent-primary);
}

.back-to-top__progress-ring {
    position: absolute;
    transform: rotate(-90deg);
}

.back-to-top__progress-bg {
    stroke: var(--border-color);
}

.back-to-top__progress {
    stroke: var(--accent-primary);
    transition: stroke-dashoffset 0.1s linear;
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: var(--space-lg);
        right: var(--space-lg);
    }
}