/* ==========================================================================
   Nuwik Design System & Stylesheet - Ultra-Minimalist B&W Monospace
   ========================================================================== */

/* 1. CASCADE LAYERS */
@layer reset, base, tokens, layout, components, utilities;

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

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 120px; /* Offset for header navigation */
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
  }

  img, svg {
    display: inline-block;
    max-width: 100%;
    height: auto;
    vertical-align: middle;
  }

  button, a {
    font: inherit;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
  }
}

@layer base {
  :root {
    /* Set absolute light scheme preference */
    color-scheme: light;
  }

  body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.92rem;
    line-height: 1.8;
    background-color: var(--color-bg);
    color: var(--color-text);
    padding: 0;
  }

  /* Markdown prefix indicators */
  h1, h2, h3 {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--color-title);
    line-height: 1.4;
    letter-spacing: -0.5px;
  }

  h1::first-letter, h2::first-letter {
    color: var(--color-markdown-hash);
  }

  p {
    text-wrap: pretty;
    margin-bottom: 1.5rem;
  }

  /* Thin Monochrome Section Divider */
  .section-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 4rem auto;
    width: 100%;
    max-width: 1140px;
  }

  /* Accessible focus rings */
  :focus-visible {
    outline: 1px solid var(--color-title);
    outline-offset: 4px;
  }
}

@layer tokens {
  :root {
    /* Absolute pure white paper and rich charcoal black tokens */
    --raw-pitch-black: oklch(0% 0 0);           /* Solid Pure Black */
    --raw-charcoal-dark: oklch(14% 0 0);         /* Clean rich dark text */
    --raw-pure-white: oklch(100% 0 0);          /* Solid Polar White */
    --raw-border-gray: oklch(90% 0 0);          /* Very thin grey hairline */
    --raw-hash-gray: oklch(50% 0 0);            /* Markdown indicators */
    
    /* Variables mapped to B&W */
    --color-bg: var(--raw-pure-white);
    --color-text: var(--raw-charcoal-dark);
    --color-title: var(--raw-pitch-black);
    --color-border: var(--raw-border-gray);
    --color-markdown-hash: var(--raw-hash-gray);
    --color-primary: var(--raw-pitch-black);
    
    /* Scrollbar B&W specs */
    scrollbar-color: #888 #f0f0f0;
    scrollbar-width: thin;
  }
}

