/* ===== Design tokens ===== */
:root {
  --paper: #f5f2ec;
  --paper-deep: #ebe6dc;
  --surface: #fffdf9;
  --ink: #1d201e;
  --ink-soft: #3f4440;
  --muted: #62665f;
  --line: #ddd7cb;
  --line-strong: #c9c1b2;
  --accent: #b8431d;
  --accent-dark: #93330f;
  --accent-wash: #f6e4da;
  --white: #fff;
  --radius: 14px;
  --radius-sm: 8px;
  --sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "BIZ UDPMincho", serif;
  --font: var(--sans);
  --shadow: 0 1px 2px rgba(40, 32, 20, .04), 0 8px 24px -12px rgba(40, 32, 20, .14);
  --shadow-lift: 0 2px 4px rgba(40, 32, 20, .05), 0 18px 40px -16px rgba(40, 32, 20, .26);
  --g-pptx: #c2562b; --g-image: #ad4f83; --g-html: #5658a8;
  --g-business: #2c6b95; --g-convert: #9a7616; --g-general: #4b7a4f;
  --genre: var(--accent);
}

/* Genre colours — shared by the top page and the project list */
.genre-pptx { --genre: var(--g-pptx); }
.genre-image { --genre: var(--g-image); }
.genre-html { --genre: var(--g-html); }
.genre-business { --genre: var(--g-business); }
.genre-convert { --genre: var(--g-convert); }
.genre-general { --genre: var(--g-general); }

/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; font-feature-settings: "palt" 0; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-wash); color: var(--ink); }
.page-width { width: min(1240px, calc(100% - 80px)); margin: 0 auto; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 30; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm); font-weight: 700; }
.skip-link:focus { top: 16px; }

/* ===== Header ===== */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(245, 242, 236, .92); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }
.header-inner { width: min(1240px, calc(100% - 80px)); margin: 0 auto; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; min-height: 44px; font-size: 15px; font-weight: 700; letter-spacing: .01em; line-height: 1.3; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; margin-top: 3px; }
.brand-mark { display: block; position: relative; width: 32px; height: 30px; flex: 0 0 32px; }
.brand-mark i { position: absolute; width: 24px; height: 17px; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--paper); }
.brand-mark i:nth-child(1) { left: 0; top: 0; }
.brand-mark i:nth-child(2) { left: 4px; top: 6px; }
.brand-mark i:nth-child(3) { left: 8px; top: 12px; background: var(--accent); border-color: var(--accent); }
.site-header nav { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; transition: background .2s, color .2s; }
.site-header nav a:hover { background: var(--paper-deep); }
.github-link { border: 1px solid var(--line-strong); }
.github-link span { padding-left: 6px; }

/* ===== Shared type ===== */
h1 { margin: 0; font-family: var(--serif); font-size: clamp(40px, 5.6vw, 76px); line-height: 1.28; font-weight: 600; letter-spacing: .01em; }
h2, h3 { font-family: var(--serif); font-weight: 600; }

/* ===== Hero (top) ===== */
.hero { padding: 64px 0 48px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .75fr); align-items: end; gap: 56px; }
.overview { align-self: end; border-left: 1px solid var(--line-strong); padding: 8px 0 6px 36px; display: grid; grid-template-columns: auto 1px auto; gap: 24px; align-items: end; }
.overview-number { display: flex; flex-direction: column; gap: 8px; }
.overview-number strong { font-family: var(--serif); font-size: 60px; line-height: .9; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.overview-number span { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.overview-divider { height: 48px; margin-bottom: 4px; background: var(--line-strong); }

/* ===== Genre section ===== */
.genre-section { padding-bottom: 88px; }
.section-heading { padding: 28px 0; border-top: 1px solid var(--ink); }
.section-heading h2 { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.4; margin: 0; letter-spacing: .01em; }
.genre-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }

.genre-card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .25s, border-color .25s, transform .25s; }
.genre-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.genre-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--genre); z-index: 1; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 14px; }
.genre-label { display: flex; align-items: center; gap: 9px; min-width: 0; margin: 0; font-family: var(--sans); font-size: 16px; font-weight: 700; line-height: 1.4; letter-spacing: 0; color: var(--ink); overflow-wrap: anywhere; }
.label-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--genre); flex: 0 0 8px; }
.tool-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tool-count b { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); margin-right: 2px; font-variant-numeric: lining-nums tabular-nums; }

