/* hisamiowo.xyz: one stylesheet, Catppuccin Mocha (dark) and Latte (light). */

@font-face {
  font-family: "Google Sans Flex";
  src: url("fonts/GoogleSansFlex.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Google Sans Code";
  src: url("fonts/GoogleSansCode.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  /* Mocha */
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --overlay0: #6c7086;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --text: #cdd6f4;
  --accent: #b4befe;   /* lavender */
  --mauve: #cba6f7;
  --peach: #fab387;
  --green: #a6e3a1;
  --sky: #89dceb;
  --yellow: #f9e2af;
  color-scheme: dark;

  --sans: "Google Sans Flex", "Google Sans", system-ui, sans-serif;
  --mono: "Google Sans Code", ui-monospace, monospace;
  --measure: 36rem;
  --wide-extra: 16rem;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Latte */
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --crust: #dce0e8;
    --surface0: #ccd0da;
    --surface1: #bcc0cc;
    --overlay0: #8c8fa1;
    --subtext0: #6c6f85;
    --subtext1: #5c5f77;
    --text: #4c4f69;
    --accent: #7287fd;
    --mauve: #8839ef;
    --peach: #fe640b;
    --green: #40a02b;
    --sky: #04a5e5;
    --yellow: #df8e1d;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: clamp(1.0625rem, 0.95rem + 0.35vw, 1.25rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

::selection { background: var(--surface1); }

/* ---- shell: header and footer (base.html) ---- */

.wrap {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 2.25rem 1rem;
}

.site-name {
  font-weight: 650;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.site-name span { color: var(--mauve); }

.site-nav { display: flex; gap: 1.25rem; font-size: 0.9rem; }
.site-nav a { color: var(--subtext0); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); }

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--surface0);
  color: var(--overlay0);
  font-size: 0.8rem;
}
.site-footer .wrap { padding-block: 1.5rem 2.5rem; }

/* ---- draft marker ---- */

.placeholder {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--peach);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.05em 0.6em;
  vertical-align: 0.15em;
}

/* ---- index.html ---- */

.intro { padding-block: 2.5rem 1.5rem; }
.intro h1 {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.intro p { color: var(--subtext1); margin: 0; max-width: 32em; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--overlay0);
  margin: 2.5rem 0 0.5rem;
}

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 0 1.25rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--surface0);
}
.post-list time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--overlay0);
  padding-top: 0.3em;
  font-variant-numeric: tabular-nums;
}
.post-list h2 { font-size: 1.1rem; font-weight: 600; line-height: 1.35; margin: 0 0 0.25rem; }
.post-list h2 a { color: var(--text); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); }
.post-list h2 .placeholder { font-weight: 400; }
.post-list p { margin: 0; color: var(--subtext0); font-size: 0.95rem; line-height: 1.5; }

@media (max-width: 34rem) {
  .post-list li { grid-template-columns: 1fr; }
  .post-list time { padding-top: 0; }
}

/* ---- page.html: post header ---- */

.post-kicker { padding-block: 2.5rem 0.4rem; }
.post-header { padding-block: 0 0.5rem; }
.post-header h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}
.post-meta { color: var(--overlay0); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.post-meta .tags a { color: var(--subtext0); text-decoration: none; }
.post-meta .tags a::before { content: "#"; color: var(--overlay0); }

/* ---- prose: the markdown body ({{ page.content }}) ----
   Everything sits in a ~70ch column; a table or code block wider than it
   scrolls inside its own box. Opt-in: <div class="wide"> (a Zola shortcode)
   breaks out of the column equally on both sides. */

.prose {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, var(--wide-extra))
    [text-start] min(var(--measure), 100% - 2 * var(--gutter))
    [text-end] minmax(0, var(--wide-extra))
    [wide-end] minmax(var(--gutter), 1fr)
    [full-end];
}
.prose > * { grid-column: text; min-width: 0; }
.prose > .wide { grid-column: wide; }
.prose > .wide > table { margin-inline: auto; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose li + li { margin-top: 0.3em; }
.prose strong { font-weight: 650; }

.prose h2, .prose h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
  text-wrap: balance;
}
.prose h2 { font-size: 1.45rem; margin: 1.6rem 0 0.5rem; }
.prose h3 { font-size: 1.15rem; margin: 1.3rem 0 0.4rem; }

.prose hr { border: 0; border-top: 1px solid var(--surface0); margin: 1.5rem 0; }

/* inline code */
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 0.3em;
  padding: 0.05em 0.3em;
  overflow-wrap: anywhere;
}

