/* DEVHW blog theme for Ghost.
   Same tokens and rules as devhw.dev (DEVHWDEV/dev.devhw, src/styles/global.css):
   #0D1117 background, #00FF00 accent from the logo's semicolon, Chivo Mono, nothing decorative.
   Dark is the brand default; a light palette is available via <html data-theme="light"> (footer switch). */

/* Chivo Mono: the DEVHW logo typeface (OFL, assets/fonts/ChivoMono-OFL.txt). Latin-only subset, wght 100-900.
   It has no CJK glyphs, so CJK text falls back to Pretendard (assets/css/pretendard.css). */
@font-face {
  font-family: 'Chivo Mono';
  src: url('../fonts/ChivoMono-Latin-wght.woff') format('woff');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014,
    U+2018-201A, U+201C-201E, U+2022, U+2026, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2197;
}

/* JetBrains Mono (OFL, assets/fonts/JetBrainsMono-OFL.txt), wght 100-800: post lists and posts. */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-wght.woff2') format('woff2');
  font-weight: 100 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-Italic-wght.woff2') format('woff2');
  font-weight: 100 800; font-style: italic; font-display: swap;
}
/* Same files without the space characters. Korean, Japanese and Chinese sites use this for post text,
   so word gaps come from Pretendard instead of a full monospace cell. */
@font-face {
  font-family: 'JetBrains Mono Text';
  src: url('../fonts/JetBrainsMono-wght.woff2') format('woff2');
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-001F, U+0021-009F, U+00A1-2FFF, U+3001-10FFFF;
}
@font-face {
  font-family: 'JetBrains Mono Text';
  src: url('../fonts/JetBrainsMono-Italic-wght.woff2') format('woff2');
  font-weight: 100 800; font-style: italic; font-display: swap;
  unicode-range: U+0000-001F, U+0021-009F, U+00A1-2FFF, U+3001-10FFFF;
}

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --line: #21262d;
  --text: #e6edf3;
  --text-2: #a8b1bb;
  --muted: #7d8590;
  --accent: #00ff00;
  --accent-text: #00ff00; /* accent used as text color, focus ring and outlines */
  --accent-line: rgba(0, 255, 0, .35);
  --accent-soft: rgba(0, 255, 0, .22);

  --font: 'Chivo Mono', 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  /* Proportional fonts first for CJK, so monospace spaces don't widen word gaps. */
  --font-text: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'D2Coding',
    'Noto Sans Mono CJK KR', monospace;
  /* Post lists and posts: JetBrains Mono, with Pretendard for Korean. Menus and labels stay in Chivo Mono (--font). */
  --font-post: 'JetBrains Mono', 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, monospace;

  /* Titles and post text. Ghost's own font settings (Design > Typography) take priority when set. */
  --font-heading: var(--gh-font-heading, var(--font-post));
  --font-body: var(--gh-font-body, var(--font-post));
  --body-size: 15px;

  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

/* Light palette. #00FF00 is unreadable as text on white (1.4:1), so text accents use #008000 (5.1:1);
   the logo keeps its original #00FF00 semicolon (assets/images/devhw-logo-light.svg, unmodified). */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --line: #d1d9e0;
  --text: #1f2328;
  --text-2: #59636e;
  --muted: #6e7781;
  --accent-text: #008000;
  --accent-line: rgba(0, 128, 0, .4);
  --accent-soft: rgba(0, 255, 0, .25);
}

/* Korean, Japanese and Chinese sites: JetBrains Mono letters with proportional word gaps. */
html:is(:lang(ko), :lang(ja), :lang(zh)) {
  --font-post: 'JetBrains Mono Text', 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; -webkit-font-smoothing: antialiased; }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 1px solid var(--accent-text); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--accent-soft); }
