/* Masa's Notes */
:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --ink: #0f1217;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --line: #e8eaee;
  --brand: #ff5a1f;
  --link: #1d4ed8;
  --radius: 14px;
  --font: "Inter", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --surface: #161a20;
    --ink: #eef0f4;
    --ink-2: #c5cad3;
    --muted: #8d95a3;
    --line: #252a32;
    --link: #8ab4ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 1;
  overflow-wrap: anywhere;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }
.narrow { max-width: 760px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; z-index: 100; background: var(--bg); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-bar { display: flex; align-items: center; gap: 8px 32px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); transform: rotate(45deg); }
.cat-nav { flex: 1; min-width: 0; }
.cat-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.cat-nav ul::-webkit-scrollbar { display: none; }
.cat-nav a {
  display: block; padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.cat-nav a:hover { background: var(--surface); color: var(--ink); }
.cat-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
@media (max-width: 860px) {
  .header-bar { padding-top: 10px; gap: 4px; }
  .cat-nav { flex-basis: 100%; margin: 0 -16px; }
  .cat-nav ul { padding: 2px 16px 10px; }
}

/* ---------- common ---------- */
.cat-label {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--cat); text-decoration: none;
}
.cat-label::before, .cat-dot { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); flex: none; }
.cat-dot { display: inline-block; }
@media (prefers-color-scheme: dark) { .cat-label { color: color-mix(in srgb, var(--cat) 60%, white); } }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 14px; text-decoration: none; transition: transform .15s, opacity .15s;
}
.btn:hover { opacity: .88; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 20px 0 0; font-size: 12px; color: var(--muted); }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 6px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb [aria-current] { display: inline-block; max-width: 24em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; gap: 28px; } }
.card { position: relative; display: flex; flex-direction: column; gap: 14px; }
.card-media { overflow: hidden; border-radius: var(--radius); background: var(--surface); aspect-ratio: 1200 / 630; }
.card-media img, .hero-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-media img, .hero:hover .hero-media img { transform: scale(1.035); }
.card-body { display: flex; flex-direction: column; gap: 8px; }
.card-meta { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-title { margin: 0; font-size: 17px; line-height: 1.55; font-weight: 700; letter-spacing: -.005em; }
.card-title a { text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.card:hover .card-title a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.card-excerpt { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- home ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 28px 0 24px; }
.hero-media { display: block; overflow: hidden; border-radius: 20px; aspect-ratio: 1200 / 630; background: var(--surface); }
.hero-body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.hero-title { margin: 0; font-size: clamp(26px, 3.2vw, 38px); line-height: 1.35; font-weight: 900; letter-spacing: -.02em; }
.hero-title a { text-decoration: none; }
.hero-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .15em; }
.hero-excerpt { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.8; }
.hero .btn { margin-top: 6px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 16px; }
  .hero-media { border-radius: var(--radius); }
}

