/* =========================
   Self-hosted fonts
   Put these files in:
   docs/assets/fonts/
   ========================= */

/* Headings (serif, editorial) */
@font-face {
  font-family: "Lora";
  src: url("../assets/fonts/Lora-VariableFont.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Code / config examples */
@font-face {
  font-family: "Fira Mono";
  src: url("../assets/fonts/FiraMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Body text */
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-VariableFont.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* =========================
   Material global font wiring
   ========================= */

:root {
  --md-text-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --md-code-font: "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* =========================
   Layout / header / tabs
   ========================= */

.md-grid {
  max-width: 1400px;
}

.md-header__title {
  flex-grow: 1;
  font-size: 1.1rem;
  height: 2.2rem;
  line-height: 2.2rem;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.md-header {
  height: 2.2rem;
}

.md-tabs {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.md-tabs__list {
  justify-content: center;
}

.md-tabs__item {
  height: 1.85rem;
  padding-left: 1.2em;
  padding-right: 1.2em;
}

/* =========================
   Typography (dense site-wide)
   ========================= */

.md-typeset {
  font-size: 0.80rem;   /* main global reduction */
  line-height: 1.32;    /* tighter, but still readable */
}

/* Tighten vertical rhythm */
.md-typeset p,
.md-typeset ul,
.md-typeset ol,
.md-typeset blockquote,
.md-typeset pre,
.md-typeset table {
  margin: 0.35em 0;
}

/* Exclude admonition titles from global p margin reduction */
/* Make title a flex row so icon and text always centre-align */
.md-typeset .admonition-title,
.md-typeset details > summary {
  margin-top: 0;
  margin-bottom: 0;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem;
}

/* ::before becomes a flex item — remove its inline vertical-align offset */
.md-typeset .admonition-title::before,
.md-typeset details > summary::before {
  flex-shrink: 0;
  margin-right: 0 !important;
  vertical-align: unset !important;
}

/* Lists: reduce indentation slightly */
.md-typeset ul,
.md-typeset ol {
  padding-left: 1.1em;
}

/* Headings: compact, not huge */
.md-typeset h1 {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  margin: 0.55em 0 0.30em;
  line-height: 1.18;
  color: #111827;
}

.md-typeset h2 {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0.65em 0 0.30em;
  line-height: 1.20;
  color: #111827;
}

.md-typeset h3 {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: 1.00rem;
  margin: 0.75em 0 0.30em;
  line-height: 1.22;
  color: #111827;
}

/* Inline code: keep tight and consistent */
.md-typeset code {
  font-size: 0.82em;
}

/* Code blocks: slightly larger than body (so configs stay readable) */
.md-typeset pre code {
  font-size: 0.74rem;
  line-height: 1.35;
}

/* Make long configs scroll horizontally instead of wrapping */
.md-typeset pre {
  overflow-x: auto;
  padding: 0.85rem;
  border-radius: 0.6rem;
}

/* =========================
   Homepage cards
   ========================= */

.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > ol > li {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* Pin "Read post" link to bottom of every card */
.md-typeset .grid.cards > ul > li > p:last-of-type,
.md-typeset .grid.cards > ol > li > p:last-of-type {
  margin-top: auto;
  padding-top: 0.5em;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > ol > li:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transform: translateY(-2px);
}

/* Inline tag chips inside cards (backtick text) */
.md-typeset .grid.cards code {
  background: var(--md-default-fg-color--lightest);
  border-radius: 2rem;
  padding: 0.1em 0.55em;
  font-size: 0.72rem;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--md-default-fg-color--light);
  letter-spacing: 0.01em;
}

/* =========================
   Images: consistent sizing
   ========================= */

/* Full pages: fixed 700px, left-aligned */
.md-typeset img {
  display: block;
  margin: 0.7rem 0;
  height: auto;
  width: min(100%, 700px);
}

/* Blog index/excerpts: keep images smaller so listings look tidy */
.md-post--excerpt img,
.md-blog .md-typeset img {
  max-width: min(100%, 520px);
}

/* Author avatar: restore inline layout (don't let global img rule break it) */
.md-author img {
  display: inline;
  margin: 0;
  max-width: none;
  height: 100%;
}

/* =========================
   Color scheme
   ========================= */

/* Header: deep navy */
.md-header {
  background-color: #1a2744;
}

/* Tabs: match header */
.md-tabs {
  background-color: #1a2744;
}

/* Active / hovered tab: gold */
.md-tabs__link {
  color: rgba(255, 255, 255, 0.7);
}
.md-tabs__link--active,
.md-tabs__link:hover {
  color: #f5c518;
}

/* Announcement bar: forest green */
.md-announce {
  background-color: #1d5c3e;
  color: #ffffff;
}
.md-announce a {
  color: #f5c518 !important;
}

/* Links: dark amber */
.md-typeset a {
  color: #8a6200;
}
.md-typeset a:hover {
  color: #1d5c3e;
}

/* Code blocks: light background, dark text */
.md-typeset pre {
  background-color: #f5f6f8;
}
.md-typeset pre code {
  color: #111827;
}

/* =========================
   Homepage: intro + book covers
   ========================= */

.intro-section {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.intro-text {
  flex: 1;
  min-width: 0;
}

/* Intro paragraphs inside .intro-text */
.intro-text p {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #111827;
}

.books-section {
  display: flex;
  gap: 1.2rem;
  flex-shrink: 0;
  align-items: stretch;
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none !important;
  width: 140px;
}

.book-card img {
  display: block !important;
  margin: 0 !important;
  width: 130px !important;
  max-width: 130px !important;
  height: 180px !important;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover img {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.24);
}

.book-title {
  display: block;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #111827;
  margin-top: 0.5em;
  line-height: 1.3;
  flex: 1;
}

.book-buy {
  display: block;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  color: #8a6200;
  margin-top: 0.4em;
}

.book-card:hover .book-buy {
  color: #1d5c3e;
}

/* =========================
   Homepage: Courier New font
   ========================= */

/* Scope to homepage wrapper only */
.home-page h2 {
  font-family: "Courier New", Courier, monospace;
}

.home-page h1,
.intro-text h1 {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #111827;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Intro paragraphs: Inter, very dark */
.home-page > p,
.intro-text p {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #111827;
}

/* Featured Posts heading */
.home-page h2 {
  font-size: 1.0rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 400;
  margin-bottom: 1.0em;
}

/* Cards remain Inter — reset everything inside */
.home-page .grid.cards * {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

/* View all posts link: keep Inter + amber */
.home-page > p:last-child a {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #8a6200;
}
.home-page > p:last-child a:hover {
  color: #1d5c3e;
}