img { max-width: 100%; height: auto; }
.logo { display: block; width: auto; height: auto; }
[hidden] { display: none !important; }
/* Official logo files, unmodified: white DEVHW on dark, black DEVHW on light. */
:root[data-theme="light"] .logo--dark, :root:not([data-theme="light"]) .logo--light { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Home without the post list: the logo and whitespace only (same as the devhw.dev home). */
body:has(> .home) { position: relative; }
.home { min-height: 100svh; display: grid; place-items: center; padding: 96px 24px; }
.identity { margin: 0; line-height: 0; }
.identity .logo { width: clamp(240px, 52vw, 440px); }
body:has(> .home) > .footer-nav { position: absolute; inset: auto 0 0; }

/* Layout: logo, title, body (same as devhw.dev subpages) */
.shell { width: min(640px, calc(100% - 48px)); margin-inline: auto; }
.content { min-height: calc(100svh - 96px); padding-block: 56px 72px; }
.home-link { display: inline-block; margin-left: -4px; /* offsets the SVG's built-in left padding (140/966) */ }
.home-link .logo { height: 30px; }

.page-title {
  margin-block: 88px 28px; font-family: var(--font-heading);
  font-size: 26px; font-weight: 500; letter-spacing: -.01em; line-height: 1.35; word-break: keep-all; overflow-wrap: break-word;
}
.page-title-spacer { height: 88px; }
/* English UI labels (the blog title, 404) stay in Chivo Mono, like the titles on devhw.dev. */
.page-title--label { font-family: var(--font); }
.page-description { margin-top: -12px; margin-bottom: 28px; font-size: 14px; line-height: 1.9; color: var(--text-2); word-break: keep-all; }
.text-link { display: inline-block; font-size: 13px; color: var(--muted); transition: color .15s; }
.text-link:hover { color: var(--text); }
.sep { margin-inline: 8px; color: var(--muted); opacity: .5; }

/* Post list */
.post-list { border-bottom: 1px solid var(--line); }
.post-item { padding-block: 22px; border-top: 1px solid var(--line); }
.post-item-title {
  font-family: var(--font-heading); font-size: 18px; font-weight: 500; line-height: 1.5;
  word-break: keep-all; overflow-wrap: break-word;
}
.post-item-title a { transition: color .15s; }
.post-item-title a:hover { color: var(--accent-text); }
.post-item-excerpt {
  margin-top: 10px; font-family: var(--font-body); font-size: 14px; line-height: 1.8; color: var(--text-2);
  word-break: keep-all; overflow-wrap: break-word;
}
.post-item-meta, .article-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; margin-top: 14px; font-family: var(--font-body);
  font-size: 11px; letter-spacing: .06em; color: var(--muted);
}
.empty { font-size: 14px; color: var(--muted); }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 36px; }
.pagination-count { font-size: 11px; letter-spacing: .06em; color: var(--muted); }

/* Tag pages: one line per post, title and date */
.post-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.post-row + .post-row { border-top: 1px solid var(--line); }
.post-row-link { display: flex; align-items: baseline; gap: 24px; padding-block: 14px; }
.post-row-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-heading); font-size: 15px; line-height: 1.6; transition: color .15s;
}
.post-row-link:hover .post-row-title { color: var(--accent-text); }
.post-row-date {
  flex: none; font-family: var(--font-body); font-size: 12px; letter-spacing: .04em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Post */
.article-title { margin-bottom: 0; }
.article-meta { margin-top: 16px; font-size: 12px; }
.article-meta a { transition: color .15s; }
.article-meta a:hover { color: var(--text); }
.article-image { margin: 48px 0 0; }
.article-image img { display: block; width: 100%; border-radius: 4px; }
.article-image figcaption, .gh-content figcaption {
  margin-top: 12px; font-family: var(--font-body); font-size: 12px; line-height: 1.6; color: var(--muted); text-align: center;
}
.article .gh-content { margin-top: 48px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 64px; font-family: var(--font-body); font-size: 12px; letter-spacing: .02em; }
.article-tags a { color: var(--muted); transition: color .15s; }
.article-tags a:hover { color: var(--text); }
.article-comments { margin-top: 64px; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav:not(:has(a)) { display: none; }
.post-nav-link { display: flex; flex-direction: column; gap: 8px; }
.post-nav-older { grid-column: 2; text-align: right; }
.post-nav-label { font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.post-nav-title {
  font-family: var(--font-heading); font-size: 14px; line-height: 1.6; color: var(--text-2);
  word-break: keep-all; overflow-wrap: break-word; transition: color .15s;
}
.post-nav-link:hover .post-nav-title { color: var(--accent-text); }

/* Post content (Ghost editor output) */
.gh-content {
  font-family: var(--font-body); font-size: var(--body-size); line-height: 1.85; color: var(--text-2);
  word-break: keep-all; overflow-wrap: break-word;
}
.gh-content > * + * { margin-top: 1.4em; }
.gh-content > :first-child { margin-top: 0; }
.gh-content figure { margin-inline: 0; }
.gh-content p, .gh-content ul, .gh-content ol, .gh-content dl, .gh-content blockquote, .gh-content figure, .gh-content pre, .gh-content table { margin-bottom: 0; }
.gh-content :is(h1, h2, h3, h4, h5, h6) {
  margin-bottom: 0; font-family: var(--font-heading); color: var(--text); line-height: 1.45; letter-spacing: -.005em;
}
.gh-content h1 { margin-top: 2.4em; font-size: 22px; font-weight: 600; }
.gh-content h2 { margin-top: 2.4em; font-size: 19px; font-weight: 600; }
.gh-content h3 { margin-top: 2em; font-size: 16px; font-weight: 600; }
.gh-content :is(h4, h5, h6) { margin-top: 1.8em; font-size: 15px; font-weight: 600; }
.gh-content :is(h1, h2, h3, h4, h5, h6) + * { margin-top: .8em; }
.gh-content strong, .gh-content b { color: var(--text); font-weight: 600; }
.gh-content a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 5px; transition: text-decoration-color .15s; }
.gh-content a:hover { text-decoration-color: var(--muted); }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: .4em; }
.gh-content li > ul, .gh-content li > ol { margin-top: .4em; }
.gh-content li::marker { color: var(--muted); }
.gh-content ol li::marker { font-family: var(--font-code); font-size: .85em; }
.gh-content hr, .gh-content .kg-divider-card hr { height: 0; margin-block: 3em; border: 0; border-top: 1px solid var(--line); }
.gh-content blockquote:not([class]) { margin-inline: 0; padding-left: 20px; border-left: 2px solid var(--line); color: var(--text-2); }
.gh-content blockquote.kg-blockquote-alt {
  margin-inline: 0; padding: .4em 0; border: 0; font-size: 1.15em; line-height: 1.7; text-align: center; color: var(--text);
}
.gh-content img { display: block; margin-inline: auto; border-radius: 4px; }
.gh-content mark { padding: 0 .15em; color: var(--text); background: var(--accent-soft); border-radius: 2px; }
.gh-content sup, .gh-content sub { line-height: 0; }
.gh-content .footnotes { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--line); font-size: .85em; }
.gh-content .footnotes ol { margin: 0; }

