/* ==========================================================================
   Blingstack Theme Stylesheet - Futuristic & Professional
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@300;400;500;600;700;800&display=swap');

/* Define Cascade Layers */
@layer reset, base, theme, layout, components, utilities;

@layer reset {
  /* Modern CSS Reset */
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: none;
  }

  body {
    min-height: 100vh;
    text-rendering: optimizeSpeed;
    line-height: 1.5;
  }

  /* Accessible media aspects */
  img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input, button, textarea, select {
    font: inherit;
  }

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

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

@layer base {
  :root {
    /* Fonts */
    --font-body: 'Bricolage Grotesque', sans-serif;
    --font-heading: 'Bricolage Grotesque', sans-serif;

    /* Base Colors (Tier 1 Literal Tokens) */
    --color-dark-bg: #090a0f;
    --color-dark-surface: #10121a;
    --color-dark-card: rgba(18, 22, 33, 0.7);
    --color-white: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-600: #475569;
    --color-gray-800: #1e293b;
    --color-indigo-500: #6366f1;
    --color-indigo-600: #4f46e5;
    --color-indigo-700: #4338ca;
    --color-cyan-400: #22d3ee;
    --color-cyan-500: #06b6d4;
    
    /* Brand Design Tokens (Tier 2 Semantic Tokens) */
    --bg-primary: var(--color-dark-bg);
    --bg-surface: var(--color-dark-surface);
    --bg-card: var(--color-dark-card);
    
    --text-primary: var(--color-white);
    --text-secondary: var(--color-gray-300);
    --text-muted: var(--color-gray-400);
    
    --color-accent-1: var(--color-indigo-500);
    --color-accent-1-hover: var(--color-indigo-600);
    --color-accent-2: var(--color-cyan-400);
    --color-accent-2-hover: var(--color-cyan-500);

    /* Gradients */
    --in-oklab: ;
    --gradient-brand: linear-gradient(135deg, var(--color-accent-1) 0%, var(--color-accent-2) 100%);
    --gradient-brand-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(34, 211, 238, 0.15) 100%);
    
    /* Layout Constants */
    --site-max-width: 1760px;
    --border-radius-lg: 16px;
    --border-radius-md: 8px;
    
    /* Scroll Timeline Defaults */
    --animation-reduced: none;
  }

  /* Support for modern interpolation */
  @supports (linear-gradient(in oklab, white, black)) {
    :root {
      --in-oklab: in oklab;
      --gradient-brand: linear-gradient(to right var(--in-oklab), var(--color-accent-1) 0%, var(--color-accent-2) 100%);
    }
  }

  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    /* Grid background pattern */
    background-image: 
      linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center;
  }

  /* Focus rings styling */
  :focus-visible {
    outline: 2px solid var(--color-accent-2);
    outline-offset: 4px;
  }

  /* Global typography selection */
  ::selection {
    background-color: rgba(34, 211, 238, 0.3);
    color: var(--color-white);
  }
}

@layer theme {
  /* Set color schemes explicitly */
  html {
    color-scheme: dark;
  }
}

@layer layout {
  .container {
    max-inline-size: var(--site-max-width);
    margin-inline: auto;
    padding-inline: 1.5rem;
  }

  /* Header & Navigation */
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    inline-size: 100%;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
  }

  .site-header--scrolled {
    background-color: rgba(9, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-block-size: 80px;
  }

  .logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .logo img {
    height: 53px !important;
    width: auto !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    vertical-align: middle;
  }

  .logo:hover img {
    transform: scale(1.08);
  }

  .logo-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent-2);
    box-shadow: 0 0 10px var(--color-accent-2);
  }

  .nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
  }

  .nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    position: relative;
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-brand);
    transition: width 0.3s ease;
  }

  .nav-link:hover::after,
  .nav-link--active::after {
    width: 100%;
  }

  .nav-link:hover,
  .nav-link--active {
    color: var(--text-primary);
  }

  /* Hamburger Menu (Mobile) */
  .mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    width: 30px;
    height: 24px;
    justify-content: center;
    z-index: 110;
  }

  .mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .mobile-menu-btn[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .mobile-menu-btn[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-btn[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Footer Layout */
  .site-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-block: 4rem 2rem;
    margin-block-start: 6rem;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(2, 1fr) 1.5fr;
    gap: 3rem;
    margin-block-end: 3rem;
  }

  .footer-logo-section p {
    color: var(--text-muted);
    margin-block-start: 1rem;
    max-inline-size: 300px;
  }

  .footer-column h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-block-end: 1.5rem;
    position: relative;
    padding-block-end: 0.5rem;
  }

  .footer-column h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 2px;
    background: var(--gradient-brand);
  }

  .footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }

  .footer-links a {
    color: var(--text-secondary);
    transition: color 0.2s ease, padding-left 0.2s ease;
  }

  .footer-links a:hover {
    color: var(--text-primary);
    padding-left: 4px;
  }

  .footer-contact-info {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-block-start: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
  }
}

