/* ==========================================================================
   An Android Dev Blog — reading-focused theme
   ========================================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --text-soft: #3d434b;
  --muted: #69707a;
  --border: #e7e3db;
  --accent: #0d7a5f;
  --accent-hover: #095a46;
  --accent-soft: #e2f1ea;
  --code-bg: #f5f3ee;
  --code-inline-bg: #efece5;
  --code-text: #24292f;
  --notice-bg: #fdf6e3;
  --notice-border: #eadbb0;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 4px 16px rgba(20, 20, 20, .04);

  /* syntax */
  --sx-comment: #6e7781;
  --sx-keyword: #cf222e;
  --sx-type: #8250df;
  --sx-string: #0a3069;
  --sx-number: #0550ae;
  --sx-func: #8250df;
  --sx-attr: #116329;
  --sx-tag: #116329;
  --sx-name: #24292f;
  --sx-op: #57606a;
  --sx-anno: #953800;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, Cambria, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 44rem;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131517;
    --surface: #1a1d20;
    --text: #e7e5e0;
    --text-soft: #cfccc5;
    --muted: #9198a1;
    --border: #2b2f34;
    --accent: #5cc9a2;
    --accent-hover: #86dcbc;
    --accent-soft: #1d3029;
    --code-bg: #1c1f23;
    --code-inline-bg: #262a2f;
    --code-text: #d6d8db;
    --notice-bg: #2a2619;
    --notice-border: #4a4228;
    --shadow: none;

    --sx-comment: #7f8893;
    --sx-keyword: #ff7b72;
    --sx-type: #d2a8ff;
    --sx-string: #a5d6ff;
    --sx-number: #79c0ff;
    --sx-func: #d2a8ff;
    --sx-attr: #7ee787;
    --sx-tag: #7ee787;
    --sx-name: #d6d8db;
    --sx-op: #a2abb5;
    --sx-anno: #ffa657;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color .15s, text-decoration-color .15s;
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

img { max-width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  background: var(--surface);
  padding: .5rem 1rem;
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus { left: .5rem; }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--code-bg);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.brand-tag { font-size: .8rem; color: var(--muted); }

.site-nav { display: flex; gap: .25rem; }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  padding: .4rem .7rem;
  border-radius: 6px;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-hover); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- main ---------- */

main.wrap { padding-top: 3.5rem; padding-bottom: 4.5rem; min-height: 60vh; }

.page-head { margin-bottom: 2.5rem; }
.page-head h1 {
  font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0;
}
.page-head .lede { color: var(--muted); margin: .5rem 0 0; font-size: 1.05rem; }

.eyebrow {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .6rem;
}

.notice {
  font-size: .9rem;
  color: var(--text-soft);
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 2.5rem;
}

/* ---------- post header ---------- */

.post-header { margin-bottom: 2.25rem; }
.post-header h1 {
  font-size: clamp(1.9rem, 1.35rem + 2.2vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -.025em;
  margin: 0 0 .9rem;
  font-weight: 700;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .6rem;
  color: var(--muted);
  font-size: .9rem;
}
.meta .sep { opacity: .5; }
.meta a { color: inherit; }

/* ---------- prose ---------- */

.prose {
  font-family: var(--font-serif);
  font-size: 1.1875rem;
  line-height: 1.75;
  color: var(--text);
  overflow-wrap: break-word;
}
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.15em; }

.prose h2, .prose h3, .prose h4, .prose h5 {
  font-family: var(--font-sans);
  line-height: 1.3;
  letter-spacing: -.015em;
  color: var(--text);
}
.prose h2 { font-size: 1.55rem; margin: 2.4em 0 .6em; }
.prose h3 { font-size: 1.25rem; margin: 2em 0 .5em; }
.prose h4, .prose h5 { font-size: 1.05rem; margin: 1.8em 0 .4em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0; }

.prose ul, .prose ol { margin: 1.1em 0 0; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }

.prose strong { font-weight: 650; }

.prose blockquote {
  margin: 1.6em 0;
  padding: .2em 0 .2em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }

.prose img {
  display: block;
  margin: 1.8em auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.prose p > img:only-child { margin: .4em auto; }
.prose img.right { margin: 1.8em auto; }
@media (min-width: 760px) {
  .prose img.right { float: right; max-width: 45%; margin: .3em 0 1em 1.5em; }
}
.prose img.wp-smiley { display: inline; border: 0; margin: 0; vertical-align: middle; }

.prose table:not(.code-table) {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: .95rem;
  margin: 1.6em 0;
}
.prose table:not(.code-table) th,
.prose table:not(.code-table) td {
  border-bottom: 1px solid var(--border);
  padding: .5em .7em;
  text-align: left;
}

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.8em 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- code ---------- */

code, pre, kbd, samp { font-family: var(--font-mono); }

.prose :not(pre) > code {
  font-size: .82em;
  background: var(--code-inline-bg);
  color: var(--code-text);
  padding: .12em .38em;
  border-radius: 5px;
  white-space: nowrap;
}
.prose a code { color: inherit; }

.code-block {
  position: relative;
  margin: 1.8em 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
}
.code-block figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: .78rem;
  color: var(--muted);
  padding: .45rem 1rem;
  border-bottom: 1px solid var(--border);
}
.code-block figcaption .lang { text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.code-block figcaption.lang-only {
  position: absolute;
  top: .35rem;
  right: .5rem;
  padding: .1rem .3rem;
  border: 0;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: .7rem;
  opacity: .8;
  pointer-events: none;
}
.code-block:has(.lang-only) pre { padding-right: 3.5rem; }
.code-block figcaption a { color: inherit; }
.code-block pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--code-text);
  tab-size: 4;
}
.code-block pre code { font-size: inherit; background: none; padding: 0; white-space: pre; }