/* code blocks */
.prose pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 0.6rem;
  padding: 0.9rem 1.1rem;
  margin: 0.15rem 0 1.15rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface1) transparent;
  tab-size: 4;
  position: relative;
}
.prose pre code { font-family: inherit; }
.prose pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.45rem;
  right: 0.75rem;
  font-size: 0.68rem;
  color: var(--overlay0);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* zola's giallo highlighter writes inline light-dark() colors (catppuccin-latte / -mocha);
   the block background stays ours */
.prose pre.giallo { background: var(--mantle) !important; }

/* tables */
.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface1) transparent;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  margin: 0 0 1.15rem;
}
.prose th, .prose td {
  padding: 0.5em 0.9em;
  border-bottom: 1px solid var(--surface0);
  vertical-align: top;
}
.prose th:first-child, .prose td:first-child { padding-left: 0; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }
.prose th {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--subtext0);
  text-align: left;
  border-bottom: 1px solid var(--surface1);
}
.prose th[style*="right"] { white-space: nowrap; }
.prose td[style*="right"] { white-space: nowrap; }
.prose td code { white-space: nowrap; overflow-wrap: normal; }
.prose .wide td { white-space: nowrap; }
.prose .wide td:last-child { white-space: normal; min-width: 14em; }
.prose tbody tr:hover { background: var(--mantle); }

/* notes: markdown blockquotes */
.prose blockquote {
  margin: 0.15rem 0 1.15rem;
  padding: 0.8em 1.1em;
  background: var(--mantle);
  border-left: 3px solid var(--accent);
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--subtext1);
  font-size: 0.95rem;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* ---- post footer nav ---- */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  font-size: 0.9rem;
}
.post-nav a { text-decoration: none; }

/* ---- variant: table of contents in the left margin (wide screens only) ----
   Markup: <nav class="toc"> from Zola's page.toc, first child of .post-body,
   so the rail starts level with the h1 and runs to the end of the post. */

.post-body { position: relative; }
.toc { display: none; }

@media (min-width: 1400px) {
  .toc-rail {
    position: absolute;
    top: 0;
    bottom: 0;
    right: calc(50% + var(--measure) / 2 + 3rem);
    width: 14rem;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
  }
  .toc {
    display: block;
    position: sticky;
    top: 2.5rem;
    padding: 0.35rem 1rem 0.35rem 0;
    border-right: 1px solid var(--surface0);
    font-size: 0.8rem;
    line-height: 1.45;
  }
  .toc p {
    margin: 0 0 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--overlay0);
  }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc li + li { margin-top: 0.45rem; }
  .toc a { color: var(--subtext0); text-decoration: none; }
  .toc a:hover { color: var(--text); }
  .toc a[aria-current] { color: var(--accent); }
  /* the sticky toc shares the left margin with .wide breakouts: with a toc,
     wide tables stay in the column and scroll there instead */
  .has-toc .prose { --wide-extra: 0rem; }
}

/* ---- figures, table captions, math, footnotes (shortcodes and markdown output) ---- */

.prose img { max-width: 100%; height: auto; }
.prose figure { margin: 0.4rem 0 1.4rem; }
.prose > figure.wide { grid-column: wide; }
.prose figure img { display: block; margin-inline: auto; border-radius: 0.4rem; }
.prose figcaption, .prose .table-caption {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--subtext0);
  margin: 0.6rem 0 0;
}
.prose figcaption { text-align: center; }
.prose .table-caption { margin: 0 0 0.5rem; }
.prose .table > table { margin-bottom: 1.15rem; }

.prose .math-display, .prose .katex-display { margin: 0.2rem 0 1.15rem; overflow-x: auto; overflow-y: hidden; }

.prose .footnote-reference { font-size: 0.72em; line-height: 0; }
.prose .footnote-reference a { text-decoration: none; }
.prose .footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface0);
  font-size: 0.85rem;
  color: var(--subtext0);
}
.prose .footnotes ol { margin: 0; padding-left: 1.2rem; }
.prose .footnotes li p { margin: 0; }
.prose .footnotes li::marker { color: var(--overlay0); }

/* github-style alerts (> [!NOTE]) look like the other notes */
.prose blockquote[class^="markdown-alert"] { border-left-color: var(--accent); }
.prose blockquote.markdown-alert-warning, .prose blockquote.markdown-alert-caution { border-left-color: var(--peach); }

.owo { color: var(--mauve); }
