@font-face {
  font-family: "Huang Noto CJK";
  src: url("../assets/fonts/noto-sans-cjk-sc/NotoSansCJKsc-Regular.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 100 500;
}

@font-face {
  font-family: "Huang Noto CJK";
  src: url("../assets/fonts/noto-sans-cjk-sc/NotoSansCJKsc-Bold.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 600 900;
}

:root {
  --bg: #f7faff;
  --surface: #ffffff;
  --ink: #101522;
  --muted: #66728a;
  --line: #dfe7f4;
  --blue: #4567ff;
  --cyan: #18b9e8;
  --green: #38c66b;
  --shadow: 0 24px 70px rgba(47, 74, 130, 0.13);
  --font-sans: "Huang Noto CJK", "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK JP", "Source Han Sans JP", "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #07101f;
  --surface: #121c2e;
  --ink: #eef4ff;
  --muted: #a8b4c8;
  --line: #29384f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 88% 8%, rgba(69, 103, 255, 0.1), transparent 26%),
    radial-gradient(circle at 8% 18%, rgba(24, 185, 232, 0.1), transparent 26%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(980px, calc(100% - 40px));
  margin: 24px auto;
  border: 1px solid rgba(197, 211, 232, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  overflow: hidden;
}

[data-theme="dark"] .page {
  border-color: rgba(73, 92, 124, 0.78);
  background: rgba(18, 28, 46, 0.88);
}

.app-header,
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 32px;
}

.app-header {
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 850;
}

.brand-glyph {
  color: var(--blue);
  font-weight: 900;
}

.nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.nav a:hover {
  color: var(--blue);
}

.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.lang-switcher {
  display: inline-grid;
  grid-template-columns: repeat(3, 42px);
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.lang-switcher button,
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}


.lang-switcher button.is-active {
  background: var(--blue);
  color: #fff;
}

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
}

.hero,
.content {
  padding: 56px 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 0 0 22px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #30394d;
  font-size: 13px;
  font-weight: 760;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  min-height: calc(1.65em * 3);
  margin: 24px 0 0;
  color: #344056;
  font-size: 19px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

[data-theme="dark"] .button,
[data-theme="dark"] .page-links a,
[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .lang-switcher {
  background: rgba(18, 28, 46, 0.78);
}

[data-theme="dark"] .button {
  color: var(--ink);
}

.button:hover,
.release-card:hover {
  transform: translateY(-2px);
}

.button:active,
.release-card:active {
  transform: translateY(0);
  transition-duration: 60ms;
}

.button.primary {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 14px 26px rgba(69, 103, 255, 0.22);
}

.app-mark {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 62% 28%, rgba(255, 255, 255, 0.96) 0 22px, transparent 23px),
    linear-gradient(135deg, #111827, #4567ff 58%, #18b9e8);
  color: #fff;
  font-size: 82px;
  font-weight: 900;
  box-shadow: 0 26px 55px rgba(69, 103, 255, 0.22);
}

.product-icon {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 26px 55px rgba(69, 103, 255, 0.22);
}

.content {
  border-top: 1px solid var(--line);
}

.content h2 {
  margin: 34px 0 12px;
  font-size: 24px;
  line-height: 1.2;
}

.content h2:first-child {
  margin-top: 0;
}

.content p,
.content li {
  color: #40506b;
  font-size: 16px;
}

[data-theme="dark"] .lead,
[data-theme="dark"] .content p,
[data-theme="dark"] .content li {
  color: #bdc7d8;
}

.content ul {
  padding-left: 1.2em;
}

.meta {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 34px;
}

.info-card {
  min-height: 120px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .info-card,
[data-theme="dark"] .release-card,
[data-theme="dark"] .release-language {
  background: rgba(18, 28, 46, 0.76);
}

.info-card strong {
  display: block;
  margin-bottom: 8px;
}

.info-card span {
  color: var(--muted);
}

.notice-card {
  display: grid;
  gap: 8px;
  margin-top: 30px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 181, 90, 0.46);
  border-radius: 8px;
  background: rgba(255, 247, 235, 0.78);
}

[data-theme="dark"] .notice-card {
  border-color: rgba(255, 181, 90, 0.32);
  background: rgba(108, 70, 23, 0.18);
}

.notice-card strong {
  color: #8a4c0c;
}

.notice-card span {
  color: #564632;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 30px;
}

.screenshot-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 0.46;
  border: 1px solid rgba(223, 231, 244, 0.8);
  border-radius: 8px;
  object-fit: cover;
  object-position: top center;
  box-shadow: 0 18px 40px rgba(16, 21, 34, 0.1);
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 26px;
  padding-left: 0;
  list-style: none;
}

.feature-list li {
  position: relative;
  margin: 0;
  padding-left: 20px;
}

.feature-list li::before {
  position: absolute;
  left: 0;
  color: var(--blue);
  content: "•";
  font-weight: 900;
}

.section-block {
  margin-top: 52px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-header .eyebrow {
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
}

.text-link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
}

.narrow {
  max-width: 720px;
}

.changelog-page h1 {
  font-size: clamp(42px, 5vw, 64px);
}

.release-list {
  display: grid;
  gap: 18px;
  margin-top: 30px;
}

.compact-release-list {
  margin-top: 0;
}

.release-card {
  padding: 24px;
  border: 1px solid rgba(223, 231, 244, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 42px rgba(47, 74, 130, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.release-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.release-version,
.release-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.release-version {
  background: #edf2ff;
  color: var(--blue);
}

.release-badge {
  background: rgba(56, 198, 107, 0.14);
  color: #16894a;
}

.release-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
}

.release-body {
  display: grid;
  gap: 12px;
}

.release-language {
  padding: 16px;
  border: 1px solid rgba(223, 231, 244, 0.85);
  border-radius: 8px;
  background: rgba(247, 250, 255, 0.82);
}

.release-language h3,
.release-language summary {
  color: #1c2638;
  font-size: 14px;
  font-weight: 900;
  transition: color 150ms ease;
}

[data-theme="dark"] .release-language h3,
[data-theme="dark"] .release-language summary,
[data-theme="dark"] .release-language p {
  color: var(--ink);
}

.release-language summary {
  cursor: pointer;
  border-radius: 4px;
}

.release-language summary:hover {
  color: var(--blue);
}

.release-language summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

.release-language p {
  margin: 10px 0 0;
  color: #2d3a50;
  font-weight: 760;
}

.release-language ul {
  margin: 12px 0 0;
}

.release-language li {
  margin: 6px 0;
}

[data-release-lang][hidden] {
  display: none;
}

.url-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.url-list a {
  color: var(--blue);
  font-weight: 760;
  overflow-wrap: anywhere;
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 42px;
}

.page-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
  transition: transform 160ms ease;
}

.page-links a:hover {
  transform: translateY(-2px);
}

.page-links a:active {
  transform: translateY(0);
  transition-duration: 60ms;
}

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

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.icp-link {
  color: inherit;
}

@media (max-width: 760px) {
  .page {
    width: 100%;
    margin: 0;
    border-width: 0;
    border-radius: 0;
  }

  .app-header,
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .header-tools {
    width: 100%;
    margin-left: 0;
  }

  .lang-switcher {
    flex: 1;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .hero,
  .content {
    padding: 40px 20px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero .actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  }

  .hero .actions .button {
    min-width: 0;
    padding-inline: 14px;
    text-align: center;
    white-space: nowrap;
  }

  .app-mark {
    width: 164px;
    height: 164px;
    font-size: 62px;
  }

  .product-icon {
    width: 164px;
    height: 164px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .release-card {
    padding: 18px;
  }

  .info-grid,
  .screenshot-grid,
  .feature-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .lead {
    min-height: calc(1.65em * 5);
  }
}

/* ---------- Blog post layout (under /blog/<slug>/) ---------- */

.blog-post .post-header {
  margin-bottom: 30px;
}

.blog-post .post-header h1 {
  margin: 8px 0 12px;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: 0;
}

.blog-post .post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Number lists weren't styled before — give them the same padding as ul.
   This is safe to apply globally because existing pages don't use <ol>. */
.content ol {
  padding-left: 1.4em;
}

/* Looser list spacing inside long-form posts only — leaves the tighter
   spacing on the Sumiyomi feature/release lists untouched. */
.blog-post li {
  margin-bottom: 6px;
}

.blog-post .post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.blog-post .post-footer a {
  color: var(--blue);
  font-weight: 700;
}

@media (max-width: 760px) {
  .blog-post .post-header h1 {
    font-size: clamp(28px, 8vw, 36px);
  }
}

/* ---------- UI Polish & Animations ---------- */

/* Focus rings (a11y) */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.button:focus-visible,
.release-card:focus-visible,
.page-links a:focus-visible,
.nav a:focus-visible {
  border-radius: 8px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Staggered Hero & Page Entry Animation — Progressive enhancement:
   JS adds .animate-entry to <html>; without JS, content stays visible. */
@keyframes slide-up-fade {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-entry .hero > div > *,
.animate-entry .hero > .product-icon,
.animate-entry .hero > .app-mark,
.animate-entry .content > .eyebrow,
.animate-entry .content > h1,
.animate-entry .content > .lead,
.animate-entry .content > .meta {
  opacity: 0;
  animation: slide-up-fade 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Delay for Hero elements */
.animate-entry .hero .eyebrow { animation-delay: 0ms; }
.animate-entry .hero h1 { animation-delay: 50ms; }
.animate-entry .hero .lead { animation-delay: 100ms; }
.animate-entry .hero .actions { animation-delay: 150ms; }
.animate-entry .hero .product-icon, .animate-entry .hero .app-mark { animation-delay: 200ms; }

/* Delay for Subpage (Changelog, Support, Privacy) headers */
.animate-entry .content > .eyebrow { animation-delay: 0ms; }
.animate-entry .content > h1 { animation-delay: 50ms; }
.animate-entry .content > .meta, .animate-entry .content > .lead { animation-delay: 100ms; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .animate-entry .hero > div > *,
  .animate-entry .hero > .product-icon,
  .animate-entry .hero > .app-mark,
  .animate-entry .content > .eyebrow,
  .animate-entry .content > h1,
  .animate-entry .content > .lead,
  .animate-entry .content > .meta {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ---------- Motion Polish v1 ---------- */

:root {
  --motion-fast: 170ms;
  --motion-med: 280ms;
  --motion-slow: 640ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --hover-border: rgba(69, 103, 255, 0.42);
  --hover-shadow: 0 16px 42px rgba(47, 74, 130, 0.13);
}

[data-theme="dark"] {
  --hover-border: rgba(99, 126, 255, 0.58);
  --hover-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
}

.page {
  overflow: clip;
}

@media (min-width: 761px) {
  .app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  [data-theme="dark"] .app-header {
    background: rgba(18, 28, 46, 0.86);
  }
}

.app-header {
  transition:
    background-color var(--motion-med) var(--ease-standard),
    border-color var(--motion-med) var(--ease-standard),
    box-shadow var(--motion-med) var(--ease-standard);
}

.app-header.is-scrolled {
  border-bottom-color: rgba(150, 166, 197, 0.34);
  box-shadow: 0 12px 34px rgba(33, 49, 79, 0.08);
}

[data-theme="dark"] .app-header.is-scrolled {
  border-bottom-color: rgba(110, 132, 174, 0.24);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.24);
}

.lang-switcher {
  position: relative;
  isolation: isolate;
}

.lang-switcher::before {
  position: absolute;
  inset: 3px auto 3px 3px;
  z-index: 0;
  width: calc((100% - 6px) / 3);
  border-radius: 6px;
  background: var(--blue);
  box-shadow:
    0 8px 18px rgba(69, 103, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  content: "";
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-med) var(--ease-spring);
  will-change: transform;
}

.lang-switcher[data-active-lang]::before {
  opacity: 1;
}

.lang-switcher[data-active-lang="ja"]::before {
  transform: translate3d(100%, 0, 0);
}

.lang-switcher[data-active-lang="en"]::before {
  transform: translate3d(200%, 0, 0);
}

.lang-switcher button {
  position: relative;
  display: grid;
  place-items: center;
  z-index: 1;
  background: transparent;
  line-height: 1;
  text-align: center;
  transition:
    color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.lang-switcher button.is-active {
  background: transparent;
  color: #fff;
}

.theme-toggle,
.button,
.page-links a,
.release-card,
.release-language,
.info-card {
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-standard);
}

.theme-toggle:hover,
.button:hover,
.page-links a:hover,
.release-card:hover,
.release-language:hover,
.info-card:hover {
  border-color: var(--hover-border);
  box-shadow: var(--hover-shadow);
  transform: translate3d(0, -1px, 0);
}

.theme-toggle:active,
.button:active,
.page-links a:active,
.release-card:active {
  transform: translate3d(0, 0, 0);
  transition-duration: 70ms;
}

.product-icon,
.app-mark,
.screenshot-grid img {
  transition:
    transform var(--motion-med) var(--ease-out),
    filter var(--motion-med) var(--ease-standard),
    box-shadow var(--motion-med) var(--ease-out);
}

.hero:hover .product-icon,
.hero:hover .app-mark {
  filter: saturate(1.04);
  transform: translate3d(0, -1px, 0) scale(1.01);
}

.screenshot-grid img:hover {
  filter: saturate(1.04);
  transform: translate3d(0, -2px, 0);
}

@media (prefers-reduced-motion: reduce) {
  .app-header,
  .lang-switcher::before,
  .lang-switcher button,
  .theme-toggle,
  .button,
  .page-links a,
  .release-card,
  .release-language,
  .info-card,
  .product-icon,
  .app-mark,
  .screenshot-grid img {
    transform: none;
  }
}

/* ---------- Scrollbar Styling ---------- */
::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(152, 164, 186, 0.4);
  border: 4px solid transparent;
  background-clip: padding-box;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(152, 164, 186, 0.7);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background-color: rgba(155, 168, 188, 0.3);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(155, 168, 188, 0.5);
}

/* ---------- Print Styles ---------- */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .app-header,
  .hero .actions,
  .footer {
    display: none !important;
  }

  .content {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Don't show URL for relative internal links */
  a[href^="#"]:after,
  a[href^="/"]:after {
    content: "";
  }
}