/* Code */
.gh-content code, .gh-content kbd, .gh-content samp { font-family: var(--font-code); font-size: .86em; }
.gh-content :not(pre) > code {
  padding: .15em .4em; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  word-break: break-word;
}
.gh-content kbd { padding: .1em .4em; color: var(--text); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; }
.gh-content pre {
  overflow-x: auto; padding: 18px 20px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.7;
  word-break: normal; overflow-wrap: normal; tab-size: 4; -webkit-overflow-scrolling: touch;
}
.gh-content pre code { padding: 0; font-size: inherit; background: none; border: 0; white-space: pre; }
.gh-content .kg-code-card { position: relative; }
.gh-content .kg-code-card pre { margin: 0; }

/* Tables (Markdown and HTML cards) */
.gh-content table {
  display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse;
  font-size: 13px; line-height: 1.6; -webkit-overflow-scrolling: touch;
}
.gh-content th, .gh-content td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.gh-content th { color: var(--text); font-weight: 600; white-space: nowrap; }
.gh-content th:first-child, .gh-content td:first-child { padding-left: 0; }

/* Ghost editor cards: widths */
.gh-content .kg-card { margin-inline: 0; }
.gh-content .kg-width-wide {
  position: relative; width: min(960px, calc(100vw - 48px)); max-width: none;
  margin-inline: calc((100% - min(960px, calc(100vw - 48px))) / 2);
}
.gh-content .kg-width-full {
  position: relative; width: 100vw; max-width: none; margin-inline: calc(50% - 50vw);
}
.gh-content .kg-width-full img { border-radius: 0; }
.gh-content .kg-width-full figcaption { padding-inline: 24px; }
.gh-content .kg-image { margin-inline: auto; }
.gh-content .kg-gallery-image img { border-radius: 0; }
.gh-content .kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.gh-content .kg-embed-card > :is(iframe, video) { max-width: 100%; }

/* Ghost editor cards: colors (card_assets supplies the layout; these keep them on the theme palette) */
.gh-content .kg-bookmark-card a.kg-bookmark-container,
.gh-content .kg-bookmark-container {
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; box-shadow: none; transition: border-color .15s;
}
.gh-content .kg-bookmark-container:hover { border-color: var(--muted); }
.gh-content .kg-bookmark-content { font-family: var(--font-body); }
.gh-content .kg-bookmark-title { color: var(--text); font-weight: 600; }
.gh-content .kg-bookmark-description { color: var(--text-2); }
.gh-content .kg-bookmark-metadata { color: var(--muted); }
.gh-content .kg-bookmark-author, .gh-content .kg-bookmark-publisher { color: var(--muted); }
.gh-content .kg-bookmark-icon { border-radius: 2px; }
.gh-content .kg-bookmark-thumbnail img { border-radius: 0 5px 5px 0; }

.gh-content .kg-callout-card { border-radius: 6px; }
.gh-content .kg-callout-card-grey, .gh-content .kg-callout-card-white, .gh-content .kg-callout-card-accent {
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
}
.gh-content .kg-callout-card-accent { border-color: var(--accent-line); }
.gh-content .kg-callout-text { color: var(--text-2); }

