/* HighVocab blog — shared styles for every page in /blog and /ipa.html */

:root {
  --brand: #8d29da;
  --brand-strong: #7417c0;
  --brand-soft: #f4ebfd;
  --brand-line: #e3cdf8;
  --text: #1f1d24;
  --text-soft: #4c4857;
  --text-muted: #77727f;
  --bg: #ffffff;
  --bg-alt: #faf8fc;
  --line: #ebe7f0;
  --ok: #138a52;
  --ok-soft: #e6f6ee;
  --warn: #b25e00;
  --warn-soft: #fff3e2;
  --bad: #c2334d;
  --bad-soft: #fdebee;
  --shadow: 0 1px 2px rgba(31, 29, 36, 0.04), 0 8px 24px rgba(31, 29, 36, 0.06);
  --radius: 14px;
  --measure: 720px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --brand: #b67cf0;
    --brand-strong: #c99af5;
    --brand-soft: #2a1d3a;
    --brand-line: #3f2b57;
    --text: #efedf3;
    --text-soft: #c9c5d1;
    --text-muted: #9c97a6;
    --bg: #141218;
    --bg-alt: #1b1820;
    --line: #2c2833;
    --ok: #4fd08f;
    --ok-soft: #15291f;
    --warn: #f0a450;
    --warn-soft: #2e2214;
    --bad: #f07a8f;
    --bad-soft: #301920;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans JP',
    'Noto Sans KR', 'Noto Sans SC', sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

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

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-strong);
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Reading progress ---- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 30;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-header .logo img {
  height: 24px;
  width: auto;
  display: block;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 15px;
  font-weight: 500;
}

.site-header nav a {
  color: var(--text-soft);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current='page'] {
  color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff !important;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--brand) !important;
  border: 1.5px solid var(--brand-line);
}

.btn-ghost:hover {
  background: var(--brand-soft);
}

@media (max-width: 560px) {
  .site-header nav .hide-sm {
    display: none;
  }
}

/* ---- Layout ---- */
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 16px;
}

.wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Article hero ---- */
.post-hero {
  padding: 48px 0 24px;
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand);
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.post-hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}

.lede {
  font-size: 1.2rem;
  color: var(--text-soft);
  margin: 0 0 24px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 14px;
  color: var(--text-muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.meta .author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-weight: 600;
}

.meta .author img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.meta .dot::before {
  content: '·';
}

/* ---- Article body ---- */
.post {
  padding-bottom: 32px;
}

.post h2 {
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 56px 0 16px;
  scroll-margin-top: 80px;
}

.post h3 {
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 32px 0 8px;
  scroll-margin-top: 80px;
}

.post p,
.post li {
  color: var(--text-soft);
}

.post p {
  margin: 0 0 20px;
}

.post strong {
  color: var(--text);
}

.post ul,
.post ol {
  padding-left: 24px;
  margin: 0 0 24px;
}

.post li {
  margin: 8px 0;
  padding-left: 4px;
}

.post li::marker {
  color: var(--brand);
  font-weight: 700;
}

.post hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

.post code,
.ipa {
  font-family: 'Noto Sans', 'Charis SIL', 'Doulos SIL', 'Lucida Sans Unicode', sans-serif;
  background: var(--brand-soft);
  color: var(--brand-strong);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.95em;
  white-space: nowrap;
}

/* Key takeaways / summary box */
.summary {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 32px 0;
}

.post .summary h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  margin: 0 0 12px;
}

.summary ul {
  margin: 0;
}

/* Table of contents */
.toc {
  border-left: 3px solid var(--brand-line);
  padding: 4px 0 4px 20px;
  margin: 32px 0;
}

.post .toc h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 16px;
}

.toc li {
  margin: 4px 0;
}

.toc a {
  color: var(--text-soft);
  text-decoration: none;
}

.toc a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Callouts */
.callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  margin: 28px 0;
}

.callout .icon {
  font-size: 1.3rem;
  line-height: 1.4;
  flex: none;
}

.callout p {
  margin: 0;
  color: var(--text);
}

.callout.tip {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 25%, transparent);
}

.callout.warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 25%, transparent);
}

/* Figures / screenshots */
.shot {
  margin: 32px 0;
}

.shot img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--bg-alt);
}

.shot.narrow img {
  max-width: 360px;
  margin: 0 auto;
}

.shot figcaption {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

.shot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 32px 0;
}

.shot-pair .shot {
  margin: 0;
}

@media (max-width: 560px) {
  .shot-pair {
    grid-template-columns: 1fr;
  }
}

/* Numbered steps */
.steps {
  list-style: none;
  padding: 0 !important;
  counter-reset: step;
  margin: 24px 0 32px;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 24px 56px !important;
  margin: 0 !important;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 40px;
  bottom: 4px;
  width: 2px;
  background: var(--brand-line);
}

.steps > li > strong:first-child {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--bg-alt);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

tr:last-child td {
  border-bottom: 0;
}

td {
  color: var(--text-soft);
}

td strong {
  color: var(--text);
}

/* Speak buttons (IPA post) */
.say {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--brand-line);
  background: var(--bg);
  color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
  margin-right: 8px;
  transition: background 0.15s ease;
  flex: none;
}

.say:hover {
  background: var(--brand-soft);
}

