/* ============================================
   perfectStore.app — Design System v2
   "Intelligence Noir" — Editorial × Data
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Instrument+Sans:wght@400;500;600;700&family=Azeret+Mono:wght@400;500;600&display=swap');

:root {
    /* Core palette */
    --black: #070B14;
    --black-soft: #0C1120;
    --black-card: #111827;
    --black-card-hover: #1A2332;

    /* Accents */
    --orange: #FF8A00;
    --orange-light: #FFa333;
    --orange-dark: #E67A00;
    --red: #FF4D4D;
    --green: #00E5C3;
    --purple: #A78BFA;

    /* Text */
    --white: #E8E4DF;
    --white-pure: #FFFFFF;
    --gray-50: #F1EDE8;
    --gray-100: #D9D4CE;
    --gray-200: #3A4560;
    --gray-300: #2D3750;
    --gray-400: #6B7B95;
    --gray-500: #4A5568;
    --gray-600: #3A4560;
    --gray-700: #2D3750;
    --gray-800: #1A2332;
    --gray-900: #0C1120;

    /* Semantic */
    --border-subtle: rgba(255,255,255,0.06);
    --border-hover: rgba(255,138,0,0.35);
    --glow-orange: rgba(255,138,0,0.15);
    --glow-red: rgba(255,77,77,0.15);
    --glow-green: rgba(0,229,195,0.15);

    /* Fonts */
    --font-display: 'Bricolage Grotesque', 'Georgia', serif;
    --font-body: 'Instrument Sans', 'Helvetica Neue', sans-serif;
    --font-mono: 'Azeret Mono', 'Courier New', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html { scroll-behavior: smooth; }

body {
    background: var(--black);
    color: var(--white);
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

/* Grain texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- NAV ---- */
.ps-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(1.2);
    background: rgba(7,11,20,0.8);
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.4s, border-color 0.4s;
}

.ps-nav.scrolled {
    background: rgba(7,11,20,0.95);
    border-bottom-color: rgba(255,138,0,0.1);
}

.ps-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ps-logo {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: opacity 0.2s;
}

.ps-logo:hover { opacity: 0.8; }
.ps-logo span { color: var(--orange); }

.ps-nav-links {
    display: flex;
    align-items: center;
    gap: 36px;
}

.ps-nav-links a {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-400);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.3s;
    position: relative;
}

.ps-nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0; right: 0;
    height: 1px;
    background: var(--orange);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.ps-nav-links a:hover { color: var(--white); }
.ps-nav-links a:hover::after { transform: scaleX(1); }

.ps-nav-links a.active {
    color: var(--orange);
    font-weight: 600;
}

.ps-nav-links a.active::after {
    transform: scaleX(1);
}

.ps-nav-cta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ps-nav-cta .btn-ghost {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s;
}

.ps-nav-cta .btn-ghost:hover {
    color: var(--white);
    border-color: var(--white);
    background: rgba(255,255,255,0.05);
}

/* Mobile nav */
.ps-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.ps-mobile-toggle svg { width: 24px; height: 24px; }

.ps-mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--black);
    padding: 24px;
    flex-direction: column;
}

.ps-mobile-menu.open { display: flex; }

.ps-mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 64px;
}

.ps-mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-400);
}

.ps-mobile-menu-close svg { width: 24px; height: 24px; }

.ps-mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ps-mobile-menu-links a {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--gray-400);
    text-decoration: none;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: color 0.2s, padding-left 0.3s;
}

.ps-mobile-menu-links a:hover {
    color: var(--orange);
    padding-left: 12px;
}

.ps-mobile-menu-cta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 32px;
}

@media (max-width: 768px) {
    .ps-nav-links, .ps-nav-cta { display: none; }
    .ps-mobile-toggle { display: block; }
}

/* ---- BUTTONS ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--orange);
    color: var(--black);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    background: var(--orange-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255,138,0,0.35);
}

.btn-primary:hover::before { opacity: 1; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-secondary:hover {
    border-color: var(--white);
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
}

.btn-white {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--white);
    color: var(--black);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-white:hover {
    background: var(--white-pure);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ---- SECTIONS ---- */
.section { padding: 120px 24px; }
.section-dark { background: var(--black-soft); color: var(--white); }
.section-light { background: var(--black); }
.section-orange { background: var(--orange); color: var(--black); }

.container { max-width: 1200px; margin: 0 auto; }
.container-sm { max-width: 800px; margin: 0 auto; }

/* ---- TYPOGRAPHY ---- */
.heading-xl {
    font-family: var(--font-display);
    font-size: clamp(40px, 7vw, 76px);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -2px;
    color: var(--white);
}

.heading-lg {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -1px;
    color: var(--white);
}

.heading-md {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.5px;
}

.heading-sm {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--white);
}

.text-lg { font-size: 17px; line-height: 1.7; }
.text-md { font-size: 15px; line-height: 1.7; }
.text-sm { font-size: 14px; line-height: 1.6; }
.text-xs { font-size: 12px; line-height: 1.5; }

.text-orange { color: var(--orange); }
.text-white { color: var(--white); }
.text-muted { color: var(--gray-400); }
.text-muted-light { color: rgba(232,228,223,0.55); }
.text-center { text-align: center; }

.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 2px;
    border: 1px solid transparent;
}

.tag-orange {
    background: rgba(255,138,0,0.08);
    color: var(--orange);
    border-color: rgba(255,138,0,0.15);
}

