/* AI Hardware Engineer Roadmap — MkDocs Material Custom Theme */

:root {
  --md-text-font-family: Helvetica, Arial, sans-serif;
  --md-code-font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;
  --aihpc-sticky-offset: 4.8rem;
}

/* ── Layout ───────────────────────────────────── */
.md-grid {
  max-width: 1440px;
}

.md-content__inner {
  padding-top: 1.2rem;
}

/* ── Hero H1 ──────────────────────────────────── */
.md-content__inner > h1:first-of-type,
.md-typeset h1 {
  font-size: 1.7rem !important;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.15;
}

/* Content paragraphs — always left-aligned */
.md-content__inner > p {
  text-align: left;
}

/* Prevent long inline content in prose from overflowing on narrow screens */
.md-typeset p,
.md-typeset li,
.md-typeset td,
.md-typeset blockquote {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Standalone bold label lines (e.g. "You will learn to:") */
.md-typeset p > strong:only-child {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

/* Banner image */
.md-content__inner > p > img[alt="AI Hardware Engineer Roadmap"] {
  display: block;
  margin: 0 auto 0.5rem;
  width: min(920px, 100%);
  max-width: 100%;
  border-radius: 18px;
  box-shadow: 0 10px 34px rgba(2, 8, 23, 0.18);
}

.md-typeset img[alt="AI Chip Stack Diagram"] {
  display: block;
  width: min(860px, 100%);
  height: auto;
  max-width: 100%;
  margin: 1.2rem auto 1rem;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(2, 8, 23, 0.16);
}

/* ── Horizontal rule ──────────────────────────── */
.md-typeset hr {
  border-color: var(--md-typeset-table-color);
  margin: 1.8rem 0;
}

/* ── Headings ─────────────────────────────────── */
.md-typeset h2 {
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 2px solid var(--md-primary-fg-color);
  padding-bottom: 0.4rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.md-typeset h3 {
  font-weight: 600;
  margin-top: 1.6rem;
}

.md-typeset h4 {
  font-weight: 600;
  color: var(--md-primary-fg-color);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  margin-top: 1.4rem;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  scroll-margin-top: calc(var(--aihpc-sticky-offset) + 0.8rem);
}

/* ── Tables ───────────────────────────────────── */
.md-typeset table:not([class]) {
  font-size: 0.875rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--md-typeset-table-color);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  margin: 1.2rem 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.md-typeset table:not([class]) th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--md-typeset-table-color);
  border-bottom: 2px solid var(--md-primary-fg-color);
  padding: 0.6rem 0.85rem;
  white-space: normal;
}

.md-typeset table:not([class]) td {
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--md-typeset-table-color);
  vertical-align: top;
  line-height: 1.55;
}

.md-typeset table:not([class]) tr:first-child td {
  border-top: none;
}

.md-typeset table:not([class]) tr:hover td {
  background: var(--md-accent-fg-color--transparent);
}

/* Soften bold inside table cells — keep emphasis but reduce visual weight */
.md-typeset table:not([class]) td strong,
.md-typeset table:not([class]) td:first-child {
  font-weight: 500;
}