.say svg {
  width: 16px;
  height: 16px;
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0 32px;
  padding: 0 !important;
  list-style: none;
}

.sound-grid li {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 !important;
  padding: 12px 14px !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-alt);
  font-size: 16px;
}

.sound-grid .sym {
  font-family: 'Noto Sans', 'Charis SIL', 'Doulos SIL', 'Lucida Sans Unicode', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--brand);
  min-width: 44px;
}

.sound-grid .ex {
  color: var(--text-soft);
  line-height: 1.35;
}

.sound-grid .ex small {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

/* Spaced repetition timeline */
.timeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 28px 0 12px;
  padding: 0 !important;
  list-style: none;
}

.timeline li {
  margin: 0 !important;
  padding: 14px 8px !important;
  border-radius: 12px;
  text-align: center;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-soft);
}

.timeline li b {
  display: block;
  font-size: 1.15rem;
  color: var(--brand);
  margin-bottom: 2px;
}

.timeline li.start {
  background: var(--bg-alt);
  border-color: var(--line);
}

.timeline li.start b {
  color: var(--text);
}

.timeline li.end {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}

.timeline li.end b {
  color: var(--ok);
}

.timeline-note {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 28px !important;
}

@media (max-width: 560px) {
  .timeline {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Forgetting curve chart */
.curve {
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-alt);
}

.curve svg {
  display: block;
  width: 100%;
  height: auto;
}

.curve .axis {
  stroke: var(--line);
  stroke-width: 1.5;
}

.curve .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.curve .lbl {
  fill: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
}

.curve .no-review {
  fill: none;
  stroke: var(--bad);
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
}

.curve .with-review {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
}

.curve .review-dot {
  fill: var(--brand);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 12px;
}

.legend span::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 2px;
}

.legend .l-no::before {
  background: var(--bad);
}

.legend .l-yes::before {
  background: var(--brand);
}

/* Strength chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  font-size: 15px;
  color: var(--text-soft);
}

.chip i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.chip .new {
  background: #9a96a3;
}

.chip .weak {
  background: var(--bad);
}

.chip .learning {
  background: var(--warn);
}

.chip .strong {
  background: var(--ok);
}

/* FAQ */
.faq details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 20px;
  margin: 12px 0;
  background: var(--bg);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  padding: 16px 28px 16px 0;
  position: relative;
  color: var(--text);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 12px;
  font-size: 1.4rem;
  color: var(--brand);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  margin: 0 0 16px;
}

/* CTA card */
.cta {
  margin: 56px 0 24px;
  padding: 36px 32px;
  border-radius: 20px;
  background: linear-gradient(135deg, #8d29da 0%, #5b3df5 100%);
  color: #fff;
  text-align: center;
}

.cta h2 {
  color: #fff;
  margin: 0 0 8px !important;
  font-size: 1.6rem;
}

.cta p {
  color: rgba(255, 255, 255, 0.88) !important;
  margin: 0 auto 24px !important;
  max-width: 480px;
}

.cta .store-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.cta .btn {
  background: #fff;
  color: #5d1a96 !important;
}

.cta .btn:hover {
  background: #f4ebfd;
}

.cta .btn-ghost {
  background: transparent;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.5);
}

.cta .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cta small {
  display: block;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

/* Post cards (index + related) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
  color: inherit;
}

.card .thumb {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.thumb.t1 {
  background: linear-gradient(135deg, #8d29da, #5b3df5);
}

.thumb.t2 {
  background: linear-gradient(135deg, #e0457b, #8d29da);
}

.thumb.t3 {
  background: linear-gradient(135deg, #0ea5a4, #3b6cf5);
}

.thumb.t4 {
  background: linear-gradient(135deg, #f08a24, #e0457b);
}

.card .body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card .tag {
  align-self: flex-start;
  margin-bottom: 10px;
  font-size: 12px;
}

.card h3 {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0 0 8px;
  color: var(--text);
}

.card p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.card .read {
  margin-top: auto;
  font-size: 14px;
  color: var(--text-muted);
}

.related {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  padding: 48px 0 56px;
  margin-top: 32px;
}

.related h2 {
  font-size: 1.3rem;
  margin: 0 0 20px;
}

/* Blog index */
.index-hero {
  padding: 56px 0 32px;
  text-align: center;
}

.index-hero h1 {
  font-size: clamp(2.1rem, 5vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 12px;
}

.index-hero p {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 560px;
  margin: 0 auto;
}

.featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  margin-bottom: 28px;
}

.featured .thumb {
  aspect-ratio: auto;
  min-height: 260px;
  font-size: 3.4rem;
}

.featured .body {
  padding: 32px;
  justify-content: center;
}

.featured h3 {
  font-size: 1.6rem;
}

@media (max-width: 760px) {
  .featured {
    grid-template-columns: 1fr;
  }

  .featured .thumb {
    min-height: 180px;
  }

  .featured .body {
    padding: 22px;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: 14px;
  color: var(--text-muted);
}

.site-footer .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--brand);
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .post-hero {
    padding-top: 32px;
  }

  .post h2 {
    margin-top: 44px;
    font-size: 1.45rem;
  }

  .summary {
    padding: 20px;
  }

  .cta {
    padding: 28px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
