:root {
  color-scheme: light;
  --paper: #f3efe5;
  --paper-deep: #e9e1d2;
  --card: #fbf8f0;
  --ink: #241f1a;
  --muted: #6d655d;
  --line: rgba(36, 31, 26, 0.15);
  --accent: #e5572f;
  --accent-dark: #b93a1e;
  --sage: #617365;
  --shadow: 0 24px 70px rgba(53, 42, 29, 0.09);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E"); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 20; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 999px; }
.skip-link:focus { top: 1rem; }
.site-header, main, .site-footer { position: relative; z-index: 1; }
.site-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; max-width: 1240px; margin: 0 auto; padding: 1rem 28px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px 13px 13px 5px; background: var(--ink); color: var(--paper); font-family: serif; font-size: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-actions a { color: var(--muted); text-decoration: none; font-size: 14px; }
.quiet-button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: transparent; cursor: pointer; color: var(--ink); }
.quiet-button:hover, .header-actions a:hover { color: var(--accent-dark); border-color: var(--accent); }

main { max-width: 1240px; margin: 0 auto; padding: 0 28px 100px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .65fr); gap: clamp(3rem, 9vw, 8rem); padding: clamp(72px, 10vw, 132px) 0 70px; align-items: end; }
.eyebrow { margin: 0 0 16px; color: var(--accent-dark); font-size: 12px; font-weight: 750; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 850px; margin-bottom: 26px; font-family: ui-serif, "Songti SC", serif; font-size: clamp(48px, 7.4vw, 100px); font-weight: 650; letter-spacing: -.07em; line-height: .98; }
.hero-lede { max-width: 700px; color: var(--muted); font-size: clamp(17px, 2vw, 22px); line-height: 1.7; }
.hero-actions, .dialog-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.primary-button, .secondary-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 0 19px; border-radius: 13px; border: 1px solid transparent; text-decoration: none; font-weight: 700; cursor: pointer; }
.primary-button { background: var(--ink); color: white; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: transparent; border-color: var(--line); color: var(--ink); }
.secondary-button:hover { border-color: var(--ink); }
.hero-stats { margin: 0; border-top: 1px solid var(--ink); }
.hero-stats div { display: grid; grid-template-columns: 100px 1fr; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--line); }
.hero-stats dt { font-family: ui-serif, "Songti SC", serif; font-size: 34px; }
.hero-stats dd { margin: 0; color: var(--muted); font-size: 14px; }

