:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #fdfdfd;
  --card-foreground: #0a0a0a;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --muted: #eeeeee;
  --muted-foreground: #737373;
  --accent: #eeeeee;
  --border: #eeeeee;
  --input: #f5f5f5;
  --ring: #a1a1a1;
  --radius: 1rem;
  --control-radius: 999px;
  --font-sans: "DM Sans", ui-sans-serif, sans-serif, system-ui;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --preview-paper: #ffffff;
  --preview-dark-paper: #111111;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #171717;
  --foreground: #fafafa;
  --card: #0f0f0f;
  --card-foreground: #fafafa;
  --primary: #e5e5e5;
  --primary-foreground: #171717;
  --muted: #262626;
  --muted-foreground: #a1a1a1;
  --accent: #404040;
  --border: #262626;
  --input: #262626;
  --ring: #737373;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 360px;
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

button,
input,
select {
  font: inherit;
}

button,
select,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

.masthead,
main,
.site-footer {
  width: min(1200px, calc(100% - 64px));
  margin-inline: auto;
}

.masthead {
  display: grid;
  gap: 20px;
  padding: 28px 0 20px;
}

.masthead__copy {
  min-width: 0;
  display: grid;
  grid-template-rows: 2.5rem 2.75rem;
  align-content: start;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.masthead__heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.masthead__title-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.intro {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.55;
}

.last-updated {
  margin-left: auto;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  line-height: inherit;
  text-decoration: none;
}

.maker-link {
  display: inline-flex;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--input);
  border-radius: var(--control-radius);
  padding: 0 14px;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  text-decoration: none;
  box-shadow: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.maker-link:hover,
.maker-link:focus-visible {
  border-color: var(--primary);
  background: var(--muted);
}

.masthead__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
  white-space: nowrap;
}


.locale-switcher,
.theme-switcher {
  display: inline-grid;
  height: 40px;
  flex: none;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: stretch;
  gap: 0;
  border: 0;
  border-radius: 999px;
  padding: 4px;
  background: var(--muted);
  box-shadow: none;
  overflow: visible;
  white-space: nowrap;
}

.locale-switcher button,
.theme-switcher button {
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.locale-switcher button:hover,
.theme-switcher button:hover {
  color: var(--foreground);
}

.locale-switcher button[aria-pressed="true"],
.theme-switcher button[aria-pressed="true"] {
  background: var(--background);
  color: var(--foreground);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.maker-link:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(161 161 161 / 0.2);
}

.maker-link:focus-visible {
  outline: none;
}

.locale-switcher button:focus-visible,
.theme-switcher button:focus-visible {
  outline: none;
}

main {
  padding: 0 0 48px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}
.toolbar > * {
  min-width: 0;
}

.search-field {
  grid-column: 1 / -1;
}

.toolbar > label:not(.search-field),
.preview-size-field {
  grid-column: span 4;
}

.device-option-field {
  grid-column: span 6;
}


.toolbar label,
.preview-size-field,
.device-option-field {
  display: grid;
  gap: 8px;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}

.toolbar input,
.toolbar select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--input);
  border-radius: var(--control-radius);
  padding: 0 12px;
  outline: none;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  appearance: none;
  font-size: 0.875rem;
  line-height: 1.25rem;
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.toolbar select {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%), linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.toolbar input::placeholder {
  color: var(--muted-foreground);
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(161 161 161 / 0.2);
}

