/* ==========================================================================
   WELL DONE DEV — Tasteful Modern Architectural Design System
   Refined Minimalism + Subtle Chevron Geometry (Light & Deep Obsidian Dark)
   ========================================================================== */

@layer base, theme, components, utilities;

@layer base {
  html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
  }

  body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, dialog {
    margin: 0;
    padding: 0;
  }

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

  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

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

@layer theme {
  :root {
    color-scheme: light dark;

    &:has(> head > meta[name="color-scheme"][content="dark"]) {
      color-scheme: dark;
    }
    &:has(> head > meta[name="color-scheme"][content="light"]) {
      color-scheme: light;
    }

    /* Typography — Modern Editorial Sans + Brand Display + Refined Mono */
    --font-display: 'Oswald', 'Arial Narrow', sans-serif;
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Space Mono', monospace;

    /* Refined Alabaster & Graphite Light Palette */
    --wd-paper: #fafaf8;
    --wd-surface: #ffffff;
    --wd-surface-alt: #f3f3ef;
    --wd-surface-glass: rgba(250, 250, 248, 0.82);
    --wd-ink: #0f1014;
    --wd-ink-soft: #2c2d35;
    --wd-muted: #62646f;
    --wd-border: rgba(15, 16, 20, 0.09);
    --wd-border-hover: rgba(15, 16, 20, 0.22);
    --wd-border-strong: #0f1014;
    --wd-invert-bg: #111216;
    --wd-invert-ink: #ffffff;
    --wd-accent-soft: rgba(15, 16, 20, 0.045);
    --wd-status-ok: #10b981;

    /* Refined Elevation & Radii */
    --wd-radius-sm: 8px;
    --wd-radius-md: 14px;
    --wd-radius-lg: 22px;
    --wd-radius-pill: 9999px;
    --wd-shadow-sm: 0 1px 2px rgba(15, 16, 20, 0.04);
    --wd-shadow-md: 0 4px 16px -4px rgba(15, 16, 20, 0.06), 0 1px 3px rgba(15, 16, 20, 0.04);
    --wd-shadow-lg: 0 20px 48px -18px rgba(15, 16, 20, 0.12), 0 2px 6px rgba(15, 16, 20, 0.04);

    /* Subtle Architectural Hairline Chevron Texture (Embossed, never harsh) */
    --wd-chevron-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M0 36 L48 12 L96 36' fill='none' stroke='%230f1014' stroke-width='1.25' stroke-opacity='0.075'/%3E%3Cpath d='M0 12 L48 -12 L96 12' fill='none' stroke='%230f1014' stroke-width='1.25' stroke-opacity='0.075'/%3E%3Cpath d='M0 60 L48 36 L96 60' fill='none' stroke='%230f1014' stroke-width='1.25' stroke-opacity='0.075'/%3E%3C/svg%3E");
    --wd-chevron-band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cpath d='M0 24 L32 8 L64 24' fill='none' stroke='%230f1014' stroke-width='1.2' stroke-opacity='0.09'/%3E%3C/svg%3E");
    --wd-chevron-white-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40' viewBox='0 0 80 40'%3E%3Cpath d='M0 30 L40 10 L80 30' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.07'/%3E%3C/svg%3E");

    /* Compatibility Aliases for Subpages (brief.html, admin.html) */
    --bg-main: var(--wd-paper);
    --bg-surface: var(--wd-surface-alt);
    --bg-card: var(--wd-surface);
    --bg-card-hover: var(--wd-surface);
    --border-card: var(--wd-border);
    --border-card-hover: var(--wd-border-hover);
    --text-main: var(--wd-ink);
    --text-muted: var(--wd-muted);
    --accent: var(--wd-ink);
    --accent-bg: var(--wd-accent-soft);
    --accent-border: var(--wd-border-hover);
    --color-primary: var(--wd-ink);
    --color-primary-rgb: 15, 16, 20;
    --color-primary-hover: #2c2d35;
    --color-accent: var(--wd-ink);
    --card-radius: var(--wd-radius-md);
    --button-radius: var(--wd-radius-pill);
    --badge-radius: var(--wd-radius-pill);
    --card-shadow: var(--wd-shadow-md);
    --header-bg: var(--wd-surface-glass);
    --navbar-bg: var(--wd-surface-glass);
    --navbar-border: var(--wd-border);
  }

  /* Deep Obsidian Studio Dark Mode (OS default unless forced light) */
  @media (prefers-color-scheme: dark) {
    :root:not(:has(> head > meta[name="color-scheme"][content="light"])) {
      --wd-paper: #090a0d;
      --wd-surface: #121318;
      --wd-surface-alt: #181a21;
      --wd-surface-glass: rgba(9, 10, 13, 0.82);
      --wd-ink: #f5f5f7;
      --wd-ink-soft: #d4d6de;
      --wd-muted: #8e919e;
      --wd-border: rgba(255, 255, 255, 0.09);
      --wd-border-hover: rgba(255, 255, 255, 0.22);
      --wd-border-strong: #f5f5f7;
      --wd-invert-bg: #f5f5f7;
      --wd-invert-ink: #090a0d;
      --wd-accent-soft: rgba(255, 255, 255, 0.06);
      --wd-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
      --wd-shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
      --wd-shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
      --wd-chevron-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M0 36 L48 12 L96 36' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3Cpath d='M0 12 L48 -12 L96 12' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3Cpath d='M0 60 L48 36 L96 60' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3C/svg%3E");
      --wd-chevron-band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cpath d='M0 24 L32 8 L64 24' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.08'/%3E%3C/svg%3E");
      --color-primary-rgb: 245, 245, 247;
    }
  }

  /* Explicit Dark Mode Override via <meta name="color-scheme" content="dark"> */
  :root:has(> head > meta[name="color-scheme"][content="dark"]) {
    --wd-paper: #090a0d;
    --wd-surface: #121318;
    --wd-surface-alt: #181a21;
    --wd-surface-glass: rgba(9, 10, 13, 0.82);
    --wd-ink: #f5f5f7;
    --wd-ink-soft: #d4d6de;
    --wd-muted: #8e919e;
    --wd-border: rgba(255, 255, 255, 0.09);
    --wd-border-hover: rgba(255, 255, 255, 0.22);
    --wd-border-strong: #f5f5f7;
    --wd-invert-bg: #f5f5f7;
    --wd-invert-ink: #090a0d;
    --wd-accent-soft: rgba(255, 255, 255, 0.06);
    --wd-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --wd-shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --wd-shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --wd-chevron-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M0 36 L48 12 L96 36' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3Cpath d='M0 12 L48 -12 L96 12' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3Cpath d='M0 60 L48 36 L96 60' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.065'/%3E%3C/svg%3E");
    --wd-chevron-band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cpath d='M0 24 L32 8 L64 24' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-opacity='0.08'/%3E%3C/svg%3E");
    --color-primary-rgb: 245, 245, 247;
  }

  /* Adaptive SVG Logo Inversion in Dark Mode */
  @media (prefers-color-scheme: dark) {
    :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .wd-logo-adaptive {
      filter: invert(1);
    }
  }
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .wd-logo-adaptive {
    filter: invert(1);
  }

  /* Color-Scheme Icon Switching Without JS */
  .wd-theme-icon-to-light { display: none; }
  .wd-theme-icon-to-dark { display: inline-flex; }
  @media (prefers-color-scheme: dark) {
    :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .wd-theme-icon-to-light { display: inline-flex; }
    :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .wd-theme-icon-to-dark { display: none; }
  }
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .wd-theme-icon-to-light { display: inline-flex; }
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .wd-theme-icon-to-dark { display: none; }
}

