/* ==========================================================================
   Aerospace Engineering Study Portal: subject tab strip
   The row of links that joins a subject's hand-written index pages
   (Theory, Problems, Extra problems, Exam simulator, Formula sheet, PDFs). It sits inside
   <main>, below the header, so the header keeps only the portal link
   (tools/tests/test_sidebar.py). Text colours come from the page's own
   variables, which the reading palettes re-point, so every palette keeps
   AAA contrast; the accent is used only for borders and fills.
   Markup:
     <nav class="subject-tabs" aria-label="Business Management sections">
       <a class="subject-tab" href="../teoria/index.html">...</a>
       <a class="subject-tab" href="../problemas/index.html" aria-current="page">...</a>
       <span class="subject-tab" aria-disabled="true">... <span class="subject-tab__soon">Soon</span></span>
     </nav>
   ========================================================================== */
.subject-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 6px;
  border: 1px solid var(--border-card, rgba(127, 127, 127, 0.25));
  border-radius: 999px;
  background: var(--bg-card, transparent);
}

.subject-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body, "Newsreader", Georgia, serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-secondary, inherit);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* One icon per section, drawn with a mask so it takes the subject accent. The order of the tabs is
   fixed (Theory, Problems, Extra problems, Exam simulator, then Formula sheet and PDFs). */
.subject-tab::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background-color: var(--accent, currentColor);
  -webkit-mask: var(--tab-icon) center / contain no-repeat;
  mask: var(--tab-icon) center / contain no-repeat;
}
.subject-tab:nth-child(1) { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6.5C10.2 5.2 7.6 4.5 4 4.5v13c3.6 0 6.2.7 8 2 1.8-1.3 4.4-2 8-2v-13c-3.6 0-6.2.7-8 2z'/%3E%3Cpath d='M12 6.5v13'/%3E%3C/svg%3E"); }
.subject-tab:nth-child(2) { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4.5L15.5 5a2.1 2.1 0 0 1 3 3L8 18.5 4 20z'/%3E%3Cpath d='M13.5 7l3 3'/%3E%3Cpath d='M13 20h7'/%3E%3C/svg%3E"); }
.subject-tab:nth-child(3) { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Ccircle cx='12' cy='12' r='.9' fill='black'/%3E%3C/svg%3E"); }
.subject-tab:nth-child(4) { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12M6 21h12'/%3E%3Cpath d='M7.5 3v3.2c0 2 4.5 3.8 4.5 5.8s-4.5 3.8-4.5 5.800V21'/%3E%3Cpath d='M16.5 3v3.200c0 2-4.5 3.8-4.5 5.800s4.5 3.8 4.5 5.800V21'/%3E%3C/svg%3E"); }
.subject-tab[href*="formula-sheet"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M15.5 8.5H9l3.6 3.5L9 15.5h6.5'/%3E%3C/svg%3E"); }
.subject-tab[href*="sources"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 18.500V6.500a1.5 1.5 0 0 1 1.5-1.500h4l2 2.500h6.500a1.5 1.5 0 0 1 1.5 1.500V11'/%3E%3Cpath d='M3.5 18.500l2.3-6.500a1.5 1.5 0 0 1 1.4-1H20.500a1 1 0 0 1 .95 1.300l-1.9 5.700a1.5 1.5 0 0 1-1.4 1H4.200a.7.7 0 0 1-.7-.500z'/%3E%3C/svg%3E"); }

a.subject-tab:hover {
  color: var(--text-primary, inherit);
  background: var(--bg-input, rgba(127, 127, 127, 0.08));
}

a.subject-tab:focus-visible {
  outline: 2px solid var(--accent, currentColor);
  outline-offset: 2px;
}

.subject-tab[aria-current="page"] {
  color: var(--text-primary, inherit);
  background: var(--accent-soft, rgba(127, 127, 127, 0.12));
  border-color: var(--accent, currentColor);
}

.subject-tab[aria-disabled="true"] {
  cursor: default;
  opacity: 1;
}
.subject-tab[aria-disabled="true"]::before { opacity: 0.45; }

.subject-tab__soon {
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  border: 1px solid var(--border-card, currentColor);
  border-radius: 999px;
}

@media (max-width: 700px) {
  .subject-tabs { display: grid; grid-template-columns: 1fr 1fr; width: auto; border-radius: 18px; }
  .subject-tab { justify-content: center; padding: 9px 10px; font-size: 0.94rem; white-space: normal; }
}

@media print {
  .subject-tabs { display: none !important; }
}