.preview-size-switch,
.option-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  height: 40px;
  gap: 0;
  border-radius: 999px;
  padding: 4px;
  border: 0;
  background: var(--muted);
  box-shadow: none;
  overflow: visible;
}
.preview-size-switch button,
.option-switch button {
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.preview-size-switch button:hover,
.option-switch button:hover {
  color: var(--foreground);
}

.preview-size-switch button[aria-pressed="true"],
.option-switch button[aria-pressed="true"] {
  background: var(--background);
  color: var(--foreground);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.preview-size-switch button:focus-visible,
.option-switch button:focus-visible {
  outline: none;
}

.option-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-option-field--compact {
  display: block;
  flex: none;
}

.device-option-field--compact .option-switch {
  width: auto;
  min-width: 128px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.status {
  min-height: 1.25rem;
  margin: 20px 2px 12px;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.font-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}

.tags {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.font-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.family-id {
  margin: 3px 0 0;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.description {
  display: -webkit-box;
  min-height: calc(2 * 1.45em);
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.device-preview {
  --device-shell-bg: #101013;
  --device-shell-border: #2c2c31;
  --device-bezel-bg: #060607;
  --device-controls-bg: #161618;
  --device-controls-border: rgb(170 170 175 / 0.22);
  --device-groove-bg: #313136;
  --device-side-key-bg: #37373d;
  --device-shell-shadow:
    0 14px 28px rgb(0 0 0 / 0.5),
    inset 0 1px 0 rgb(255 255 255 / 0.06);
  position: relative;
  width: min(100%, 250px);
  margin: 18px auto 16px;
  border: 1px solid var(--device-shell-border);
  border-radius: 14px;
  padding: 11px 14px 0 9px;
  background: var(--device-shell-bg);
  box-shadow: var(--device-shell-shadow);
}

.device-frame {
  position: relative;
  min-width: 0;
  border-radius: 9px;
  padding: 7px 5px 43px;
}

.device-bezel {
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  padding: 1px;
  background: var(--device-bezel-bg);
}

.preview-frame {
  display: flex;
  width: 100%;
  aspect-ratio: 480 / 800;
  min-height: 0;
  align-items: flex-start;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: var(--preview-paper);
}

.preview-frame.preview-frame--dark {
  background: var(--preview-dark-paper);
}

.preview {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  object-fit: contain;
  object-position: top;
}

.preview.preview--light {
  filter: invert(1);
}

.preview.is-broken {
  visibility: hidden;
  min-height: 80px;
}

.device-bottom-controls {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: flex;
  width: 80%;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--device-controls-border);
  border-radius: 6px 6px 0 0;
  padding: 5px 6px 3px;
  background: var(--device-controls-bg);
  transform: translateX(-50%);
}

.device-bottom-controls span {
  flex: 0 0 47%;
  height: 8px;
  border-radius: 3px;
  background: var(--device-groove-bg);
}

.device-side-key {
  position: absolute;
  right: -4px;
  width: 4px;
  border-radius: 0 1px 1px 0;
  background: var(--device-side-key-bg);
}
:root[data-theme="dark"] .device-preview:not(.device-preview--silver) {
  --device-shell-border: #4a4a52;
  --device-shell-shadow:
    0 14px 28px rgb(0 0 0 / 0.56),
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    0 0 0 1px rgb(255 255 255 / 0.04);
}

.device-preview--silver {
  --device-shell-bg: #d3d3d3;
  --device-shell-border: #acacac;
  --device-bezel-bg: #bbbbbb;
  --device-controls-bg: #c3c3c3;
  --device-controls-border: rgb(93 93 93 / 0.28);
  --device-groove-bg: #a0a0a0;
  --device-side-key-bg: #a9a9a9;
  --device-shell-shadow:
    0 10px 24px rgb(70 70 70 / 0.18),
    inset 0 1px 0 rgb(255 255 255 / 0.74);
}
.device-side-key--top { top: 15%; height: 32px; }
.device-side-key--middle { top: 43%; height: 76px; }
.device-side-key--bottom { top: 77%; height: 26px; }

.device-preview-meta {
  margin: -6px 0 12px;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  text-align: center;
}

.downloads {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
}

.downloads .ui-font-badge {
  grid-column: span 2;
}

.downloads a {
  grid-column: span 1;
}

.downloads a,
.ui-font-badge {
  display: inline-flex;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 8px);
  padding: 4px 2px;
  text-align: center;
  text-decoration: none;
  font-size: 0.75rem;
  line-height: 1.2;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.downloads a:hover,
.downloads a:focus-visible,
.ui-font-badge:hover,
.ui-font-badge:focus-visible {
  border-color: var(--primary);
  background: var(--muted);
}

.font-card footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-align: center;
}

.font-card footer a:hover,
.font-card footer a:focus-visible {
  color: var(--foreground);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 24px;
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.site-footer p {
  grid-column: 1 / -1;
  margin: 0;
}

#manifest-link {
  justify-self: start;
}

#last-updated {
  justify-self: end;
}
.github-link {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 6px;
  text-decoration: none;
}

.github-link svg {
  width: 24px;
  height: 24px;
  flex: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--foreground);
}


.back-to-top {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0;
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12), var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  cursor: pointer;
  pointer-events: none;
  transition: opacity 150ms ease, visibility 150ms ease, transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--primary);
  background: var(--muted);
}

.back-to-top:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgb(161 161 161 / 0.2), 0 8px 24px rgb(0 0 0 / 0.12);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition-duration: 0.01ms;
  }
}

@media (max-width: 1024px) {
  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .masthead,
  main,
  .site-footer {
    width: min(100% - 32px, 1200px);
  }

  .masthead {
    gap: 14px;
    padding-top: 24px;
  }

  .masthead__copy {
    grid-template-rows: auto;
  }

  .masthead__heading {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-content: stretch;
  }

  .masthead__title-actions {
    width: 100%;
    justify-content: space-between;
  }

  .masthead__actions {
    width: 100%;
    justify-content: center;
  }

  .toolbar > label:not(.search-field),
  .preview-size-field {
    grid-column: span 6;
  }

  .device-option-field {
    grid-column: span 6;
  }

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .masthead,
  main,
  .site-footer {
    width: min(100% - 16px, 1200px);
  }
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }


  .masthead {
    display: grid;
    gap: 14px;
    padding: 14px 0 16px;
  }

  .masthead__heading {
    align-items: start;
  }

  .masthead__actions {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .maker-link {
    height: 36px;
    padding-inline: 12px;
    font-size: 0.8125rem;
  }

  .locale-switcher,
  .theme-switcher {
    min-width: 0;
    max-width: 100%;
  }

  .locale-switcher button,
  .theme-switcher button {
    padding-inline: 8px;
  }


  .option-switch button {
    padding-inline: 7px;
  }

  .toolbar {
    padding: 14px;
  }

  .toolbar > label:not(.search-field),
  .preview-size-field,
  .device-option-field {
    grid-column: 1 / -1;
  }

  .search-field {
    grid-column: 1 / -1;
  }

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

  .font-card {
    padding: 16px;
  }

  .font-card__heading {
    min-width: 0;
  }

  .description {
    overflow-wrap: anywhere;
  }