@layer components {
  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--border-radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    gap: 0.6rem;
    min-height: 48px; /* High-contrast touch target minimum */
  }

  .btn:active {
    transform: scale(0.98);
  }

  .btn--primary {
    background: var(--gradient-brand);
    color: var(--color-dark-bg);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
  }

  .btn--primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4), 0 0 10px rgba(34, 211, 238, 0.3);
  }

  .btn--secondary {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
  }

  .btn--secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
  }

  .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  /* Glassmorphic Panel/Card */
  .glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
  }

  .glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-brand);
    opacity: 0.5;
  }

  /* Forms & Inputs styling */
  .form-group {
    margin-block-end: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-label {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: inline-block;
  }

  .form-label .required-indicator {
    color: var(--color-cyan-400);
    margin-inline-start: 3px;
  }

  .form-input {
    background-color: rgba(9, 10, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: var(--border-radius-md);
    padding: 0.85rem 1rem;
    font-size: 1rem;
    width: 100%;
    min-height: 48px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .form-input:focus {
    outline: none;
    border-color: var(--color-accent-2);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
  }

  /* Validity states using modern :user-invalid and :user-valid */
  .form-input:user-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  }
  
  .form-input:user-valid {
    border-color: #22c55e;
  }

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

  .form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .form-error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    display: none;
  }

  .visually-hidden {
    position: absolute;
    clip-path: inset(50%);
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    white-space: nowrap;
  }

  /* Grid Layouts & Cards */
  .cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
  }

  .info-card {
    background-color: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
  }

  .info-card:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 211, 238, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.05);
  }

  .info-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    background: var(--gradient-brand-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-cyan-400);
    border: 1px solid rgba(34, 211, 238, 0.2);
  }

  .info-card h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
  }

  .info-card p {
    color: var(--text-secondary);
    line-height: 1.6;
  }

  /* Alert Banners */
  .alert-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-block-end: 1.5rem;
    font-size: 0.95rem;
  }

  .alert-banner--success {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
  }

  .alert-banner--error {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
  }
}

@layer utilities {
  /* Text balance utilities */
  h1, h2, h3, .balance-text {
    text-wrap: balance;
  }

  p, .pretty-text {
    text-wrap: pretty;
  }

  /* Section Spacing */
  .section-spacer {
    padding-block: 8rem 4rem;
  }

  /* Ambient Glow Backgrounds */
  .glow-orb {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
  }

  .glow-orb--top-right {
    top: -100px;
    right: -100px;
  }

  .glow-orb--bottom-left {
    bottom: -100px;
    left: -100px;
  }

  /* Page Headers */
  .page-hero {
    padding-block: 9rem 4rem;
    text-align: center;
    position: relative;
  }

  .page-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 1rem + 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-block-end: 1.5rem;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .page-subtitle {
    font-size: clamp(1.1rem, 1rem + 1vw, 1.4rem);
    color: var(--text-secondary);
    max-inline-size: 680px;
    margin-inline: auto;
  }

  /* Accessibility animation management */
  @property --animation-reduced {
    syntax: "*";
    inherits: false;
    initial-value: none;
  }

  @media (prefers-reduced-motion: reduce) {
    * {
      animation: var(--animation-reduced) !important;
      transition: none !important;
    }
  }

  /* Header CTA button size adjustment */
  .header-cta {
    min-height: 42px !important;
    padding: 0.4rem 1.2rem !important;
    font-size: 0.85rem !important;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    display: inline-flex;
    align-items: center;
    z-index: 106;
  }

  /* Content Visibility optimizing render performance */
  .lazy-section {
    content-visibility: auto;
    contain-intrinsic-block-size: auto 600px;
  }
}

/* ==========================================================================
   Responsive Breakpoints & Adjustments
   ========================================================================== */

@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  
  .footer-logo-section {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--bg-surface);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    flex-direction: column;
    padding: 100px 3rem 3rem;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 105;
  }

  .nav-links[data-active="true"] {
    right: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-logo-section {
    grid-column: span 1;
  }
}

@media (pointer: coarse) {
  /* Ensure tap targets are slightly larger for coarse touch devices */
  .btn, .form-input, .nav-link {
    min-height: 52px;
  }
}

@media (max-width: 576px) {
  .logo {
    font-size: 1.2rem !important;
  }
  .logo img {
    height: 43px !important;
    width: auto !important;
  }
  .header-cta {
    padding: 0.35rem 0.85rem !important;
    font-size: 0.8rem !important;
    min-height: 38px !important;
  }
  .nav-container {
    min-block-size: 64px !important;
  }
}
