:root {
  color-scheme: light;
  --ink: #181614;
  --muted: #6f6962;
  --paper: #f7f3ec;
  --surface: #fffdf8;
  --line: #ded7cc;
  --accent: #df4f2f;
  --accent-dark: #a4311d;
  --green: #295e4b;
  --shadow: 0 18px 50px rgba(42, 32, 22, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Noto Sans JP", sans-serif;
  line-height: 1.55;
}
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { position: fixed; z-index: 20; top: 12px; left: 12px; background: white; padding: 10px 14px; }

.site-header {
  min-height: 74px;
  padding: 14px clamp(20px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 236, .94);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: white; }
.beta { color: var(--accent-dark); font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
nav { display: flex; align-items: center; gap: 22px; }
nav > a { color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14px; }
nav > a:hover, nav > a:focus-visible { color: var(--ink); }
select { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 8px 30px 8px 12px; color: var(--ink); }

main { overflow: hidden; }
.hero {
  padding: clamp(72px, 11vw, 150px) clamp(20px, 8vw, 128px) clamp(64px, 9vw, 120px);
  position: relative;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 460px;
  height: 460px;
  border-radius: 48% 52% 61% 39%;
  background: #f1c6ad;
  filter: blur(2px);
  opacity: .55;
  top: -180px;
  right: -90px;
  transform: rotate(16deg);
}
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { line-height: 1.12; }
h1 { max-width: 900px; margin: 0; font-size: clamp(44px, 7vw, 96px); letter-spacing: -.065em; font-weight: 850; }
.hero-copy { max-width: 690px; margin: 28px 0 34px; color: var(--muted); font-size: clamp(17px, 2vw, 22px); }
.search { display: flex; max-width: 760px; border: 1px solid var(--line); border-radius: 18px; padding: 7px; background: var(--surface); box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 15px 17px; color: var(--ink); outline: none; }
.search button { border: 0; border-radius: 12px; padding: 0 24px; background: var(--accent); color: white; font-weight: 800; }
.search button:hover, .search button:focus-visible { background: var(--accent-dark); }
.hero-meta { display: flex; gap: 12px; align-items: baseline; max-width: 760px; margin-top: 18px; color: var(--muted); font-size: 13px; }
#avatar-count { flex: 0 0 auto; color: var(--green); font-weight: 850; font-size: 15px; }

.catalog { padding: 72px clamp(20px, 5vw, 76px) 100px; background: var(--surface); border-block: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
h2 { margin: 0; font-size: clamp(30px, 4vw, 54px); letter-spacing: -.045em; }
.api-link { color: var(--accent-dark); font-weight: 750; text-underline-offset: 4px; }
.status { min-height: 30px; margin: 12px 0; color: var(--muted); }
.status.error { color: #a11f1f; }
.avatar-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.avatar-card { min-width: 0; }
.avatar-card a {
  min-height: 140px;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbf8f2;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.avatar-card a:hover, .avatar-card a:focus-visible { transform: translateY(-3px); border-color: #baaa98; box-shadow: 0 12px 28px rgba(42, 32, 22, .08); }
.avatar-name { font-size: 21px; font-weight: 800; letter-spacing: -.025em; overflow-wrap: anywhere; }
.avatar-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.seed-badge { color: var(--accent-dark); font-weight: 750; }
.pagination { display: grid; place-items: center; margin-top: 34px; }
.secondary-button { border: 1px solid var(--ink); border-radius: 999px; padding: 11px 22px; background: transparent; color: var(--ink); font-weight: 750; }
.secondary-button:hover, .secondary-button:focus-visible { background: var(--ink); color: white; }

.principles { padding: 96px clamp(20px, 7vw, 110px) 120px; }
.principles > h2 { max-width: 800px; }
.principle-grid { margin-top: 42px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.principle-grid article { min-height: 250px; padding: 25px; background: var(--paper); }
.principle-grid span { color: var(--accent-dark); font-weight: 850; }
.principle-grid h3 { margin: 50px 0 10px; font-size: 22px; }
.principle-grid p { color: var(--muted); }

footer { padding: 36px clamp(20px, 5vw, 76px); display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer p { margin: 0 0 6px; }
.footer-links { text-align: right; }
[dir="rtl"] body { font-family: "Noto Sans Arabic", Tahoma, Arial, sans-serif; }
[dir="rtl"] .footer-links { text-align: left; }

@media (max-width: 960px) {
  .avatar-grid, .principle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  nav > a { display: none; }
  footer { flex-direction: column; }
  .footer-links { text-align: left; }
}

@media (max-width: 560px) {
  .site-header { padding-inline: 16px; }
  .beta { display: none; }
  .hero { padding-inline: 18px; }
  h1 { font-size: clamp(42px, 14vw, 66px); }
  .search { flex-direction: column; }
  .search button { min-height: 48px; }
  .hero-meta { align-items: flex-start; flex-direction: column; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .avatar-grid, .principle-grid { grid-template-columns: 1fr; }
  .catalog { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
