/* TechBytes additions on top of the landing page's styles.css (same tokens, same daily theme). */

.brand-sub { font-weight: 450; font-stretch: 100%; color: var(--muted); }
.crumbs { display: flex; gap: .5rem; margin: 0 0 1rem; font-size: .92rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-underline-offset: 3px; }
.crumbs a + a::before { content: "/"; margin-right: .5rem; color: var(--line); }

/* Home ----------------------------------------------------------------- */
.tb-hero { padding: clamp(2.5rem, 8vh, 5rem) 0 clamp(1.5rem, 4vh, 2.5rem); }
.tb-hero .root .sub { display: block; }
.tb-hero .root .apex {
  display: block; margin-top: .12em;
  font-size: .3em; font-weight: 450; font-stretch: 95%; letter-spacing: -0.01em; color: var(--muted);
}
.tb-hero .lede { max-width: 58ch; }
.tb-hero-small h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.05;
  font-weight: 800; font-stretch: 115%; letter-spacing: -0.03em;
}

.entries { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--ink); }
.entry {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.5rem;
  padding: 1.6rem 0; border-bottom: 1px solid var(--line);
}
.entry time { padding-top: .45rem; font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.entry h3 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.15; font-weight: 760; font-stretch: 110%; letter-spacing: -0.015em; }
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.entry p { margin: .5rem 0 0; max-width: 64ch; color: var(--muted); }
.entry .entry-meta { font-size: .88rem; }
.empty { padding: 2rem 0; color: var(--muted); }
.draft {
  margin-left: .6rem; padding: .1rem .5rem; vertical-align: middle; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 650; font-stretch: 100%;
}

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 0; padding: 0; }
.tag {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--mono); font-size: .8rem; text-decoration: none;
}
a.tag:hover { background: var(--primary); color: var(--on-primary); }
.tag-big { font-size: .6em; vertical-align: middle; }
.topics { padding: 2.5rem 0 3.5rem; }
.topics h2 { font-size: 1.1rem; font-weight: 700; }
.topic-index { list-style: none; margin: 0; padding: 0 0 3rem; display: grid; gap: .7rem; }
.topic-index .count { margin-left: .5rem; color: var(--muted); font-size: .9rem; }

/* Post ----------------------------------------------------------------- */
.post { padding: clamp(2rem, 6vh, 3.5rem) 0 clamp(3rem, 8vh, 5rem); }
.post-head { max-width: 50rem; }
.post-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.02;
  font-weight: 800; font-stretch: 112%; letter-spacing: -0.03em; text-wrap: balance;
}
.post-head .lede { max-width: 60ch; }
.post-meta { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 1.25rem 0 0; font-size: .92rem; color: var(--muted); }
.post-meta span:first-child { color: var(--ink); font-weight: 650; }
.draft-note { margin: 1rem 0 0; padding: .5rem .8rem; border-radius: 10px; background: color-mix(in srgb, var(--accent) 25%, transparent); }

.post-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: clamp(2rem, 5vw, 4.5rem);
  margin-top: clamp(2rem, 5vh, 3rem); padding-top: clamp(1.5rem, 4vh, 2.5rem);
  border-top: 3px solid var(--ink);
}
.post-layout:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }
.toc { order: 2; position: sticky; top: 5.5rem; align-self: start; font-size: .9rem; }
.toc-title { margin: 0 0 .6rem; font-weight: 700; }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--line); display: grid; gap: .45rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }

.prose { max-width: 70ch; font-size: 1.08rem; line-height: 1.7; }
.prose > * + * { margin-top: 1.2em; }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  margin-top: 2.2em; font-size: clamp(1.45rem, 2.6vw, 1.9rem); line-height: 1.15;
  font-weight: 780; font-stretch: 110%; letter-spacing: -0.02em;
}
.prose h3 { margin-top: 1.8em; font-size: 1.2rem; font-weight: 720; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose a { color: var(--primary); text-underline-offset: 3px; }
.prose .anchor { margin-left: .4rem; color: var(--line); text-decoration: none; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose blockquote {
  margin-left: 0; margin-right: 0; padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.prose img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-md); border: 1px solid var(--line); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose :not(pre) > code {
  padding: .1em .35em; border-radius: 6px;
  background: var(--surface-2); font-family: var(--mono); font-size: .88em;
}
.table-wrap { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { border-bottom: 2px solid var(--ink); font-weight: 700; }

/* Code: dark block in the day's hue; token colours derived from the same hues */
.hl { position: relative; border-radius: var(--radius-md); background: var(--code); color: var(--code-ink); }
.hl pre {
  margin: 0; padding: 1.1rem 1.25rem; overflow-x: auto;
  font-family: var(--mono); font-size: .88rem; line-height: 1.6; tab-size: 2;
}
.copy {
  position: absolute; top: .55rem; right: .55rem;
  padding: .2rem .6rem; border: 1px solid color-mix(in srgb, var(--code-ink) 30%, transparent); border-radius: 999px;
  background: transparent; color: var(--code-ink); font: inherit; font-size: .75rem; cursor: pointer; opacity: .7;
}
.copy:hover, .copy:focus-visible { opacity: 1; }
.hl .c, .hl .c1, .hl .cm, .hl .ch, .hl .cs { color: color-mix(in srgb, var(--code-ink) 55%, transparent); font-style: italic; }
.hl .k, .hl .kd, .hl .kn, .hl .kr, .hl .kt, .hl .ow, .hl .nt { color: var(--accent); }
.hl .s, .hl .s1, .hl .s2, .hl .sb, .hl .sd, .hl .se, .hl .si, .hl .sh, .hl .sx { color: #9fd8a5; }
.hl .m, .hl .mi, .hl .mf, .hl .mh, .hl .kc { color: #f2b8a0; }
.hl .nf, .hl .fm, .hl .nb, .hl .bp, .hl .na { color: #a7c8ff; }
.hl .err { color: inherit; background: none; }
@supports (color: oklch(50% 0.1 200)) {
  .hl .s, .hl .s1, .hl .s2, .hl .sb, .hl .sd, .hl .se, .hl .si, .hl .sh, .hl .sx { color: oklch(84% 0.11 calc(var(--h) + 120)); }
  .hl .m, .hl .mi, .hl .mf, .hl .mh, .hl .kc { color: oklch(82% 0.1 calc(var(--a) + 40)); }
  .hl .nf, .hl .fm, .hl .nb, .hl .bp, .hl .na { color: oklch(83% 0.09 calc(var(--h) - 60)); }
}

.post-foot { max-width: 70ch; margin-top: 3rem; }
.discuss { margin: 0 0 2rem; }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.pn {
  display: grid; gap: .2rem; padding: 1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  text-decoration: none; font-weight: 650;
}
.pn span { font-size: .82rem; font-weight: 500; color: var(--muted); }
.pn:hover { border-color: var(--primary); }
.pn-newer { grid-column: 2; text-align: right; }

@media (max-width: 60rem) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { order: 0; position: static; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
}
@media (max-width: 44rem) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .entry time { padding-top: 0; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pn-newer { grid-column: auto; text-align: left; }
}