.gh-content .kg-toggle-card { background: transparent; border: 1px solid var(--line); border-radius: 6px; box-shadow: none; }
.gh-content .kg-toggle-heading-text { color: var(--text); font-family: var(--font-heading); }
.gh-content .kg-toggle-card svg { color: var(--muted); }

.gh-content .kg-file-card-container { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.gh-content .kg-file-card-container:hover { border-color: var(--muted); }
.gh-content .kg-file-card a.kg-file-card-container { text-decoration: none; }
.gh-content .kg-file-card-caption, .gh-content .kg-file-card-metadata { color: var(--muted); }

.gh-content .kg-product-card-container { color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.gh-content .kg-header-card { border-radius: 6px; }

/* Buttons: outlined in the accent, never filled (white text on #00FF00 is unreadable). */
.gh-content a.kg-btn, .gh-content .kg-btn, .gh-content .kg-product-card-button, .gh-content .kg-header-card-button {
  color: var(--accent-text); background: transparent; border: 1px solid var(--accent-text); border-radius: 4px;
  font-family: var(--font); font-size: 13px; font-weight: 500; letter-spacing: .04em;
  text-decoration: none; transition: background-color .15s;
}
.gh-content a.kg-btn:hover, .gh-content .kg-btn:hover,
.gh-content .kg-product-card-button:hover, .gh-content .kg-header-card-button:hover { background: var(--accent-soft); opacity: 1; }

/* Members-only posts: Ghost's call-to-action box */
.gh-post-upgrade-cta-content, .gh-post-upgrade-cta {
  color: var(--text); background: var(--surface) !important; border: 1px solid var(--line); border-radius: 6px;
}
.gh-post-upgrade-cta h2 { color: var(--text); font-family: var(--font-heading); }
.gh-post-upgrade-cta a.gh-btn { color: #0d1117; background: var(--accent); border-radius: 4px; }
.gh-post-upgrade-cta p a { color: var(--accent-text); }

/* Footer menu (same as devhw.dev) */
.footer-nav { padding: 24px 24px max(28px, env(safe-area-inset-bottom)); }
.footer-nav nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; }
.footer-nav a, .footer-nav-button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font: inherit; font-size: 12px; letter-spacing: .06em; color: var(--muted); transition: color .15s;
}
.footer-nav-button { margin: 0; background: none; border: 0; cursor: pointer; }
.footer-nav a:hover, .footer-nav-button:hover, .footer-nav a[aria-current="page"] { color: var(--text); }

/* Icon buttons: search icon and the light/dark square, both 14px */
.footer-nav-icon {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; padding: 0 10px;
  color: var(--muted); background: none; border: 0; cursor: pointer; transition: color .15s, opacity .15s;
}
.footer-nav-icon svg { display: block; width: 14px; height: 14px; }
.footer-nav-icon:hover { color: var(--text); }
/* Light/dark switch: a white square while dark, a black square while light. */
.theme-square { display: block; width: 14px; height: 14px; background: #ffffff; }
:root[data-theme="light"] .theme-square { background: #000000; }
.theme-toggle:hover { opacity: .7; }

/* Tags dropdown in the footer menu: opens upward, centered over the menu */
.footer-nav nav { position: relative; }
.tags-menu summary {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-size: 12px; letter-spacing: .06em; color: var(--muted); cursor: pointer; list-style: none; transition: color .15s;
}
.tags-menu summary::-webkit-details-marker { display: none; }
.tags-menu summary::marker { content: ''; }
.tags-menu summary:hover, .tags-menu[open] summary, .tags-menu.is-current summary { color: var(--text); }
.tags-menu summary:focus-visible { outline: 1px solid var(--accent-text); outline-offset: -8px; border-radius: 2px; }
.tags-menu-list {
  position: absolute; bottom: calc(100% + 4px); left: 50%; z-index: 10; transform: translateX(-50%);
  width: max-content; min-width: 160px; max-width: calc(100vw - 48px); max-height: min(60vh, 420px); overflow-y: auto;
  margin: 0; padding: 4px 0; list-style: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.footer-nav .tags-menu-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 28px; padding: 0 12px;
  font-size: 13px; letter-spacing: .02em; color: var(--text-2);
}
.footer-nav .tags-menu-list a:hover, .footer-nav .tags-menu-list a[aria-current="page"] { color: var(--text); }
.tags-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags-menu-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Small screens */
@media (max-width: 600px) {
  .page-title { margin-top: 72px; }
  .page-title-spacer { height: 72px; }
  .post-row-link { gap: 16px; }
  .post-row-title { font-size: 14px; }
  .post-row-date { font-size: 11px; }
  .post-nav { grid-template-columns: 1fr; gap: 20px; }
  .post-nav-older { grid-column: 1; text-align: left; }
  .gh-content pre { margin-inline: -24px; padding-inline: 24px; border-inline: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
