/* ==========================================================================
   iynewz.dev — kami-inspired theme
   Inspired by tw93/Kami. Warm parchment canvas, ink-blue accent,
   serif hierarchy, no hard shadows, no italic.
   ========================================================================== */

/* ---- Color tokens ---- */
:root {
  /* Brand */
  --kami-brand: #1B365D;
  --kami-brand-light: #2D5A8A;

  /* Surface (warm neutrals only — no cool blue-grays) */
  --kami-parchment: #fbfaf7;
  --kami-ivory: #fffcf6;
  --kami-warm-sand: #efe9db;

  /* Text */
  --kami-near-black: #141413;
  --kami-dark-warm: #3d3d3a;
  --kami-charcoal: #4d4c48;
  --kami-olive: #5e5d59;
  --kami-stone: #87867f;

  /* Border */
  --kami-border-cream: #e8e5da;
  --kami-border-warm: #e0ddd2;
  --kami-border-soft: #e5e3d8;

  /* Ring shadow */
  --kami-ring-warm: #d1cfc5;

  /* Map Material theme tokens to kami tokens — light scheme */
  --md-default-bg-color: var(--kami-parchment);
  --md-default-fg-color: var(--kami-near-black);
  --md-default-fg-color--light: var(--kami-olive);
  --md-default-fg-color--lighter: var(--kami-stone);
  --md-default-fg-color--lightest: var(--kami-border-warm);

  --md-primary-fg-color: var(--kami-brand);
  --md-primary-fg-color--light: var(--kami-brand-light);
  --md-primary-fg-color--dark: var(--kami-brand);
  --md-primary-bg-color: var(--kami-parchment);
  --md-primary-bg-color--light: var(--kami-ivory);

  --md-accent-fg-color: var(--kami-brand);
  --md-accent-fg-color--transparent: rgba(27, 54, 93, 0.1);
  --md-accent-bg-color: var(--kami-parchment);

  --md-typeset-color: var(--kami-near-black);
  --md-typeset-a-color: var(--kami-brand);

  --md-code-bg-color: var(--kami-ivory);
  --md-code-fg-color: var(--kami-charcoal);
}

/* Dark scheme — kami deep-dark */
[data-md-color-scheme="slate"] {
  --kami-parchment: #141413;
  --kami-ivory: #1e1d1b;
  --kami-warm-sand: #30302e;

  --kami-near-black: #e8e5da;
  --kami-dark-warm: #b0aea5;
  --kami-charcoal: #b0aea5;
  --kami-olive: #87867f;
  --kami-stone: #5e5d59;

  --kami-border-cream: #2a2927;
  --kami-border-warm: #35332f;
  --kami-border-soft: #2a2927;

  --md-default-bg-color: var(--kami-parchment);
  --md-default-fg-color: var(--kami-near-black);
  --md-typeset-color: var(--kami-near-black);
  --md-typeset-a-color: var(--kami-dark-link);
  --md-code-bg-color: var(--kami-ivory);
  --md-accent-fg-color: var(--kami-dark-link);
  --md-accent-fg-color--transparent: rgba(169, 199, 240, 0.15);
}

/* Dark-mode link color: light, slightly warm blue so links are readable on dark bg */
[data-md-color-scheme="slate"] {
  --kami-dark-link: #a9c7f0;
}

[data-md-color-scheme="slate"] .md-typeset a {
  color: var(--kami-dark-link);
  border-bottom-color: rgba(169, 199, 240, 0.35);
}
[data-md-color-scheme="slate"] .md-typeset a:hover {
  color: #c9dcf7;
  border-bottom-color: #c9dcf7;
}
[data-md-color-scheme="slate"] .md-tabs__link--active,
[data-md-color-scheme="slate"] .md-tabs__link:hover,
[data-md-color-scheme="slate"] .md-nav__link:hover,
[data-md-color-scheme="slate"] .md-nav__link--active,
[data-md-color-scheme="slate"] .md-content article > h3 a:hover,
[data-md-color-scheme="slate"] .md-social a:hover {
  color: var(--kami-dark-link);
}

/* ---- Typography ---- */