.license-banner { display: flex; align-items: flex-start; gap: 13px; padding: 18px 20px; border: 1px solid rgba(97, 115, 101, .28); border-radius: 16px; background: rgba(251, 248, 240, .66); }
.license-banner p { margin: 0; color: #4d5a50; line-height: 1.65; font-size: 14px; }
.status-dot { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 5px rgba(97, 115, 101, .12); }

.catalog-section, .integration, .principles { padding-top: 110px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading.compact { margin-bottom: 22px; }
h2 { margin-bottom: 0; font-family: ui-serif, "Songti SC", serif; font-size: clamp(34px, 5vw, 58px); letter-spacing: -.05em; line-height: 1.1; }
.result-summary { margin: 0; color: var(--muted); font-size: 14px; }
.filters { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 12px; margin-bottom: 26px; }
.search-field { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(251, 248, 240, .72); }
.search-field svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; }
.filter-chip { min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.filter-chip[aria-pressed="true"] { background: var(--ink); color: white; border-color: var(--ink); }
select { min-height: 48px; padding: 0 38px 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); color: var(--ink); }

.font-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.font-card { min-width: 0; display: flex; flex-direction: column; min-height: 430px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: rgba(251, 248, 240, .84); box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.font-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(36,31,26,.28); }
.preview-frame { min-height: 185px; display: grid; place-items: center; padding: 26px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg, rgba(229,87,47,.09), rgba(97,115,101,.05)); }
.preview-frame img { display: block; width: 100%; max-width: 530px; max-height: 150px; object-fit: contain; }
.font-card-body { flex: 1; display: flex; flex-direction: column; padding: 23px; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.license-pill { color: var(--sage); font-weight: 750; }
.font-card h3 { margin-bottom: 5px; font-family: ui-serif, "Songti SC", serif; font-size: 27px; letter-spacing: -.035em; }
.english-name { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.font-summary { flex: 1; color: var(--muted); line-height: 1.65; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; padding: 0; list-style: none; }
.tag-list li { padding: 5px 9px; border-radius: 7px; background: var(--paper-deep); color: #625a51; font-size: 11px; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.card-actions a, .card-actions button { min-height: 43px; border-radius: 11px; font-weight: 700; cursor: pointer; }
.card-actions a { display: grid; place-items: center; background: var(--ink); color: white; text-decoration: none; }
.card-actions button { padding: 0 14px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.state-card { margin: 30px 0; padding: 42px; text-align: center; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); }
.state-card p:last-child { margin-bottom: 0; }
.loader { display: inline-block; width: 24px; height: 24px; margin-bottom: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.integration { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .86fr); gap: clamp(35px, 8vw, 100px); align-items: center; }
.integration-copy > p:not(.eyebrow) { margin-top: 22px; color: var(--muted); line-height: 1.75; }
.feature-list { display: grid; gap: 12px; padding: 0; list-style: none; }
.feature-list li { padding-left: 24px; position: relative; line-height: 1.55; }
.feature-list li::before { content: "↗"; position: absolute; left: 0; color: var(--accent); }
.code-panel { overflow: hidden; border-radius: 20px; background: #27231f; color: #eee8dc; box-shadow: var(--shadow); }
.code-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 17px; border-bottom: 1px solid rgba(255,255,255,.12); color: #d0c6b6; font-size: 12px; }
.code-panel-header span { color: #ff9a74; font-weight: 800; }
.code-panel-header button { border: 0; background: transparent; color: #d0c6b6; cursor: pointer; }
.code-panel > code { display: block; overflow-x: auto; padding: 18px; color: #ffb496; font-size: 13px; }
.code-panel pre { overflow-x: auto; margin: 0; padding: 4px 18px 22px; color: #d8d2c8; line-height: 1.7; font-size: 12px; }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.principle-grid article { padding: 28px 26px 18px 0; border-bottom: 1px solid var(--line); }
.principle-grid article + article { padding-left: 26px; border-left: 1px solid var(--line); }
.principle-grid span { color: var(--accent); font-size: 12px; }
.principle-grid h3 { margin: 18px 0 10px; font-size: 20px; }
.principle-grid p { color: var(--muted); line-height: 1.65; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; max-width: 1240px; margin: 0 auto; padding: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0; }
.site-footer div { display: flex; gap: 18px; }

dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 40px 120px rgba(25,19,14,.28); }
dialog::backdrop { background: rgba(36,31,26,.58); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 16px; top: 14px; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); cursor: pointer; font-size: 25px; }
.dialog-body { padding: 46px 38px 36px; }
.dialog-kicker { margin-bottom: 8px; color: var(--accent-dark); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.dialog-body > p { color: var(--muted); line-height: 1.65; }
.try-field { display: grid; gap: 8px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.try-field textarea { width: 100%; resize: vertical; min-height: 128px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font-size: 38px; line-height: 1.35; outline: none; }
.try-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229,87,47,.1); }
.font-load-status { min-height: 24px; padding-top: 7px; color: var(--muted); font-size: 12px; }
.dialog-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.dialog-files { display: grid; gap: 7px; margin-top: 16px; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.file-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row a, .file-row button { border: 0; background: transparent; color: var(--accent-dark); text-decoration: none; cursor: pointer; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 999px; background: var(--ink); color: white; font-size: 13px; transition: .2s ease; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 900px) {
  .hero, .integration { grid-template-columns: 1fr; }
  .hero { gap: 48px; }
  .filters { grid-template-columns: 1fr; }
  .font-grid { grid-template-columns: 1fr; }
  .principle-grid { grid-template-columns: 1fr; }
  .principle-grid article + article { padding-left: 0; border-left: 0; }
}

@media (max-width: 600px) {
  .site-header, main, .site-footer { padding-left: 18px; padding-right: 18px; }
  .header-actions a { display: none; }
  .hero { padding-top: 64px; }
  h1 { font-size: clamp(47px, 15vw, 72px); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter-chip { flex: 0 0 auto; }
  .font-card { min-height: 390px; }
  .preview-frame { min-height: 150px; }
  .integration { grid-template-columns: minmax(0, 1fr); }
  .code-panel { min-width: 0; }
  .site-footer { flex-direction: column; }
  .dialog-body { padding: 54px 20px 24px; }
  .try-field textarea { font-size: 30px; }
  .dialog-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
