﻿/* ═══════════════════════════════════════════
       1. Custom Properties (Design Tokens)
       ═══════════════════════════════════════════ */
    :root {
      --accent: #f59e0b;
      --accent-light: #fef3c7;
      --accent-dark: #b45309;
      --accent-text: #78350f;
      --text: #1e293b;
      --text-mid: #475569;
      --text-light: #64748b;
      --bg: #ffffff;
      --bg-page: #f8fafc;
      --bg-alt: #f1f5f9;
      --border: #e2e8f0;
      --border-light: #f1f5f9;
      --radius: 12px;
      --radius-sm: 8px;
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
      --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
      --focus-ring: 0 0 0 3px rgba(245,158,11,0.4);
      --transition: 0.2s ease;
      --toc-width: 260px;
      --content-max: 760px;
    }

    /* ═══════════════════════════════════════════
       2. Reset & Base
       ═══════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      font-size: 15px;
      line-height: 1.72;
      color: var(--text);
      background: var(--bg-page);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      min-height: 100dvh;
    }

    /* ═══════════════════════════════════════════
       3. Skip Link (WCAG 2.4.1)
       ═══════════════════════════════════════════ */
    .skip-link {
      position: absolute;
      top: -100%;
      left: 16px;
      background: var(--accent);
      color: var(--accent-text);
      padding: 8px 16px;
      border-radius: var(--radius-sm);
      font-weight: 600;
      z-index: 9999;
      text-decoration: none;
    }
    .skip-link:focus {
      top: 12px;
    }

    /* ═══════════════════════════════════════════
       4. Reading Progress Bar
       ═══════════════════════════════════════════ */
    .progress-bar {
      position: fixed;
      top: 0;
      left: 0;
      width: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--accent), var(--accent-dark));
      z-index: 1000;
      transition: width 0.1s linear;
    }

    /* ═══════════════════════════════════════════
       5. Layout Grid
       ═══════════════════════════════════════════ */
    .imp-layout {
      display: grid;
      grid-template-columns: var(--toc-width) 1fr;
      gap: 0;
      max-width: calc(var(--toc-width) + var(--content-max) + 80px);
      margin: 0 auto;
    }

    /* ═══════════════════════════════════════════
       5a. Table of Contents (Sidebar)
       ═══════════════════════════════════════════ */
    .toc {
      position: sticky;
      top: 12px;
      align-self: start;
      height: calc(100dvh - 24px);
      padding: 24px 16px 24px 20px;
      border-right: 1px solid var(--border);
      background: var(--bg);
      scrollbar-width: thin;
      scrollbar-color: var(--border) transparent;
    }
    .toc::-webkit-scrollbar { width: 4px; }
    .toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    .toc-title {
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-light);
      margin-bottom: 16px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }

    .toc-group {
      margin-bottom: 14px;
    }
    .toc-group-label {
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--accent-dark);
      padding: 6px 10px 4px;
    }

    .toc-link {
      display: block;
      padding: 5px 10px;
      font-size: 0.82rem;
      color: var(--text-mid);
      text-decoration: none;
      border-radius: var(--radius-sm);
      line-height: 1.4;
      transition: background var(--transition), color var(--transition);
    }
    .toc-link:hover {
      background: var(--bg-alt);
      color: var(--text);
    }
    .toc-link.active {
      background: var(--accent-light);
      color: var(--accent-text);
      font-weight: 600;
    }
    .toc-link:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
    }

    /* Mobile ToC toggle */
    .toc-toggle {
      display: none; /* shown on mobile */
      position: fixed;
      bottom: 80px;
      right: 20px;
      z-index: 200;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: none;
      background: var(--text);
      color: #fff;
      font-size: 1.1rem;
      cursor: pointer;
      box-shadow: var(--shadow-md);
      transition: transform var(--transition), background var(--transition);
      align-items: center;
      justify-content: center;
    }
    .toc-toggle:hover { background: var(--text-mid); }
    .toc-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
    .toc-toggle svg { width: 20px; height: 20px; fill: currentColor; }

    /* ToC close (hidden on desktop) */
    .toc-close {
      display: none;
      position: absolute;
      top: 10px;
      right: 10px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--bg-alt);
      color: var(--text-mid);
      border: none;
      cursor: pointer;
      font-size: 1.2rem;
      align-items: center;
      justify-content: center;
      z-index: 501;
    }
    .toc-close:hover { background: var(--border); }
    .toc-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

    /* ═══════════════════════════════════════════
       5b. Main Content Area
       ═══════════════════════════════════════════ */
    .imp-main {
      max-width: var(--content-max);
      margin: 0 auto;
      padding: 48px 32px 64px;
    }

    /* ═══════════════════════════════════════════
       6. Hero Header
       ═══════════════════════════════════════════ */
    .imp-hero {
      margin-bottom: 36px;
      padding-bottom: 28px;
      border-bottom: 2px solid var(--accent);
    }
    .imp-hero h1 {
      font-size: clamp(1.4rem, 2.5vw + 0.5rem, 1.85rem);
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
      line-height: 1.25;
      margin-bottom: 8px;
    }
    .imp-hero .company {
      font-size: 0.95rem;
      color: var(--text-mid);
      font-weight: 500;
    }
    .imp-hero .stand {
      font-size: 0.82rem;
      color: var(--text-light);
      margin-top: 4px;
    }

    /* ═══════════════════════════════════════════
       7. Group Dividers
       ═══════════════════════════════════════════ */
    .group-divider {
      display: flex;
      align-items: center;
      gap: 16px;
      margin: 36px 0 18px;
    }
    .group-divider::before,
    .group-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border);
    }
    .group-divider-label {
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-light);
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* ═══════════════════════════════════════════
       8. Cards (Sections)
       ═══════════════════════════════════════════ */
    .imp-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin-bottom: 20px;
      overflow: hidden;
      transition: box-shadow var(--transition);
      scroll-margin-top: 20px;
    }
    .imp-card:hover {
      box-shadow: var(--shadow-sm);
    }
    .imp-card:target {
      box-shadow: 0 0 0 2px var(--accent);
    }

    .imp-card-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 18px 24px 14px;
      border-bottom: 1px solid var(--border-light);
      background: var(--bg);
    }

    .badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 38px;
      height: 32px;
      padding: 0 10px;
      border-radius: var(--radius-sm);
      background: var(--accent-light);
      color: var(--accent-text);
      font-size: 0.78rem;
      font-weight: 800;
      flex-shrink: 0;
      white-space: nowrap;
      border: 1px solid rgba(245,158,11,0.25);
      font-variant-numeric: tabular-nums;
    }

    .imp-card-header h2 {
      font-size: clamp(1rem, 1.5vw + 0.4rem, 1.15rem);
      font-weight: 700;
      color: var(--text);
      margin: 0;
      line-height: 1.35;
    }

    /* Deep-link anchor icon */
    .imp-card-header h2 .anchor-link {
      display: inline-block;
      margin-left: 6px;
      font-size: 0.8em;
      color: var(--text-light);
      text-decoration: none;
      opacity: 0;
      transition: opacity var(--transition);
      vertical-align: middle;
    }
    .imp-card:hover .anchor-link,
    .anchor-link:focus {
      opacity: 0.6;
    }
    .anchor-link:hover { opacity: 1; }

    /* ═══════════════════════════════════════════
       9. Card Body & Content
       ═══════════════════════════════════════════ */
    .imp-card-body {
      padding: 20px 24px 24px;
    }

    .imp-card-body p {
      margin-bottom: 10px;
      line-height: 1.72;
    }
    .imp-card-body p:last-child {
      margin-bottom: 0;
    }
    .imp-card-body strong {
      color: var(--text);
      font-weight: 650;
    }
    .imp-card-body a {
      color: var(--accent-dark);
      text-decoration: underline;
      text-decoration-color: rgba(180,83,9,0.3);
      text-underline-offset: 3px;
      transition: text-decoration-color var(--transition);
    }
    .imp-card-body a:hover {
      text-decoration-color: var(--accent-dark);
    }
    .imp-card-body a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 2px;
    }

    /* Data list layout for structured info */
    .imp-data-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    .imp-data-list li {
      display: flex;
      gap: 12px;
      padding: 8px 0;
      border-bottom: 1px solid var(--border-light);
      line-height: 1.72;
    }
    .imp-data-list li:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    .imp-data-list li:first-child {
      padding-top: 0;
    }
    .imp-data-label {
      flex-shrink: 0;
      min-width: 140px;
      font-weight: 700;
      color: var(--accent-dark);
      font-size: 0.88rem;
    }
    .imp-data-value {
      flex: 1;
      color: var(--text);
    }

    /* Hint / placeholder notes */
    .imp-hint {
      margin-top: 12px;
      font-size: 0.85rem;
      color: var(--text-light);
    }
    .imp-hint--subtle {
      margin-top: 6px;
      font-size: 0.88rem;
      color: var(--text-mid);
    }

    /* ═══════════════════════════════════════════
       10. Footer
       ═══════════════════════════════════════════ */
    .imp-footer {
      text-align: center;
      margin-top: 48px;
      padding-top: 28px;
      border-top: 2px solid var(--accent);
    }
    .imp-footer .company-name {
      font-weight: 700;
      font-size: 1rem;
      color: var(--text);
      margin-bottom: 8px;
    }
    .imp-footer .contact-info {
      color: var(--text-mid);
      font-size: 0.9rem;
      line-height: 1.9;
    }
    .imp-footer .contact-info a {
      color: var(--accent-dark);
      text-decoration: underline;
      text-decoration-color: rgba(180,83,9,0.3);
      text-underline-offset: 3px;
    }
    .imp-footer .contact-info a:hover { text-decoration-color: var(--accent-dark); }
    .imp-footer .contact-info a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 2px;
    }
    .imp-footer .stand {
      margin-top: 16px;
      font-size: 0.82rem;
      color: var(--text-light);
    }

    /* ═══════════════════════════════════════════
       11. Back-to-Top Button
       ═══════════════════════════════════════════ */
    .back-to-top {
      position: fixed;
      bottom: 24px;
      right: 20px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--accent);
      color: var(--accent-text);
      border: none;
      cursor: pointer;
      font-size: 1.2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-md);
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.3s, transform 0.3s, background var(--transition);
      z-index: 100;
    }
    .back-to-top.visible { opacity: 1; transform: translateY(0); }
    .back-to-top:hover { background: var(--accent-dark); color: #fff; }
    .back-to-top:focus-visible { outline: none; box-shadow: var(--focus-ring); }
    .back-to-top svg { width: 18px; height: 18px; fill: currentColor; }

    /* ═══════════════════════════════════════════
       12. Focus States (WCAG 2.4.7 / 2.4.11)
       ═══════════════════════════════════════════ */
    :focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }
    button:focus-visible,
    a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 4px;
    }

    /* ═══════════════════════════════════════════
       13. Print Styles
       ═══════════════════════════════════════════ */
    @media print {
      .toc, .back-to-top, .progress-bar, .toc-toggle,
      .anchor-link, .group-divider { display: none !important; }

      .imp-layout {
        display: block !important;
      }
      .imp-main {
        max-width: 100% !important;
        padding: 0 !important;
      }
      body {
        font-size: 11pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
      }
      .imp-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 12pt;
      }
      .imp-card:hover { box-shadow: none !important; }
      .imp-card:target { box-shadow: none !important; }
      .imp-card-header { background: #f5f5f5 !important; }
      .badge { background: #eee !important; color: #333 !important; border-color: #ccc !important; }
      a { color: inherit !important; }
      a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.75em;
        color: #666;
      }
      .imp-hero { border-bottom-color: #333; }
      .imp-footer { border-top-color: #333; }
    }

    /* ═══════════════════════════════════════════
       14. Reduced Motion (WCAG 2.3.3)
       ═══════════════════════════════════════════ */
    @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;
      }
      html { scroll-behavior: auto; }
      .progress-bar { transition: none; }
    }

    /* ═══════════════════════════════════════════
       15. Responsive – Tablet (≤ 1080px)
       ═══════════════════════════════════════════ */
    @media (max-width: 1080px) {
      .imp-layout {
        display: block;
      }

      /* ToC becomes full-screen overlay on tablet/mobile */
      .toc {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        max-width: 85vw;
        height: 100dvh;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding-top: 48px;
      }
      .toc.open {
        transform: translateX(0);
      }
      .toc-close {
        display: flex;
      }
      .toc-toggle {
        display: flex;
      }

      /* Overlay backdrop */
      .toc-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 499;
      }
      .toc-backdrop.visible { display: block; }

      .imp-main {
        max-width: 720px;
        margin: 0 auto;
      }
    }

    /* ═══════════════════════════════════════════
       16. Responsive – Mobile (≤ 640px)
       ═══════════════════════════════════════════ */
    @media (max-width: 640px) {
      .imp-main {
        padding: 24px 16px 48px;
      }
      .imp-hero {
        margin-bottom: 28px;
        padding-bottom: 24px;
      }
      .imp-hero h1 { font-size: 1.35rem; }

      .imp-card-header {
        padding: 14px 16px 12px;
        gap: 10px;
      }
      .imp-card-header h2 { font-size: 0.98rem; }
      .badge { height: 28px; min-width: 34px; font-size: 0.72rem; }

      .imp-card-body { padding: 14px 16px 18px; }

      .imp-data-list li {
        flex-direction: column;
        gap: 2px;
      }
      .imp-data-label { min-width: unset; }

      .group-divider { margin: 28px 0 14px; }

      .imp-hint { margin-top: 6px; }

      .back-to-top { width: 40px; height: 40px; bottom: 18px; right: 14px; }
      .toc-toggle { bottom: 66px; right: 14px; width: 40px; height: 40px; }
    }

    /* ═══════════════════════════════════════════
       17. Responsive – Small Mobile (≤ 380px)
       ═══════════════════════════════════════════ */
    @media (max-width: 380px) {
      .imp-main { padding: 16px 12px 40px; }
      .imp-card-header { padding: 12px 12px 10px; }
      .imp-card-body { padding: 12px 12px 16px; }
      body { font-size: 14px; }
    }