/* Newsreader serif — the editorial voice. */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:wght@400;500;600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --kami-serif: "Newsreader", "Source Serif 4", "Source Serif Pro", "Charter",
    Georgia, "Times New Roman", serif;
  --kami-sans: "Inter", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Arial, sans-serif;
  --kami-mono: "JetBrains Mono", "SF Mono", "Fira Code", Consolas, Monaco, monospace;

  --md-text-font: "Newsreader", Georgia, serif;
  --md-code-font: "JetBrains Mono", Consolas, monospace;
}

body {
  font-family: var(--kami-serif);
  background: var(--kami-parchment);
  color: var(--kami-near-black);
  font-feature-settings: "kern", "liga", "onum";
}

.md-typeset {
  font-family: var(--kami-serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--kami-near-black);
  font-weight: 400;
}

/* Headings — serif at 500, never synthetic bold. No italic. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-family: var(--kami-serif);
  font-weight: 500;
  color: var(--kami-near-black);
  font-style: normal;
  letter-spacing: -0.01em;
}

.md-typeset h1 {
  font-size: 1.9em;
  line-height: 1.2;
  margin-top: 0.4em;
  margin-bottom: 0.8em;
  color: var(--kami-near-black);
}
.md-typeset h2 {
  font-size: 1.35em;
  line-height: 1.25;
  margin-top: 2em;
  border-bottom: 1px solid var(--kami-border-cream);
  padding-bottom: 0.3em;
}
.md-typeset h3 {
  font-size: 1.1em;
  line-height: 1.3;
  margin-top: 1.6em;
}

/* No italic anywhere */
.md-typeset em,
.md-typeset i,
.md-typeset cite {
  font-style: normal;
  color: var(--kami-olive);
}

/* UI chrome unified with body: everything uses serif, so the page
   reads as one typographic voice instead of serif-body + sans-chrome mix.
   Search input stays sans (it's an input element). */
.md-header,
.md-tabs,
.md-nav,
.md-footer {
  font-family: var(--kami-serif);
}

.md-search__input,
.md-search-result {
  font-family: var(--kami-sans);
}

/* ---- Header ---- */
.md-header {
  background: var(--kami-parchment);
  color: var(--kami-near-black);
  box-shadow: none;
  border-bottom: 1px solid var(--kami-border-cream);
}

.md-header__title {
  color: var(--kami-near-black);
  font-weight: 500;
  font-family: var(--kami-serif);
}

.md-header__button {
  color: var(--kami-near-black);
}

.md-search__input {
  background: var(--kami-ivory);
  color: var(--kami-near-black);
  border-radius: 8px;
}

.md-search__input::placeholder {
  color: var(--kami-stone);
}

/* ---- Tabs (top nav) ---- */
.md-tabs {
  background: var(--kami-parchment);
  color: var(--kami-near-black);
  border-bottom: 1px solid var(--kami-border-cream);
}
.md-tabs__link {
  color: var(--kami-olive);
  opacity: 1;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0;
  font-family: var(--kami-serif);
}
.md-tabs__link:hover,
.md-tabs__link--active {
  color: var(--kami-brand);
  opacity: 1;
}

/* ---- Links ---- */
.md-typeset a {
  color: var(--kami-brand);
  text-decoration: none;
  border-bottom: 1px solid rgba(27, 54, 93, 0.3);
  transition: border-color 0.15s;
}
.md-typeset a:hover {
  color: var(--kami-brand);
  border-bottom-color: var(--kami-brand);
}

/* ---- Blockquote ---- */
.md-typeset blockquote {
  color: var(--kami-olive);
  border-left: 2px solid var(--kami-brand);
  padding-left: 1em;
  font-style: normal;
}

/* ---- Code ---- */
.md-typeset code {
  background: var(--kami-warm-sand);
  color: var(--kami-charcoal);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-family: var(--kami-mono);
  font-size: 0.88em;
}

.md-typeset pre > code,
.md-typeset .highlight pre {
  background: var(--kami-ivory);
  border: 1px solid var(--kami-border-cream);
  border-radius: 8px;
  box-shadow: none;
  font-size: 0.85em;
  line-height: 1.5;
}

/* ---- Content area ---- */
.md-main__inner {
  background: var(--kami-parchment);
}

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

/* Breadcrumb / path — make it feel like part of the page, not a foreign widget.
   Serif, ~0.82rem, subtle olive, tighter separator. */