/* ── Code blocks ──────────────────────────────── */
.md-typeset code {
  font-size: 0.82em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.md-typeset pre {
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.md-typeset pre code {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.8em;
  line-height: 1.55;
}

/* ── Blockquotes as callouts ──────────────────── */
.md-typeset blockquote {
  border-left: 4px solid var(--md-primary-fg-color);
  background: var(--md-admonition-bg-color);
  padding: 0.75rem 1.2rem 0.75rem 1.4rem;
  border-radius: 0 8px 8px 0;
  margin: 1.2rem 0;
  font-size: 0.75rem;
  color: var(--md-default-fg-color--light);
}

.md-typeset blockquote p {
  margin-bottom: 0.3rem;
}

.md-typeset blockquote p:last-child {
  margin-bottom: 0;
}

/* ── Admonitions ──────────────────────────────── */
.md-typeset .admonition {
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Navigation tabs ──────────────────────────── */
.md-tabs {
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(48, 63, 161, 0.96), rgba(63, 81, 181, 0.94));
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.md-tabs__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.18rem 0 0.08rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.md-tabs__list::-webkit-scrollbar {
  display: none;
}

.md-tabs__item {
  height: auto;
  flex: 0 0 auto;
}

.md-tabs__link {
  background: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-top: 0;
  max-width: none;
  opacity: 0.92;
  overflow: visible;
  padding: 0.5rem 0.12rem 0.42rem;
  text-overflow: clip;
  transition: border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.md-tabs__link:hover {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.45);
  opacity: 1;
  transform: none;
}

.md-tabs__link--active {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.98);
  box-shadow: none;
  color: var(--md-primary-bg-color);
  font-weight: 800;
  opacity: 1;
}

/* ── Sidebar nav ──────────────────────────────── */
.md-nav__title {
  font-weight: 700;
}

.md-nav__link {
  font-size: 0.74rem;
}

@keyframes sidebar-enter {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media screen and (min-width: 960px) {
  .md-sidebar--primary {
    width: 16.2rem;
  }

  .md-sidebar--secondary {
    width: 13rem;
  }

  .md-sidebar--primary .md-sidebar__inner,
  .md-sidebar--secondary .md-sidebar__inner {
    animation: sidebar-enter 0.32s ease;
  }

  .md-sidebar__scrollwrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(46, 144, 250, 0.45) transparent;
  }

  .md-sidebar__scrollwrap::-webkit-scrollbar {
    width: 8px;
  }

  .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background: rgba(46, 144, 250, 0.35);
    border-radius: 999px;
  }

  .md-sidebar--primary .md-nav--primary {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .md-sidebar--primary .md-nav__title,
  .md-sidebar--primary .md-nav__source {
    border-radius: 0;
  }

  .md-sidebar--primary .md-nav__title {
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(53, 80, 125, 0.14);
    color: var(--md-default-fg-color--light);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    padding: 0 0 0.5rem;
    text-transform: uppercase;
  }

  .md-sidebar--primary .md-nav__source {
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(53, 80, 125, 0.1);
    margin-bottom: 0.5rem;
    overflow: hidden;
    padding-bottom: 0.5rem;
  }

  .md-sidebar--primary .md-nav__list {
    gap: 0.02rem;
  }

  .md-sidebar--primary .md-nav__item {
    margin: 0.01rem 0;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item {
    margin-top: 0.3rem;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__link {
    color: var(--md-default-fg-color);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.08rem;
  }

  .md-sidebar--primary .md-nav__link {
    border-radius: 0;
    font-size: 0.72rem;
    line-height: 1.32;
    padding: 0.18rem 0.1rem 0.18rem 0.82rem;
    transition: color 0.18s ease, transform 0.18s ease;
  }

  .md-sidebar--primary .md-nav__link:hover {
    background: transparent;
    color: var(--md-primary-fg-color);
    transform: translateX(1px);
  }

  .md-sidebar--primary .md-nav__link--active {
    background: transparent;
    box-shadow: inset 2px 0 0 var(--md-primary-fg-color);
    color: var(--md-primary-fg-color);
    font-weight: 700;
  }

  .md-sidebar--primary .md-nav .md-nav {
    border-left: 1px solid rgba(53, 80, 125, 0.1);
    margin-left: 0.28rem;
    padding-left: 0.22rem;
  }

  .md-sidebar--primary .md-nav .md-nav .md-nav__link {
    font-size: 0.71rem;
    padding-left: 0.68rem;
  }

  .md-sidebar--secondary .md-nav--secondary {
    background: transparent;
    border: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .md-sidebar--secondary .md-nav__title {
    background: var(--md-default-bg-color);
    border: 0;
    border-bottom: 1px solid rgba(53, 80, 125, 0.14);
    color: var(--md-default-fg-color--light);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    padding: 0 0 0.5rem;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    z-index: 1;
  }

  .md-sidebar--secondary .md-nav__list {
    gap: 0.02rem;
  }

  .md-sidebar--secondary .md-sidebar__scrollwrap,
  .md-sidebar--secondary .md-sidebar__inner,
  .md-sidebar--secondary .md-nav--secondary {
    background: var(--md-default-bg-color);
  }

  .md-sidebar--secondary .md-sidebar__inner {
    border-left: 1px solid rgba(53, 80, 125, 0.1);
    padding-left: 0.85rem;
  }

  .md-sidebar--secondary .md-nav__link {
    border-left: 2px solid transparent;
    font-size: 0.72rem;
    line-height: 1.34;
    margin-left: 0;
    padding: 0.16rem 0 0.16rem 0.72rem;
  }

  .md-sidebar--secondary .md-nav__link:hover {
    background: transparent;
    color: var(--md-primary-fg-color);
  }

  .md-sidebar--secondary .md-nav__link--active {
    background: transparent;
    border-left-color: var(--md-primary-fg-color);
    color: var(--md-primary-fg-color);
    font-weight: 700;
  }

  .md-sidebar--secondary .md-nav .md-nav {
    border-left: 1px solid rgba(53, 80, 125, 0.08);
    margin-left: 0.3rem;
    padding-left: 0.18rem;
  }

  .md-sidebar--secondary .md-nav .md-nav__link {
    font-size: 0.69rem;
  }
}

/* ── Header ───────────────────────────────────── */
.md-header {
  background: linear-gradient(180deg, #4051b5, #3a4aa5);
  box-shadow: 0 1px 8px rgba(0,0,0,0.12);
}

.md-header__title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Logo ─────────────────────────────────────── */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  fill: currentcolor;
  display: block !important;
  height: 2.4rem !important;
  width: auto !important;
  border-radius: 6px !important;
}

/* ── Footer ───────────────────────────────────── */
.md-footer-meta a {
  color: var(--md-accent-fg-color);
}

/* ── Mermaid diagrams ─────────────────────────── */
.mermaid {
  text-align: center;
  margin: 1.5rem 0;
}

/* ── Tag chips ────────────────────────────────── */
.md-tag {
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

/* ── Search ───────────────────────────────────── */
.md-search__form {
  border-radius: 6px;
  background: var(--md-default-bg-color);
  border: 1px solid rgba(59, 130, 246, 0.14);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.md-search__icon::before,
.md-search__icon::after,
.md-search__suggest::before,
.md-search__suggest::after,
.md-search-result__icon::before,
.md-search-result__icon::after {
  box-sizing: inherit !important;
}

.md-search__input {
  border-radius: 8px;
  color: var(--md-default-fg-color);
  font-size: 0.78rem;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
  font-size: 0.72rem;
  opacity: 0.8;
}

.md-search__output {
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.12);
  overflow: hidden;
}

.md-search-result__meta {
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid rgba(59, 130, 246, 0.12);
  color: var(--md-default-fg-color--light);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.75rem 0.9rem;
}

.md-search-result__item {
  border-radius: 10px;
  margin: 0.18rem 0;
  overflow: hidden;
}

.md-search-result__link {
  border-radius: 10px;
  padding: 0.78rem 0.9rem;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.md-search-result__link:hover,
.md-search-result__link:focus {
  background: rgba(59, 130, 246, 0.07);
  transform: none;
}

.md-search-result__title {
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: normal;
}

.md-search-result__teaser {
  color: var(--md-default-fg-color--light);
  font-size: 0.74rem;
  line-height: 1.5;
  margin-top: 0.14rem;
}

.md-search-result mark {
  background: rgba(59, 130, 246, 0.16);
  color: inherit;
  border-radius: 4px;
  padding: 0 0.14em;
}

.md-search-result__more {
  padding: 0.55rem 0.9rem 0.45rem;
}

.md-search-result__teaser:empty {
  display: none;
}

.md-search__scrollwrap {
  margin: 0;
}

.md-search-result__list:empty + .md-search-result__meta,
.md-search-result__meta:empty {
  display: none;
}

.md-search-result {
  padding-bottom: 0;
}

.md-search__suggest {
  display: none !important;
  padding-bottom: 0.35rem;
}

[data-md-color-scheme="slate"] .md-search__output {
  box-shadow: 0 18px 46px rgba(2, 6, 23, 0.52);
  border-color: rgba(96, 165, 250, 0.16);
}

[data-md-color-scheme="slate"] .md-search__form {
  background: #111827;
  border-color: rgba(96, 165, 250, 0.18);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.34);
}

[data-md-color-scheme="slate"] .md-search__input {
  color: rgba(255, 255, 255, 0.92);
}

[data-md-color-scheme="slate"] .md-search__input::placeholder {
  color: rgba(203, 213, 225, 0.72);
}

[data-md-color-scheme="slate"] .md-search-result__meta {
  background: rgba(59, 130, 246, 0.12);
  border-bottom-color: rgba(96, 165, 250, 0.16);
}

[data-md-color-scheme="slate"] .md-search-result__link:hover,
[data-md-color-scheme="slate"] .md-search-result__link:focus {
  background: rgba(96, 165, 250, 0.12);
}

[data-md-color-scheme="slate"] .md-search-result mark {
  background: rgba(96, 165, 250, 0.22);
}

/* ── Print ────────────────────────────────────── */
@media print {
  .md-sidebar,
  .md-tabs,
  .md-header,
  .md-footer {
    display: none;
  }
  .md-content {
    max-width: 100%;
  }
}

/* ── Tablet (≤ 960px) ─────────────────────────── */
@media screen and (max-width: 960px) {
  .md-typeset table:not([class]) {
    font-size: 0.82rem;
  }

  .md-typeset img[alt="AI Chip Stack Diagram"] {
    width: min(760px, 100%);
  }

  .md-tabs__link {
    font-size: 0.69rem;
    padding: 0.46rem 0.08rem 0.4rem;
  }
}

/* ── Mobile (≤ 768px) ─────────────────────────── */
@media screen and (max-width: 768px) {
  .md-content__inner > h1:first-of-type,
  .md-typeset h1 {
    font-size: 1.6rem !important;
  }

  .md-typeset table:not([class]) {
    font-size: 0.78rem;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 0.35rem 0.5rem;
  }

  .md-typeset img[alt="AI Chip Stack Diagram"] {
    width: 100%;
  }

  .md-header__button.md-logo img,
  .md-header__button.md-logo svg {
    height: 1.8rem !important;
  }
}

/* ── Small phone (≤ 480px) ────────────────────── */
@media screen and (max-width: 480px) {
  .md-content__inner > h1:first-of-type,
  .md-typeset h1 {
    font-size: 1.35rem !important;
    letter-spacing: -0.02em;
  }

  .md-typeset table:not([class]) {
    font-size: 0.72rem;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 0.28rem 0.4rem;
  }

  .md-typeset pre code {
    font-size: 0.72em;
  }
}

/* ── Dark mode refinements ────────────────────── */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

[data-md-color-scheme="slate"] .md-typeset pre {
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

[data-md-color-scheme="slate"] .md-content__inner > p > img[alt="AI Hardware Engineer Roadmap"] {
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

[data-md-color-scheme="slate"] .md-tabs {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(31, 41, 55, 0.96));
  border-bottom-color: rgba(148, 163, 184, 0.18);
}

[data-md-color-scheme="slate"] .md-header {
  background: linear-gradient(180deg, #111827, #1f2937);
}

[data-md-color-scheme="slate"] .md-tabs__link:hover {
  background: transparent;
  border-bottom-color: rgba(191, 219, 254, 0.52);
}

[data-md-color-scheme="slate"] .md-tabs__link--active {
  background: transparent;
  border-bottom-color: rgba(191, 219, 254, 0.98);
  box-shadow: none;
}
