/* ==========================================================================
   SUHESI QUANTUM INTELLIGENCE BLOG — Stylesheet (Phase 1 Prototype)
   Inherits palette and typography from ../css/styles.css
   ========================================================================== */

/* 1. Modal Dialog & Scroll Containment (modern-web-guidance) */
dialog:modal {
  overscroll-behavior: contain;
  margin: auto;
  background: #0B211D;
  color: #F8FAFC;
  border: 1px solid #10B981;
  border-radius: 1.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(16, 185, 129, 0.22);
  max-width: 34rem;
  width: calc(100% - 2rem);
  padding: 0;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(3, 9, 7, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 2. Post-Interaction Form Validation (:user-invalid / :user-valid) */
.field {
  margin-bottom: 1.15rem;
}

.hint {
  display: block;
  color: #94A3B8;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.35rem;
}

.error-msg {
  display: none;
  color: #F87171;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 0.35rem;
}

.corp-input {
  width: 100%;
  background-color: #071714;
  border: 1px solid #163E35;
  border-radius: 0.65rem;
  padding: 0.75rem 0.95rem;
  color: #F8FAFC;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.corp-input:focus {
  outline: none;
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

input.corp-input:user-invalid,
input.corp-input.user-invalid-fallback {
  border-color: #EF4444;
  background-color: rgba(127, 29, 29, 0.25);
}

input.corp-input:user-invalid + .error-msg,
input.corp-input.user-invalid-fallback + .error-msg {
  display: block;
}

input.corp-input:user-valid,
input.corp-input.user-valid-fallback {
  border-color: #10B981;
}

/* 3. Responsive Data Tables with Sticky Headers & Container Queries */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 80vh);
  container-type: inline-size;
  border: 1px solid #163E35;
  border-radius: 0.875rem;
  background: #071714;
  margin: 1.75rem 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.table-wrapper:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: 2px;
}

.suhesi-data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  text-align: left;
}

.suhesi-data-table caption {
  caption-side: top;
  text-align: left;
  padding: 0.85rem 1.15rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #10B981;
  background: #091E1A;
  border-bottom: 1px solid #163E35;
}

.suhesi-data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.suhesi-data-table thead th {
  background: #0F2B25;
  color: #10B981;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.9rem 1.1rem;
  border-bottom: 2px solid #10B981;
}

.suhesi-data-table tbody tr {
  transition: background-color 0.15s ease;
}

.suhesi-data-table tbody tr:nth-child(even) {
  background: rgba(11, 33, 29, 0.55);
}

.suhesi-data-table tbody tr:hover {
  background: rgba(16, 185, 129, 0.08);
}

.suhesi-data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: #0B211D;
  color: #F8FAFC;
  font-weight: 600;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #163E35;
  border-right: 1px solid #163E35;
  min-width: 170px;
}

.suhesi-data-table tbody td {
  padding: 0.9rem 1.1rem;
  color: #CBD5E1;
  border-bottom: 1px solid rgba(22, 62, 53, 0.65);
  vertical-align: top;
  line-height: 1.55;
}

@container (width < 600px) {
  .suhesi-data-table,
  .suhesi-data-table thead,
  .suhesi-data-table tbody,
  .suhesi-data-table tr,
  .suhesi-data-table th,
  .suhesi-data-table td {
    display: block;
  }

  .suhesi-data-table thead {
    display: none;
  }

  .suhesi-data-table tbody tr {
    margin: 0.85rem;
    border: 1px solid #163E35;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0B211D;
  }

  .suhesi-data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: #0F2B25;
    color: #10B981;
    border-right: none;
    border-bottom: 1px solid #163E35;
  }

  .suhesi-data-table tbody td:nth-child(2)::before {
    content: var(--label-2) ": ";
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: #10B981;
    display: block;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
  }

  .suhesi-data-table tbody td:nth-child(3)::before {
    content: var(--label-3) ": ";
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: #10B981;
    display: block;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
  }

  .suhesi-data-table tbody td:nth-child(4)::before {
    content: var(--label-4) ": ";
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: #10B981;
    display: block;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
  }
}

/* 4. Long-Form Editorial Typography */
.suhesi-prose {
  color: #E2E8F0;
  font-size: 1.05rem;
  line-height: 1.78;
}

.suhesi-prose h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 700;
  color: #F8FAFC;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #163E35;
  scroll-margin-top: 7rem;
}

.suhesi-prose h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #10B981;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 7rem;
}

.suhesi-prose p {
  margin-bottom: 1.25rem;
}

.suhesi-prose ul,
.suhesi-prose ol {
  margin-bottom: 1.5rem;
  padding-left: 1.4rem;
}

.suhesi-prose li {
  margin-bottom: 0.65rem;
}

.suhesi-prose li strong {
  color: #F8FAFC;
}

.suhesi-prose a {
  color: #34D399;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.suhesi-prose a:hover {
  color: #F59E0B;
}

.suhesi-prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.86em;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6EE7B7;
  padding: 0.12rem 0.4rem;
  border-radius: 0.35rem;
}

/* Reading Progress Bar */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #10B981, #F59E0B);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* Sticky Table of Contents Link Active State */
.toc-link {
  display: block;
  padding: 0.4rem 0.75rem;
  border-left: 2px solid #163E35;
  color: #94A3B8;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.toc-link:hover,
.toc-link.active {
  border-left-color: #10B981;
  color: #10B981;
  background: rgba(16, 185, 129, 0.06);
}