.tag-orange-solid {
    background: var(--orange);
    color: var(--black);
}

.tag-white {
    background: rgba(255,255,255,0.06);
    color: var(--gray-400);
    border-color: rgba(255,255,255,0.08);
}

.tag-red {
    background: rgba(255,77,77,0.08);
    color: var(--red);
    border-color: rgba(255,77,77,0.15);
}

.tag-purple {
    background: rgba(167,139,250,0.08);
    color: var(--purple);
    border-color: rgba(167,139,250,0.15);
}

/* ---- CARDS ---- */
.card {
    background: var(--black-card);
    border-radius: 2px;
    padding: 32px;
    border: 1px solid var(--border-subtle);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--orange), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.card:hover::before { opacity: 1; }

.card-dark {
    background: var(--black-card);
    border-radius: 2px;
    padding: 32px;
    border: 1px solid var(--border-subtle);
    transition: all 0.4s;
}

.card-dark:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.card-icon-orange { background: var(--glow-orange); color: var(--orange); }
.card-icon-red { background: var(--glow-red); color: var(--red); }
.card-icon-green { background: var(--glow-green); color: var(--green); }
.card-icon-purple { background: rgba(167,139,250,0.12); color: var(--purple); }
.card-icon-orange-dark { background: rgba(255,138,0,0.2); color: var(--orange); }

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .section { padding: 80px 20px; }
}

/* ---- FOOTER ---- */
.ps-footer {
    background: var(--black-soft);
    color: var(--white);
    padding: 80px 24px 32px;
    border-top: 1px solid var(--border-subtle);
    position: relative;
}

.ps-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,138,0,0.2), transparent);
}

.ps-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.ps-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 64px;
}

.ps-footer-brand {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.ps-footer-brand span { color: var(--orange); }

.ps-footer-desc {
    color: var(--gray-400);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
    max-width: 280px;
}

.ps-footer-col h4 {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gray-400);
    margin-bottom: 20px;
}

.ps-footer-col a {
    display: block;
    font-size: 14px;
    color: var(--gray-400);
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.2s, padding-left 0.3s;
}

.ps-footer-col a:hover {
    color: var(--orange);
    padding-left: 4px;
}

.ps-footer-bottom {
    border-top: 1px solid var(--border-subtle);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.ps-footer-bottom p {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

.ps-footer-bottom a {
    font-size: 12px;
    color: var(--gray-500);
    text-decoration: none;
    transition: color 0.2s;
}

.ps-footer-bottom a:hover { color: var(--orange); }

@media (max-width: 768px) {
    .ps-footer-grid { grid-template-columns: 1fr; gap: 32px; }
    .ps-footer-bottom { flex-direction: column; text-align: center; }
}

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(7,11,20,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s;
}

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

.modal-box {
    background: var(--black-card);
    border-radius: 2px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    transform: scale(0.95) translateY(16px);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}

.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 28px 28px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
}

.modal-header p {
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 4px;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--white); }

.modal-body { padding: 28px; }

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font-body);
    background: var(--black-soft);
    color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 2px;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

.form-input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--glow-orange);
}

.form-input::placeholder { color: var(--gray-500); }

.form-textarea { resize: vertical; min-height: 100px; }

/* ---- PILLAR NAV (for main page) ---- */
.pillar-card {
    background: var(--black-card);
    border-radius: 2px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    text-decoration: none;
    display: block;
    border: 1px solid var(--border-subtle);
}

.pillar-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

.pillar-card .pillar-glow {
    position: absolute;
    top: -60%; right: -30%;
    width: 300px; height: 300px;
    border-radius: 50%;
    pointer-events: none;
    transition: opacity 0.4s;
    opacity: 0.3;
}

.pillar-card:hover .pillar-glow { opacity: 1; }

.pillar-card .pillar-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}

.pillar-card .pillar-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: inline-block;
}

.pillar-card h3 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.pillar-card p {
    font-size: 15px;
    color: rgba(232,228,223,0.5);
    line-height: 1.6;
    margin-bottom: 28px;
}

.pillar-card .pillar-cta {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.3s;
}

.pillar-card:hover .pillar-cta { gap: 12px; }

/* ---- ANIMATIONS ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(4px);
    transition: all 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.animate-in {
    opacity: 0;
    transform: translateY(24px);
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- STATS ---- */
.stat-block { text-align: center; }

.stat-number {
    font-family: var(--font-display);
    font-size: clamp(40px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-400);
}

/* ---- MISC ---- */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0 auto;
    max-width: 1200px;
}

.spacer-sm { height: 24px; }
.spacer-md { height: 48px; }
.spacer-lg { height: 80px; }

/* Selection color */
::selection {
    background: rgba(255,138,0,0.25);
    color: var(--white);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb {
    background: var(--gray-500);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Dark nav variant (backward compat) */
.ps-nav-dark {
    background: rgba(7,11,20,0.8);
    border-bottom-color: var(--border-subtle);
}
.ps-nav-dark .ps-logo { color: var(--white); }
.ps-nav-dark .ps-nav-links a { color: var(--gray-400); }
.ps-nav-dark .ps-nav-links a:hover { color: var(--white); }
.ps-nav-dark .ps-nav-links a.active { color: var(--orange); }
.ps-nav-dark .btn-ghost { color: var(--gray-400); border-color: var(--gray-200); }
.ps-nav-dark .btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--white); border-color: var(--white); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    body::after { display: none; }
}