.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.section-head .cat-dot { width: 10px; height: 10px; }
.more { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.more:hover { color: var(--ink); text-decoration: underline; }

/* ---------- category ---------- */
.page-head { padding: 36px 0 32px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.page-kicker { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.page-head h1 { margin: 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.2; font-weight: 900; letter-spacing: -.03em; }
.page-head p { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; max-width: 40em; }
.page-head .page-count { margin-top: 6px; font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); }
.tabs { display: flex; gap: 4px; margin: -16px 0 32px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; border-radius: 999px; background: var(--surface); }
.tab { padding: 7px 18px; border-radius: 999px; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; transition: background .15s, color .15s; }
.tab:hover { color: var(--ink); }
.tab[aria-current="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }

/* ---------- ranking ---------- */
.nav-rank::before { content: "★ "; color: var(--brand); }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-item { position: relative; display: grid; grid-template-columns: 40px 160px minmax(0, 1fr); align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rank-item:last-child { border-bottom: 0; }
.rank-no { font-size: 28px; font-weight: 900; line-height: 1; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.rank-item:nth-child(-n+3) .rank-no { color: var(--brand); }
.rank-media { overflow: hidden; border-radius: 10px; background: var(--surface); aspect-ratio: 1200 / 630; }
.rank-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.rank-item:hover .rank-media img { transform: scale(1.04); }
.rank-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rank-title { margin: 0; font-size: 16px; line-height: 1.55; font-weight: 700; }
.rank-title a { text-decoration: none; }
.rank-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.rank-item:hover .rank-title a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.rank-views { margin: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .rank-item { grid-template-columns: 28px 104px minmax(0, 1fr); gap: 12px; padding: 12px 0; }
  .rank-no { font-size: 22px; }
  .rank-title { font-size: 14.5px; }
}

/* ---------- post ---------- */
.post-head { max-width: 820px; margin: 28px auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.post-title { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1.35; font-weight: 900; letter-spacing: -.025em; }
.post-dek { margin: 0; max-width: 40em; color: var(--ink-2); font-size: 16px; line-height: 1.8; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.post-meta a { color: var(--ink); font-weight: 600; text-decoration: none; }
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 13px; flex: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.post-cover { margin: 36px auto 0; max-width: 860px; border-radius: 20px; overflow: hidden; background: var(--surface); aspect-ratio: 1200 / 630; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 600px) {
  .post-head { text-align: left; align-items: flex-start; margin-top: 20px; }
  .post-meta { justify-content: flex-start; }
  .post-cover { margin: 24px -16px 0; border-radius: 0; }
}

.post-grid { display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; gap: 56px; margin-top: 48px; }
@media (min-width: 1100px) { .post-grid { grid-template-columns: minmax(0, 720px) 300px; } }
.post-main { min-width: 0; }
.post-rail { min-width: 0; }
.rail-sticky { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 28px; }
@media (max-width: 1099.98px) { .toc-rail { display: none; } .rail-sticky { position: static; align-items: center; } }
@media (min-width: 1100px) { .toc-inline { display: none; } }

/* ---------- prose ---------- */
.prose { font-size: 17px; line-height: 1.95; color: var(--ink); }
@media (max-width: 600px) { .prose { font-size: 16px; line-height: 1.9; } }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 1.25em 0; }
.prose a { color: var(--link); text-underline-offset: .2em; }
.prose h2 { margin: 2.8em 0 1em; font-size: 1.5em; line-height: 1.45; font-weight: 800; letter-spacing: -.015em; }
.prose h3 { margin: 2.2em 0 .7em; font-size: 1.2em; line-height: 1.55; font-weight: 700; }
.prose h4 { margin: 1.8em 0 .5em; font-size: 1.05em; }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 1.2em 0; }
.prose li { margin: .4em 0; padding-left: .2em; }
.prose li::marker { color: var(--muted); }
.prose ol li::marker { font-weight: 700; font-variant-numeric: tabular-nums; }
.prose blockquote { margin: 1.8em 0; padding: 18px 22px; border-radius: 12px; background: var(--surface); color: var(--ink-2); border-left: 3px solid var(--ink); }
.prose blockquote p { margin: .3em 0; }
.prose code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .88em; background: var(--surface); padding: .15em .4em; border-radius: 6px; }
.prose pre { background: var(--surface); padding: 16px 18px; border-radius: 12px; overflow-x: auto; font-size: 14px; line-height: 1.65; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.table-wrap { overflow-x: auto; margin: 1.8em 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.7; }
.prose th, .prose td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 7em; }
.prose th { background: var(--surface); font-weight: 700; white-space: nowrap; font-size: 13.5px; }
.prose tr:last-child td { border-bottom: 0; }

/* ---------- figures ---------- */
.prose .fig { margin: 2.2em auto; max-width: 600px; }
.fig img { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: #f5f6f8; }
.prose .fig-illust { max-width: none; }
.fig-illust img { border: 0; background: var(--surface); }
.fig figcaption { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--muted); text-align: center; }

/* ---------- toc ---------- */
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: h2; }
.toc a { display: block; text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--ink); }
.toc .toc-l2 { counter-increment: h2; }
.toc .toc-l2 > a::before { content: counter(h2, decimal-leading-zero) "  "; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9em; }
.toc-inline { margin: 2em 0; border: 1px solid var(--line); border-radius: var(--radius); }
.toc-inline summary { cursor: pointer; padding: 14px 20px; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; }
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after { content: "＋"; color: var(--muted); }
.toc-inline details[open] summary::after { content: "－"; }
.toc-inline ol { padding: 0 20px 16px; font-size: 15px; line-height: 1.6; }
.toc-inline a { padding: 5px 0; }
.toc-inline .toc-l3 { padding-left: 2.2em; font-size: 14px; }
.toc-rail { max-height: calc(100vh - 460px); min-height: 160px; overflow-y: auto; font-size: 13.5px; line-height: 1.55; }
.toc-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.toc-rail ol { border-left: 1px solid var(--line); }
.toc-rail a { padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; transition: color .15s, border-color .15s; }
.toc-rail .toc-l3 a { padding-left: 28px; font-size: 12.5px; }
.toc-rail a.is-active { color: var(--ink); font-weight: 700; border-left-color: var(--brand); }

/* ---------- faq ---------- */
.faq { margin-top: 3em; }
.faq-item { border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "＋"; color: var(--muted); flex: none; }
.faq-item[open] summary::after { content: "－"; }
.faq-item h3 { margin: 0; font-size: 16px; line-height: 1.6; font-weight: 700; }
.faq-item p { margin: 0; padding: 0 20px 18px; color: var(--ink-2); font-size: 15px; line-height: 1.85; }

/* ---------- post footer ---------- */
.post-footer { margin-top: 40px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 28px; }
.tags li { font-size: 13px; color: var(--ink-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; }
.share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 6px; }
.pill {
  display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s;
}
.pill:hover { background: var(--surface); border-color: var(--muted); }
.author-box { display: flex; gap: 16px; align-items: center; margin: 32px 0; padding: 20px 24px; background: var(--surface); border-radius: var(--radius); }
.author-box p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.author-box .author-name { font-weight: 800; color: var(--ink); font-size: 15px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-size: 15px; font-weight: 700; line-height: 1.55; transition: border-color .15s, background .15s; }
.pager a:hover { border-color: var(--ink); }
.pager a span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.pager-next { text-align: right; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager-next { text-align: left; } }

/* ---------- static / 404 ---------- */
.static { padding: 28px 0 24px; }
.static .post-title { margin-bottom: 28px; }
.notfound { text-align: center; padding: 64px 0 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.nf-code { margin: 0; font-size: 96px; font-weight: 900; line-height: 1; letter-spacing: -.05em; color: var(--brand); }
.notfound h1 { margin: 0; font-size: 26px; font-weight: 800; }
.notfound p { margin: 0 0 8px; color: var(--ink-2); }

/* ---------- ads ---------- */
.ad { text-align: center; line-height: 0; }
.ad-label { display: block; margin-bottom: 6px; font-size: 10px; line-height: 1.4; color: var(--muted); letter-spacing: .1em; }
.ad-top { margin: 16px 0 0; min-height: 72px; }
.ad-inline { margin: 2.4em 0; min-height: 272px; }
.ad-mid { margin: 64px 0 0; min-height: 272px; }
.ad-bottom { margin: 40px 0; min-height: 122px; }
.ad-side { min-height: 272px; }
@media (min-width: 768px) {
  .ad-sp { display: none; }
  .ad-top { min-height: 112px; }
}
@media (max-width: 767.98px) {
  .ad-pc { display: none; }
}

/* ---------- footer ---------- */
.site-footer { margin-top: 96px; background: #0f1217; color: #c5cad3; font-size: 14px; }
@media (prefers-color-scheme: dark) { .site-footer { background: #07080a; border-top: 1px solid var(--line); } }
.site-footer .brand { color: #fff; }
.footer-inner { display: grid; gap: 32px; padding-top: 56px; padding-bottom: 40px; }
@media (min-width: 800px) { .footer-inner { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand p { margin: 14px 0 0; max-width: 30em; color: #9aa1ad; line-height: 1.8; }
.footer-nav h2 { font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .08em; margin: 0 0 12px; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-nav a { color: #9aa1ad; text-decoration: none; }
.footer-nav a:hover { color: #fff; }
.copyright { margin: 0; padding: 20px 0 32px; border-top: 1px solid #262b33; font-size: 12px; color: #7d8592; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .site-header, .post-rail, .share, .section, .site-footer, .pager, .ad { display: none; }
}