.genre-preview { position: relative; margin: 0 14px 14px; }
.preview-link { display: block; position: relative; overflow: hidden; border-radius: 10px; background: var(--paper-deep); background: color-mix(in srgb, var(--genre) 9%, var(--paper-deep)); cursor: pointer; }
.preview-image { aspect-ratio: 7 / 5; padding: 18px 18px 22px; display: flex; align-items: center; justify-content: center; }
.preview-image img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(30, 24, 14, .18)); transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.preview-link:hover img { transform: translateY(-3px); }
.zoom-hint { position: absolute; left: 10px; bottom: 10px; padding: 6px 11px; background: var(--ink); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; pointer-events: none; }
.preview-link:hover .zoom-hint, .preview-link:focus-visible .zoom-hint { opacity: 1; transform: none; }
.preview-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 253, 249, .95); color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: zoom-in; transition: background .2s, border-color .2s; }
.preview-zoom:hover { background: #fff; border-color: var(--line-strong); color: var(--ink); }

.genre-card h3 a { background-image: linear-gradient(var(--genre), var(--genre)); background-size: 0 1.5px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s; }
.genre-card h3 a:hover { background-size: 100% 1.5px; }
.card-action { display: flex; align-items: center; gap: 4px; min-height: 56px; margin-top: auto; padding: 14px 24px; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 700; transition: background .2s, color .2s; }
.card-action > span[data-action-count] { font-variant-numeric: tabular-nums; }
.card-action .arrow { margin-left: auto; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 15px; transition: background .2s, border-color .2s, color .2s, transform .2s; }
.card-action:hover { background: var(--paper); }
.card-action:hover .arrow { background: var(--ink); border-color: var(--ink); color: #fff; transform: translateX(2px); }

/* ===== Notes ===== */
.notes { padding: 64px 0 56px; }
.notes h2 { font-family: var(--sans); font-size: 13px; letter-spacing: .12em; color: var(--muted); margin: 0 0 16px; font-weight: 700; }
.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.notes p { font-size: 13px; color: var(--ink-soft); line-height: 2; margin: 0; }
.notes p a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.notes p a:hover { color: var(--accent-dark); text-decoration-color: var(--accent); }
.source-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.source-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink-soft); font-weight: 600; }
.source-links a:hover { color: var(--accent-dark); }
.source-links > span { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-deep); }
.footer-inner { padding: 24px 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; font-size: 12px; color: var(--muted); }
.footer-inner > a, .site-footer p a { display: inline-flex; align-items: center; min-height: 40px; }
.footer-brand { color: var(--ink); font-weight: 700; font-size: 14px; }
.footer-brand span { margin-left: 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.site-footer p { margin: 0; }
.site-footer a:hover { color: var(--accent-dark); }

/* ===== Preview dialog ===== */
.preview-dialog { width: min(1120px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); overflow: auto; box-shadow: 0 40px 120px rgba(10, 10, 8, .5); }
.preview-dialog::backdrop { background: rgba(20, 20, 18, .78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 28px; }
.dialog-header h2 { margin: 6px 0 0; font-size: 22px; line-height: 1.4; }
.dialog-close { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.dialog-close:hover { background: var(--paper); color: var(--ink); }
.dialog-close span { font-size: 18px; line-height: 1; margin-left: 8px; }
.dialog-image { background: var(--paper-deep); padding: 24px; }
.dialog-image img { display: block; max-width: 100%; max-height: 66dvh; width: auto; height: auto; margin: auto; object-fit: contain; }
.dialog-caption { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 18px 28px 22px; font-size: 13px; color: var(--muted); }
.dialog-caption p { margin: 0; }
.dialog-caption a { display: inline-flex; align-items: center; min-height: 40px; color: var(--accent-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
html.dialog-open { overflow: hidden; }

/* ===== Responsive ===== */
@media (min-width: 1500px) { .page-width, .header-inner { width: min(1320px, calc(100% - 120px)); } }
@media (max-width: 1100px) {
  .genre-grid { gap: 20px; }
  .card-topline { padding: 16px 18px 12px; }
  .genre-label { font-size: 15px; gap: 8px; }
  .hero { gap: 32px; }
  .overview { padding-left: 26px; }
}
@media (max-width: 930px) {
  .page-width, .header-inner { width: calc(100% - 48px); }
  .genre-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .hero { padding: 48px 0 40px; grid-template-columns: 1fr; gap: 28px; }
  .overview { justify-content: start; border-left: 0; border-top: 1px solid var(--line-strong); padding: 22px 0 0; align-items: center; }
  .overview-number strong { font-size: 48px; }
  .genre-label { font-size: 16px; gap: 9px; }
}
@media (max-width: 620px) {
  html { scroll-padding-top: 76px; }
  body { font-size: 15px; }
  .page-width, .header-inner { width: calc(100% - 32px); }
  .header-inner { min-height: 62px; gap: 10px; }
  .brand { gap: 10px; font-size: 14px; }
  .brand small { font-size: 10px; letter-spacing: .02em; }
  .site-header nav > a:first-child { display: none; }
  .site-header nav a { padding: 0 14px; font-size: 12px; }
  .hero { padding: 32px 0 28px; gap: 22px; }
  h1 { font-size: clamp(32px, 9.4vw, 44px); line-height: 1.34; }
  .overview { display: flex; align-items: center; gap: 18px; padding-top: 18px; }
  .overview-number { flex-direction: row; align-items: baseline; gap: 8px; }
  .overview-number strong { font-size: 36px; }
  .overview-divider { height: 28px; margin: 0; }
  .section-heading { padding: 22px 0 20px; }
  .genre-section { padding-bottom: 48px; }
  .genre-grid { grid-template-columns: 1fr; gap: 20px; }
  .card-topline { padding: 16px 18px 12px; }
  .genre-preview { margin: 0 12px 12px; }
  .preview-image { padding: 14px 14px 18px; }
  .card-action { padding: 12px 20px; }
  .notes { padding: 44px 0 36px; }
  .notes-grid { grid-template-columns: 1fr; gap: 16px; }
  .source-links { flex-direction: column; align-items: flex-start; gap: 0; }
  .source-links > span { margin: 8px 0 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 20px 0 28px; }
  .preview-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .dialog-header { padding: 16px 18px; }
  .dialog-header h2 { font-size: 18px; }
  .dialog-image { padding: 10px; }
  .dialog-caption { padding: 14px 18px 18px; }
}
@media (hover: none) { .zoom-hint { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .preview-link:hover img, .card-action:hover .arrow { transform: none; }
}