@layer components {
  body {
    min-height: 100vh;
    font-family: var(--font-body);
    background-color: var(--wd-paper);
    color: var(--wd-ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
  }

  .wd-wrap,
  .container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 4vw, 2rem);
  }

  /* ---- FROSTED ARCHITECTURAL NAVBAR ---- */
  .wd-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--wd-surface-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--wd-border);
  }

  .wd-header-inner {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
  }

  .wd-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--wd-ink);
    flex-shrink: 0;
  }

  .wd-chevron-signet {
    width: 28px;
    height: 30px;
    display: block;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .wd-brand-link:hover .wd-chevron-signet {
    transform: translateY(-2px);
  }

  .wd-brand-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-display);
    font-size: 1.22rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
  }

  .wd-brand-dev-tag {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 0.22rem 0.5rem;
    border-radius: 6px;
    background: var(--wd-invert-bg);
    color: var(--wd-invert-ink);
  }

  .wd-nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
  }

  .wd-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wd-muted);
    transition: color 0.18s ease;
  }

  .wd-nav-link:hover,
  .wd-nav-link[aria-current="page"] {
    color: var(--wd-ink);
  }

  .wd-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .wd-sla-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 36px;
    padding-inline: 0.75rem;
    border-radius: var(--wd-radius-pill);
    border: 1px solid var(--wd-border);
    background: var(--wd-surface);
    color: var(--wd-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    transition: border-color 0.18s ease, color 0.18s ease;
  }

  .wd-sla-link:hover {
    border-color: var(--wd-border-hover);
    color: var(--wd-ink);
  }

  .wd-select-wrap {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding-inline: 0.65rem;
    border-radius: var(--wd-radius-pill);
    border: 1px solid var(--wd-border);
    background: var(--wd-surface);
    color: var(--wd-ink);
  }

  .wd-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    color: inherit;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding-inline-end: 0.85rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23888888' d='M0 0l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
  }

  .wd-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--wd-radius-pill);
    border: 1px solid var(--wd-border);
    background: var(--wd-surface);
    color: var(--wd-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
  }

  .wd-icon-btn:hover:not(:disabled) {
    border-color: var(--wd-border-hover);
    background: var(--wd-surface-alt);
  }

  .wd-cta-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 36px;
    padding-inline: 1rem;
    border-radius: var(--wd-radius-pill);
    background: var(--wd-invert-bg);
    color: var(--wd-invert-ink);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .wd-cta-nav:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
  }

  .status-dot-live {
    width: 7px;
    height: 7px;
    background-color: var(--wd-status-ok);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    animation: wdPulseDot 2.4s infinite;
  }

  @keyframes wdPulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }

  /* Mobile Nav */
  .wd-mobile-menu-btn { display: none; }

  .wd-mobile-drawer {
    display: none;
    background: var(--wd-surface);
    border-top: 1px solid var(--wd-border);
    padding: 0.75rem 1.25rem 1.25rem;
  }

  .wd-mobile-drawer.open {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .wd-mobile-drawer a {
    font-size: 0.95rem;
    font-weight: 600;
    padding-block: 0.65rem;
    border-bottom: 1px solid var(--wd-border);
    color: var(--wd-ink);
  }

  @media (max-width: 900px) {
    .wd-nav-links { display: none; }
    .wd-mobile-menu-btn { display: inline-flex; }
  }

  @media (max-width: 640px) {
    .wd-cta-nav-desktop,
    .wd-sla-desktop { display: none; }
    .wd-brand-wordmark { font-size: 1.05rem; }
  }

  /* ---- REFINED CHEVRON ARCHITECTURAL DIVIDERS & SURFACES ---- */
  .wd-chevron-divider {
    height: 28px;
    background-image: var(--wd-chevron-band);
    background-size: 64px 32px;
    background-position: center;
    border-top: 1px solid var(--wd-border);
    border-bottom: 1px solid var(--wd-border);
    opacity: 0.9;
  }

  .wd-section {
    padding-block: clamp(3.5rem, 7vw, 5.75rem);
    position: relative;
  }

  .wd-section-alt {
    background: var(--wd-surface);
    border-top: 1px solid var(--wd-border);
    border-bottom: 1px solid var(--wd-border);
  }

  .wd-section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--wd-muted);
    margin-bottom: 0.75rem;
  }

  .wd-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
  }

  .wd-section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.85rem, 3.6vw, 2.65rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.12;
    color: var(--wd-ink);
  }

  .wd-section-sub {
    font-size: 0.98rem;
    color: var(--wd-muted);
    max-width: 480px;
    line-height: 1.65;
  }

  /* ---- REFINED BUTTONS ---- */
  .wd-btn-primary,
  .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--wd-invert-bg);
    color: var(--wd-invert-ink);
    border: 1px solid transparent;
    border-radius: var(--wd-radius-pill);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.8rem 1.6rem;
    cursor: pointer;
    box-shadow: var(--wd-shadow-sm);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
  }

  .wd-btn-primary:hover:not(:disabled),
  .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    opacity: 0.92;
    box-shadow: var(--wd-shadow-md);
  }

  .wd-btn-outline,
  .btn-case-study {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--wd-surface);
    color: var(--wd-ink);
    border: 1px solid var(--wd-border-hover);
    border-radius: var(--wd-radius-pill);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.78rem 1.45rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
  }

  .wd-btn-outline:hover:not(:disabled),
  .btn-case-study:hover:not(:disabled) {
    border-color: var(--wd-ink);
    background: var(--wd-surface-alt);
    transform: translateY(-2px);
  }

  /* ---- NATIVE MODAL DIALOG (modern-web-guidance compliant) ---- */
  dialog.wd-dialog {
    padding: 0;
    border: 1px solid var(--wd-border-hover);
    border-radius: var(--wd-radius-lg);
    box-shadow: var(--wd-shadow-lg);
    background: var(--wd-surface);
    color: var(--wd-ink);
    width: min(94vw, 560px);
    max-height: 90dvh;
    margin: auto;
    overflow-y: auto;
  }

  dialog.wd-dialog:modal {
    overscroll-behavior: contain;
  }

  dialog.wd-dialog::backdrop {
    background: rgba(9, 10, 13, 0.62);
    backdrop-filter: blur(8px);
    overflow: hidden;
    overscroll-behavior: contain;
  }

  /* ---- FORM CONTROLS ---- */
  .form-control {
    width: 100%;
    background: var(--wd-paper);
    border: 1px solid var(--wd-border-hover);
    border-radius: 10px;
    padding: 0.78rem 1rem;
    color: var(--wd-ink);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  }

  .form-control:focus {
    outline: none;
    border-color: var(--wd-ink);
    background: var(--wd-surface);
    box-shadow: 0 0 0 3px var(--wd-accent-soft);
  }

  /* ---- REFINED DARK ARCHITECTURAL FOOTER ---- */
  .wd-footer {
    background: #0d0e12;
    color: #f3f3f5;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-block: 3.5rem 2.75rem;
    position: relative;
    overflow: hidden;
  }

  .wd-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: var(--wd-chevron-white-fine);
    background-size: 80px 40px;
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
  }

  .wd-footer-inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2.25rem;
  }

  .wd-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.86rem;
    font-weight: 500;
  }

  .wd-footer-links a {
    color: #a6a8b4;
    transition: color 0.18s ease;
  }

  .wd-footer-links a:hover {
    color: #ffffff;
  }

  /* ---- SKIP LINK ---- */
  .wd-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--wd-invert-bg);
    color: var(--wd-invert-ink);
    padding: 0.7rem 1.2rem;
    border-radius: var(--wd-radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
  }

  .wd-skip-link:focus {
    left: 1rem;
    top: 1rem;
  }
}