@layer layout {
  /* Site Layout grid spaces */
  .app-header, .hero-section, .workspace-section, .tech-section, .references-section, .contact-section {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
  }

  .app-header {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .hero-section {
    padding-top: 8rem;
    padding-bottom: 6rem;
    min-height: 50vh;
    display: flex;
    align-items: center;
  }

  .workspace-section, .tech-section, .references-section {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .contact-section {
    padding-top: 1rem;
    padding-bottom: 6rem;
  }
}

@layer components {
  /* --- 1. Header component --- */
  .app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--color-border);
  }

  .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .brand-logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  #nav-logo {
    height: 36px;
    width: auto;
  }

  .brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-title);
  }

  .main-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
  }

  .nav-separator {
    color: var(--color-border);
    font-size: 0.85rem;
  }

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

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

  /* Language pills switcher */
  .lang-selector {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .lang-btn {
    color: var(--color-markdown-hash);
    transition: color 0.2s ease;
  }

  .lang-btn.active {
    color: var(--color-title);
    text-decoration: underline;
  }

  .lang-slash {
    color: var(--color-border);
  }

  /* Primary action mock link button */
  .btn-primary {
    font-size: 0.85rem;
    color: var(--color-title);
    transition: opacity 0.2s ease;
  }

  .btn-primary:hover {
    opacity: 0.7;
    text-decoration: underline;
  }

  /* --- 2. Hero Section --- */
  .hero-container {
    max-width: 800px;
  }

  .hero-tagline {
    font-size: 0.8rem;
    color: var(--color-markdown-hash);
    margin-bottom: 1.5rem;
    font-weight: 500;
  }

  .hero-title {
    font-size: clamp(1.8rem, 1.2rem + 2.5vw, 3rem);
    letter-spacing: -1px;
    margin-bottom: 2rem;
    line-height: 1.25;
  }

  .sub-hero-title {
    font-size: clamp(1.2rem, 0.9rem + 1.5vw, 2.2rem);
    font-weight: 400;
    color: var(--color-text);
    display: block;
    margin-top: 0.5rem;
  }

  .gradient-text {
    border-bottom: 2px solid var(--color-title);
    padding-bottom: 1px;
  }

  .hero-subtitle {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 300;
    line-height: 1.8;
  }

  /* --- 3. Services Layout (Clean Columns) --- */
  .section-header {
    margin-bottom: 3rem;
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--color-border);
    display: inline-block;
    padding-bottom: 0.35rem;
  }

  .section-subtitle {
    display: none; /* Strip out visual fluff */
  }

  .services-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
  }

  .service-item {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
  }

  .service-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-title);
  }

  .service-desc {
    font-size: 0.85rem;
    font-weight: 300;
    line-height: 1.7;
    margin-bottom: 1.5rem;
  }

  .service-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--color-markdown-hash);
    font-weight: 500;
  }

  /* --- 4. Tech Specifications Layout --- */
  .tech-intro {
    font-size: 0.88rem;
    color: var(--color-text);
    font-weight: 300;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
    max-width: 600px;
  }

  .tech-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .tech-item {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
  }

  .tech-label {
    font-weight: 700;
    color: var(--color-title);
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
  }

  .tech-detail {
    font-size: 0.82rem;
    color: var(--color-text);
    font-weight: 300;
    line-height: 1.6;
  }

  /* --- 5. Impressum & Contact Grid --- */
  .contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 4rem;
    margin-top: 3rem;
  }

  .contact-info-block {
    display: flex;
    flex-direction: column;
  }

  .contact-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-title);
  }

  .contact-desc, .legal-text {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    line-height: 1.7;
  }

  .contact-details-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.85rem;
  }

  .contact-details-list li {
    color: var(--color-title);
  }

  .contact-details-list a {
    color: var(--color-title);
    text-decoration: underline;
  }

  .contact-details-list a:hover {
    opacity: 0.7;
  }

  .legal-badge-wrapper {
    display: flex;
    gap: 0.50rem;
    font-size: 0.72rem;
    color: var(--color-markdown-hash);
    font-weight: 700;
    margin-top: 1rem;
  }

  /* --- 6. Reference Clients Section --- */
  .references-intro {
    font-size: 0.85rem;
    color: var(--color-markdown-hash);
    font-weight: 300;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
  }

  .references-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 1.5rem;
  }

  .reference-card {
    display: grid;
    grid-template-columns: 160px 200px 1fr;
    gap: 2rem;
    border-top: 1px dashed var(--color-border);
    padding: 0.85rem 0;
    align-items: center;
    transition: background-color 0.2s ease;
  }

  .reference-card:hover {
    background-color: rgba(0, 0, 0, 0.01);
  }

  .reference-logo-wrapper {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .reference-logo {
    max-height: 24px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.45;
    transition: filter 0.2s ease, opacity 0.2s ease;
  }

  .reference-card:hover .reference-logo {
    filter: grayscale(0%);
    opacity: 0.95;
  }

  .reference-card-title {
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--color-markdown-hash);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reference-card:hover .reference-card-title {
    color: var(--color-title);
  }

  .reference-desc {
    font-size: 0.76rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--color-text);
    margin-bottom: 0;
  }
}

@layer utilities {
  .hidden {
    display: none !important;
  }

  /* Fade entry classes */
  .animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .animate-slide-up {
    opacity: 0;
    transform: translateY(15px);
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .animate-slide-up-delayed {
    opacity: 0;
    transform: translateY(15px);
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  }

  @keyframes fadeIn {
    to { opacity: 1; }
  }

  @keyframes slideUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ==========================================================================
   5. RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */

@media (max-width: 900px) {
  .app-header, .hero-section, .workspace-section, .tech-section, .references-section, .contact-section {
    padding: 3rem 1.5rem;
  }

  .hero-section {
    padding-top: 6rem;
    padding-bottom: 4rem;
  }

  .services-list, .tech-grid {
    gap: 2.5rem;
  }

  .service-item, .tech-item {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .reference-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem 0;
    align-items: flex-start;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 600px) {
  .main-nav {
    display: none; /* Hide header links on small viewports, rely on scrolling */
  }

  .app-header {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

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