@layer base, layout, components;

@layer base {
  :root { color-scheme: light; --ink: #202232; --muted: #6c6f7f; --line: #e6e7ee; --violet: #6654cb; --violet-light: #f0edff; --background: #fafafb; --radius: 14px; }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--background); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
  a { color: inherit; text-decoration: none; }
  button, input { font: inherit; }
  button, a, input { -webkit-tap-highlight-color: transparent; }
  button, input[type="search"] { appearance: none; }
  button { cursor: pointer; }
  button:disabled { cursor: default; }
  :focus-visible { outline: 3px solid #9484e8; outline-offset: 4px; }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
  code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
  code { font-size: .87em; }
  [hidden] { display: none !important; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip-link { position: absolute; top: 12px; left: 12px; z-index: 20; transform: translateY(-200%); padding: 10px 16px; background: white; border: 2px solid var(--violet); border-radius: 8px; }
  .skip-link:focus { transform: translateY(0); }
  .icon { width: 28px; height: 28px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.45; stroke-linejoin: round; stroke-linecap: round; }
  .accent { color: var(--violet); }
  .muted { color: var(--muted); }
}

@layer layout {
  .site-header { height: 84px; background: #fff; border-bottom: 1px solid var(--line); }
  .header-inner, .main, .site-footer { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
  .header-inner { height: 100%; display: flex; align-items: center; gap: 44px; }
  .brand { display: inline-flex; gap: 10px; align-items: center; font-size: 23px; font-weight: 700; letter-spacing: -.06em; }
  .brand .icon { width: 34px; height: 34px; color: var(--violet); }
  .brand-by { border-left: 1px solid var(--line); margin-left: 8px; padding-left: 16px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
  .main-nav { height: 100%; display: flex; align-items: center; gap: 28px; font-size: 13px; color: var(--muted); }
  .main-nav a { position: relative; display: flex; align-items: center; height: 100%; }
  .main-nav a[aria-current] { color: var(--ink); font-weight: 600; }
  .main-nav a[aria-current]::after { content: ""; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: var(--violet); }
  .lattis-link { margin-left: auto; font-size: 13px; color: var(--muted); }
  .lattis-link span { margin-left: 12px; }
  .hero { padding: 77px 0 49px; }
  .eyebrow { font-size: 10px; font-weight: 650; letter-spacing: .14em; display: flex; gap: 9px; align-items: center; color: var(--violet); }
  .status-dot { width: 6px; height: 6px; display: inline-block; background: #7d6cdd; border-radius: 50%; flex-shrink: 0; }
  .hero h1, .about-hero h1 { font-size: clamp(40px, 5vw, 62px); font-weight: 550; line-height: 1.08; letter-spacing: -.065em; margin: 20px 0; }
  .hero-description { font-size: 15px; color: var(--muted); line-height: 1.8; }
  .hero-notes { display: flex; gap: 28px; margin-top: 20px; color: var(--muted); font-size: 11px; }
  .hero-notes > span { display: flex; align-items: center; gap: 7px; }
  .hero-notes .icon { width: 17px; height: 17px; color: #8a83ac; }
  .catalog-section { margin-bottom: 54px; }
  .catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
  .results-count { font-size: 11px; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
  .package-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .site-footer { display: flex; align-items: center; gap: 24px; padding: 34px 0; border-top: 1px solid var(--line); margin-top: 62px; color: var(--muted); font-size: 11px; }
  .footer-brand { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 650; color: var(--ink); }
  .footer-brand .icon { width: 23px; height: 23px; color: #8c86a4; }
  .site-footer nav { display: flex; gap: 24px; margin-left: auto; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 54px; align-items: start; }
  .detail-main, .detail-aside { min-width: 0; }
  .about-hero { padding: 80px 0 40px; }
  .about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 900px; }
}

@layer components {
  a:hover { color: var(--violet); }
  .search-form { display: flex; align-items: center; gap: 14px; max-width: 690px; padding: 8px 8px 8px 18px; background: #fff; border: 1px solid #dedee9; border-radius: 10px; margin-top: 30px; box-shadow: 0 3px 8px #25243c04; }
  .search-form:focus-within { border-color: #a79ce1; }
  .search-form > svg { width: 19px; height: 19px; flex-shrink: 0; stroke: #9b98ab; stroke-width: 1.5; stroke-linecap: round; }
  .search-form input[type="search"] { min-width: 0; width: 100%; border: 0; color: var(--ink); background: transparent; outline-offset: 2px; font-size: 13px; padding: 8px 0; }
  .search-form input::placeholder { color: #898694; }
  .search-form button { display: flex; gap: 20px; flex-shrink: 0; align-items: center; border: 0; border-radius: 6px; background: var(--violet); color: #fff; font-size: 12px; padding: 10px 14px; }
  .search-form button:hover, .button.primary:hover { background: #5140b4; color: #fff; }
  .catalog-tabs { display: flex; align-items: stretch; gap: 24px; }
  .catalog-tabs a { display: flex; gap: 8px; align-items: center; padding: 14px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: 12px; white-space: nowrap; }
  .catalog-tabs a[aria-current] { border-bottom-color: var(--violet); color: var(--ink); font-weight: 600; }
  .catalog-tabs a > span { display: inline-flex; justify-content: center; align-items: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 4px; background: #eeedf2; font-size: 10px; font-weight: 400; }
  .catalog-tabs a[aria-current] > span { background: var(--violet-light); color: var(--violet); }
  .package-card { position: relative; display: flex; flex-direction: column; min-height: 254px; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
  .package-card:hover, .package-card:focus-within { border-color: #b9b0e2; box-shadow: 0 6px 18px #4c407608; }
  .card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
  .package-icon { display: inline-flex; justify-content: center; align-items: center; width: 44px; height: 44px; border-radius: 11px; color: var(--violet); background: var(--violet-light); border: 1px solid #e9e3ff; }
  .package-icon.shard { color: #3b7c79; background: #edf6f4; border-color: #dceee9; }
  .package-icon .icon { width: 26px; height: 26px; }
  .package-card h2 { font-size: 15px; font-weight: 650; letter-spacing: -.025em; overflow-wrap: anywhere; }
  .package-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
  .package-description { font-size: 12px; color: var(--muted); margin-top: 9px; margin-bottom: 20px; line-height: 1.75; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
  .badge { display: inline-flex; align-items: center; gap: 4px; color: #777181; font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--line); background: #fafafb; }
  .badge .icon { width: 12px; height: 12px; stroke-width: 1.7; }
  .card-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: auto; font-size: 11px; }
  .card-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .version { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; color: #85808e; white-space: nowrap; }
  .card-foot { border-top: 1px solid #f0eff4; padding-top: 12px; margin-top: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: #85808e; font-size: 10px; }
  .card-foot > span { overflow-wrap: anywhere; }
  .empty-state { text-align: center; padding: 65px 24px; border: 1px dashed #dcd9e6; border-radius: var(--radius); background: #fff; }
  .empty-icon { display: inline-flex; justify-content: center; align-items: center; width: 64px; height: 64px; border: 1px solid #e7e1fa; border-radius: 18px; background: #f5f2fe; color: #8b7ccc; margin-bottom: 20px; }
  .empty-icon .icon { width: 35px; height: 35px; }
  .empty-state h2 { font-size: 22px; font-weight: 550; margin-bottom: 10px; }
  .empty-state p { color: var(--muted); font-size: 13px; max-width: 440px; margin: 0 auto 22px; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 40px; padding: 9px 16px; border-radius: 7px; font-size: 12px; font-weight: 550; border: 1px solid transparent; }
  .button.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
  .button.secondary:hover { border-color: #c3b9e7; color: var(--violet); }
  .button.primary { background: var(--violet); color: white; }
  .pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; margin-top: 28px; color: var(--muted); font-size: 12px; }
  .pagination > a { justify-self: start; }
  .pagination > a:last-child { justify-self: end; }
  .catalog-note { display: flex; align-items: center; gap: 20px; padding: 24px 28px; background: #f1eff7; border: 1px solid #e9e5f3; border-radius: 12px; }
  .note-icon { color: #8b7db9; display: flex; }
  .note-icon .icon { width: 34px; height: 34px; }
  .catalog-note strong { font-size: 12px; font-weight: 600; }
  .catalog-note p { max-width: 680px; font-size: 11px; color: #787187; margin-top: 3px; }
  .catalog-note > a { font-size: 11px; white-space: nowrap; color: #716098; margin-left: auto; }
  .back-link { display: inline-flex; font-size: 12px; color: var(--muted); margin-top: 38px; }
  .package-header { display: flex; gap: 23px; align-items: center; margin: 34px 0 42px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
  .package-icon.large { width: 78px; height: 78px; border-radius: 20px; flex-shrink: 0; }
  .package-icon.large .icon { width: 44px; height: 44px; }
  .package-header h1 { font-size: clamp(25px, 3vw, 35px); letter-spacing: -.05em; margin: 10px 0 8px; overflow-wrap: anywhere; }
  .package-header p { font-size: 12px; color: var(--muted); }
  .package-header strong { font-weight: 500; color: var(--ink); }
  .availability { margin-left: auto; font-size: 11px; display: flex; align-items: center; gap: 7px; color: #5b7b6d; white-space: nowrap; }
  .availability .status-dot { background: #77a58f; }
  .detail-section { margin-bottom: 34px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
  .detail-section > h2 { font-size: 19px; font-weight: 600; margin-bottom: 18px; }
  .detail-section h3 { font-size: 13px; font-weight: 600; margin: 27px 0 12px; }
  .overview-text { color: #646373; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
  .detail-section > .muted { font-size: 12px; }
  .heading-count { font-size: 11px; color: var(--muted); padding: 2px 6px; background: #eeedf2; border-radius: 4px; vertical-align: middle; margin-left: 5px; }
  .tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
  .tags li { font-size: 11px; padding: 4px 9px; background: #f0edf8; border-radius: 4px; color: #75658f; overflow-wrap: anywhere; max-width: 100%; }
  .contract-list, .dependency-list, .version-list { list-style: none; padding: 0; margin: 0; }
  .contract-list > li, .dependency-list > li { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; padding: 11px 0; font-size: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .contract-list > li > span { font-size: 10px; color: var(--muted); flex-shrink: 0; }
  .dependency-list > li > code { color: var(--muted); }
  .version-list { margin-top: 12px; }
  .version-list a { display: flex; gap: 16px; align-items: center; padding: 13px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
  .version-list a[aria-current] { background: #f2effa; border-radius: 6px; }
  .version-list strong { font-size: 12px; font-weight: 550; overflow-wrap: anywhere; }
  .version-list time { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
  .selected-label { color: var(--violet); font-size: 10px; }
  .install-panel { padding: 23px; background: #fff; border: 1px solid #e1dced; border-radius: var(--radius); }
  .install-panel h2 { font-size: 17px; font-weight: 600; margin: 12px 0 8px; }
  .install-panel > p { color: var(--muted); font-size: 11px; }
  .install-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); background: #f8f7fb; border-radius: 7px; padding: 15px; margin: 18px 0 12px; font-size: 12px; color: #60527e; }
  .copy-button { width: 100%; background: var(--violet); color: #fff; }
  .copy-button:hover { background: #5140b4; }
  .install-panel .install-note { font-size: 10px; margin-top: 13px; line-height: 1.7; }
  .text-link { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 500; color: var(--violet); }
  .install-panel .text-link { margin-top: 18px; font-size: 11px; }
  .package-facts { padding: 24px 6px; font-size: 11px; }
  .package-facts dl { margin: 0; }
  .package-facts dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; }
  .package-facts dt { color: var(--muted); flex-shrink: 0; }
  .package-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
  .package-facts h3 { font-size: 11px; font-weight: 500; color: var(--muted); margin: 20px 0 9px; }
  .digest { display: block; overflow-wrap: anywhere; font-size: 10px; color: #797480; }
  .about-card { padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
  .about-card h2 { margin: 20px 0 12px; font-size: 24px; font-weight: 550; }
  .about-card p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
  .about-process { max-width: 750px; padding-top: 50px; }
  .about-process > h2 { font-size: 25px; font-weight: 550; }
  .about-process ol { padding-left: 22px; color: var(--violet); }
  .about-process li { margin: 26px 0; padding-left: 10px; }
  .about-process strong { font-size: 14px; font-weight: 550; color: var(--ink); }
  .about-process p { font-size: 13px; color: var(--muted); margin-top: 7px; }
  .problem-page { max-width: 660px; margin: 90px auto; text-align: center; }
  .problem-page .eyebrow { justify-content: center; margin-bottom: 15px; }
  .problem-page h1 { font-size: clamp(30px, 5vw, 42px); letter-spacing: -.05em; }
  .problem-page p { max-width: 470px; margin: 20px auto 26px; color: var(--muted); font-size: 14px; }
}

@media (min-width: 1440px) { .hero { padding-top: 90px; } }
@media (max-width: 1000px) {
  .header-inner, .main, .site-footer { width: calc(100% - 48px); }
  .package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { gap: 30px; grid-template-columns: minmax(0, 1fr) 300px; }
  .availability { display: none; }
  .catalog-note { align-items: flex-start; }
  .catalog-note > a { align-self: center; }
}
@media (max-width: 720px) {
  .site-header { height: 70px; }
  .header-inner { gap: 24px; }
  .brand { font-size: 21px; gap: 8px; }
  .brand-by, .lattis-link, .desktop-break { display: none; }
  .main-nav { margin-left: auto; font-size: 11px; gap: 20px; }
  .hero { padding-top: 50px; padding-bottom: 34px; }
  .hero h1, .about-hero h1 { font-size: 43px; }
  .hero-description { font-size: 13px; }
  .hero-notes { flex-direction: column; gap: 8px; }
  .catalog-toolbar { align-items: flex-start; flex-direction: column; gap: 4px; border-bottom: 0; }
  .catalog-tabs { width: 100%; gap: 22px; border-bottom: 1px solid var(--line); }
  .results-count { padding-top: 8px; text-align: left; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-aside { grid-row: 1; }
  .package-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
  .package-facts dl { grid-row: span 2; }
  .package-facts h3 { margin-top: 9px; }
  .catalog-note { flex-wrap: wrap; padding: 22px; }
  .catalog-note > div { flex: 1; }
  .catalog-note > a { width: 100%; margin-left: 54px; }
  .site-footer { flex-wrap: wrap; gap: 12px 20px; margin-top: 44px; }
  .site-footer nav { width: 100%; margin-left: 0; padding-top: 8px; }
  .about-hero { padding-top: 50px; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .header-inner, .main, .site-footer { width: calc(100% - 36px); }
  .package-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero h1, .about-hero h1 { font-size: 37px; }
  .search-form { gap: 10px; padding-left: 12px; }
  .search-form input[type="search"] { font-size: 16px; }
  .search-form button { padding-inline: 12px; }
  .search-form button > span { display: none; }
  .catalog-tabs { gap: 18px; }
  .catalog-tabs a { gap: 5px; font-size: 11px; }
  .package-header { gap: 15px; align-items: flex-start; margin-bottom: 28px; }
  .package-icon.large { width: 55px; height: 55px; border-radius: 12px; }
  .package-icon.large .icon { width: 32px; height: 32px; }
  .package-facts { display: block; }
  .pagination { gap: 8px; font-size: 11px; }
  .pagination .button { font-size: 11px; padding: 8px 10px; }
  .version-list a { gap: 8px; }
  .version-list time { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