.md-path {
  font-family: var(--kami-serif);
  font-size: 0.85rem;
  color: var(--kami-stone);
  padding: 0.6rem 0 0.2rem;
  margin-bottom: 0.2rem;
  background: transparent;
  border: none;
}
.md-path__list {
  gap: 0.35rem;
}
.md-path__link {
  color: var(--kami-stone);
  opacity: 1;
  font-weight: 400;
  font-family: var(--kami-serif);
}
.md-path__link:hover {
  color: var(--kami-brand);
}
.md-path__item {
  color: var(--kami-stone);
  font-family: var(--kami-serif);
}

/* Date under H1 (existing override) — serif now too, smaller, subtle */
.page-date {
  color: var(--kami-stone);
  font-family: var(--kami-serif);
  font-size: 0.85em;
  margin-top: -0.4em;
  margin-bottom: 2em;
  font-style: normal;
  opacity: 1;
  letter-spacing: 0;
}

/* ---- Blog index: H3 cards ---- */
.md-content article > h3 {
  margin-top: 2em;
  margin-bottom: 0.25em;
  font-size: 1.15em;
  line-height: 1.3;
  padding-bottom: 0;
  border-bottom: none;
}
.md-content article > h3 + p {
  margin-top: 0;
  color: var(--kami-olive);
  line-height: 1.55;
}
.md-content article > h3 a {
  color: var(--kami-near-black);
  border-bottom: none;
}
.md-content article > h3 a:hover {
  color: var(--kami-brand);
  border-bottom: none;
}

.post-date {
  color: var(--kami-stone);
  font-family: var(--kami-serif);
  font-size: 0.75em;
  font-weight: 400;
  margin-left: 0.5em;
  opacity: 1;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: 0.1em;
}

/* ---- Sidebar nav (serif, aligned with body) ---- */
.md-nav {
  font-size: 0.88rem;
  font-family: var(--kami-serif);
}
.md-nav__title {
  color: var(--kami-olive);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.88rem;
  font-family: var(--kami-serif);
}
.md-nav__link {
  color: var(--kami-olive);
}
.md-nav__link:hover,
.md-nav__link--active {
  color: var(--kami-brand);
}

/* ---- Footer ---- */
.md-footer {
  background: var(--kami-parchment);
  color: var(--kami-olive);
  border-top: 1px solid var(--kami-border-cream);
}

.md-footer-meta {
  background: var(--kami-parchment);
}

.md-footer__title {
  color: var(--kami-olive);
}

.md-copyright,
.md-social a {
  color: var(--kami-olive);
}
.md-social a:hover {
  color: var(--kami-brand);
}

/* ---- Misc cleanup ---- */
hr,
.md-typeset hr {
  border: none;
  border-top: 1px dashed var(--kami-border-soft);
  margin: 2em 0;
}

/* Soften any shadow that Material might apply */
.md-header,
.md-tabs,
.md-nav,
.md-footer,
.md-search,
.md-dialog,
.md-search-result {
  box-shadow: none !important;
}

/* Table */
.md-typeset table:not([class]) {
  background: var(--kami-ivory);
  border: 1px solid var(--kami-border-cream);
  border-radius: 8px;
  box-shadow: none;
}
.md-typeset table:not([class]) th {
  background: var(--kami-warm-sand);
  color: var(--kami-near-black);
  font-family: var(--kami-sans);
  font-weight: 500;
}

/* Homepage H1 tighter */
.md-content article:first-of-type > h1:first-child {
  font-size: 2.4em;
  margin-top: 0.5em;
}

/* ---- Mobile drawer nav (when top tabs collapse to hamburger) ---- */
.md-nav--primary .md-nav__title,
.md-nav--secondary .md-nav__title {
  background: var(--kami-parchment);
  color: var(--kami-near-black);
  font-family: var(--kami-serif);
  font-weight: 500;
  box-shadow: none;
  border-bottom: 1px solid var(--kami-border-cream);
}

.md-nav--primary {
  background: var(--kami-parchment);
}

.md-nav--primary .md-nav__link,
.md-nav--secondary .md-nav__link {
  font-family: var(--kami-serif);
  color: var(--kami-charcoal);
}

/* Mobile: search dialog also matches theme */
[data-md-toggle="search"]:checked ~ .md-header .md-search__inner,
.md-search__inner {
  background: var(--kami-parchment);
}

/* Mobile: ensure the body bg flows under the sticky header */
@media (max-width: 76.1875em) {
  .md-main,
  .md-main__inner,
  .md-content {
    background: var(--kami-parchment);
  }
}