/* Pygments token colours (Octopress) */
.code-block .c, .code-block .c1, .code-block .cm, .code-block .cs, .code-block .cp { color: var(--sx-comment); font-style: italic; }
.code-block .k, .code-block .kd, .code-block .kn, .code-block .kp, .code-block .kr, .code-block .kc, .code-block .ow { color: var(--sx-keyword); }
.code-block .kt, .code-block .nc { color: var(--sx-type); }
.code-block .s, .code-block .s1, .code-block .s2, .code-block .sb, .code-block .sc, .code-block .se, .code-block .sh, .code-block .si, .code-block .sx { color: var(--sx-string); }
.code-block .m, .code-block .mi, .code-block .mf, .code-block .mh, .code-block .il { color: var(--sx-number); }
.code-block .nf, .code-block .fm { color: var(--sx-func); }
.code-block .na { color: var(--sx-attr); }
.code-block .nt { color: var(--sx-tag); }
.code-block .nd { color: var(--sx-anno); }
.code-block .n, .code-block .nv, .code-block .nx { color: var(--sx-name); }
.code-block .o, .code-block .p { color: var(--sx-op); }
.code-block .err { color: inherit; background: none; }

/* ---------- post list (home, categories) ---------- */

.post-list { list-style: none; margin: 0; padding: 0; }
.post-card { padding: 2.25rem 0; border-top: 1px solid var(--border); }
.post-card:first-child { border-top: 0; padding-top: 0; }
.post-card h2 {
  font-size: clamp(1.4rem, 1.2rem + .8vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: .35rem 0 .75rem;
}
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.post-card .excerpt {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text-soft);
}
.post-card .excerpt > * + * { margin-top: .9em; }
.post-card .excerpt.full-post > * + * { margin-top: 1.15em; }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: 1rem;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
}
.read-more:hover { text-decoration: underline; }

.full-post { margin-top: 1rem; }

/* ---------- archives ---------- */

.year-group { margin-bottom: 2.5rem; }
.year-group h2 {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 .5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: .7rem 0;
  border-bottom: 1px dashed var(--border);
}
.archive-list li:last-child { border-bottom: 0; }
.archive-list time { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.archive-list a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 1.05rem; }
.archive-list a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 520px) {
  .archive-list li { grid-template-columns: 1fr; gap: .1rem; }
}

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 3rem; padding: 0; list-style: none; }
.tags a {
  display: inline-block;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
}
.tags a:hover { background: var(--accent); color: var(--bg); }
.tags a[aria-current="page"] { background: var(--accent); color: var(--bg); }

/* ---------- post footer / pagination ---------- */

.post-footer { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.post-footer .meta { margin-bottom: 1.5rem; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
}
.pager a {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.pager a:hover { border-color: var(--accent); transform: translateY(-1px); }
.pager .label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.pager .title { font-weight: 600; line-height: 1.35; }
.pager .next { grid-column: 2; text-align: right; }
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

/* ---------- comments (2012 posts) ---------- */

.comments { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comments h2 { font-size: 1.25rem; margin: 0 0 1.25rem; }
.comment-list, .comment-list ul { list-style: none; margin: 0; padding: 0; }
.comment-list ul { margin-left: 1.25rem; padding-left: 1.25rem; border-left: 2px solid var(--border); }
.comment {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.comment-head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; margin-bottom: .4rem; }
.comment-author { font-weight: 600; }
.comment-author a { color: inherit; }
.comment-date { color: var(--muted); font-size: .85rem; }
.comment-body { font-family: var(--font-serif); font-size: 1.02rem; line-height: 1.65; color: var(--text-soft); }
.comment-body > * { margin: 0; }
.comment-body > * + * { margin-top: .7em; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 2.25rem;
}
.site-footer nav { display: flex; gap: 1.1rem; }
.site-footer a { color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  .wrap { padding: 0 1rem; }
  main.wrap { padding-top: 2rem; }
  .prose { font-size: 1.1rem; line-height: 1.7; }
  .brand-tag { display: none; }
  .site-nav a { padding: .35rem .55rem; }
  .code-block { margin-left: -1rem; margin-right: -1rem; border-radius: 0; border-left: 0; border-right: 0; }
  .code-block pre { font-size: .8rem; }
}

@media print {
  .site-header, .site-footer, .pager, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .prose { font-size: 11pt; }
  a { color: inherit; }
}
