:root {
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6e6e73;
  --accent: #0a84ff;
  --card: #f5f5f7;
  --max-width: 900px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --fg: #f5f5f7;
    --muted: #98989d;
    --card: #2c2c2e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

header, main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  text-align: center;
  padding-top: 3rem;
}

header h1 {
  font-size: 2.5rem;
  margin: 0.5rem 0 0.25rem;
}

.app-icon {
  width: 128px;
  height: 128px;
  border-radius: 28px; /* approximate the iOS squircle */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.tagline {
  color: var(--muted);
  font-size: 1.2rem;
  margin-top: 0;
}

.tagline-fr {
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
}

.release-badge {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

nav {
  margin: 1rem 0 0;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 0.75rem;
}

nav a:hover { text-decoration: underline; }

.buttons {
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Official Apple App Store badge: keep its aspect ratio, match button height */
.app-store-badge {
  display: inline-block;
  line-height: 0;
}
.app-store-badge img {
  height: 48px;
  width: auto;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.button.primary { background: var(--accent); color: #fff; }
.button.secondary { background: var(--card); color: var(--fg); }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 2.5rem 0;
  list-style: none;
}

.features li {
  background: var(--card);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.features h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.features p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.screenshots {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem 0 1.5rem;
  scroll-snap-type: x mandatory;
}

.screenshots img {
  height: 480px;
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  scroll-snap-align: center;
}

main h2 {
  margin-top: 2.5rem;
}

.release-notes {
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  background: var(--card);
}

.release-notes h2 {
  margin-top: 0;
}

.release-notes ul {
  margin-bottom: 0;
}

article {
  padding-bottom: 2rem;
}

footer {
  border-top: 1px solid var(--card);
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

footer a { color: var(--accent); text-decoration: none; }

.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;
}

.catalog-page {
  --max-width: 1380px;
}

.compact-header {
  padding-top: 1.5rem;
  text-align: left;
}

.compact-header h1 {
  margin-top: 1.5rem;
  font-size: 2rem;
}

.compact-header nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.compact-header nav a {
  margin: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-link img {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.catalog-notice {
  margin-top: 2rem;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.catalog-notice h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.catalog-notice p {
  margin: 0.4rem 0;
}

.catalog-summary {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--card);
  border-bottom: 1px solid var(--card);
}

.catalog-summary h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.catalog-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 1rem;
  margin: 0;
}

.catalog-summary dl div {
  min-width: 0;
}

.catalog-summary dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.catalog-summary dd {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

.catalog-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 1.5rem -0.5rem 0;
  padding: 0.75rem 0.5rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px);
}

.catalog-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(280px, 1fr);
  gap: 0.75rem;
  align-items: end;
}

.catalog-search,
.catalog-voice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  font-weight: 600;
}

.catalog-search input,
.catalog-voice select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--muted) 48%, transparent);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.catalog-search input:focus-visible,
.catalog-voice select:focus-visible,
.catalog-tabs button:focus-visible,
.catalog-report:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.catalog-tabs {
  display: flex;
  gap: 0;
  margin-top: 0.75rem;
  overflow-x: auto;
  border: 1px solid color-mix(in srgb, var(--muted) 38%, transparent);
  border-radius: 6px;
}

.catalog-tabs button {
  flex: 1 0 auto;
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.catalog-tabs button:last-child {
  border-right: 0;
}

.catalog-tabs button[aria-selected="true"] {
  background: var(--fg);
  color: var(--bg);
}

.catalog-results {
  margin: 0.85rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.catalog-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--card);
}

.catalog-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.catalog-table th,
.catalog-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--card);
  text-align: left;
  vertical-align: middle;
}

.catalog-table thead th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.catalog-table tbody th {
  width: 20%;
  font-weight: 400;
}

.catalog-entry-thai,
.catalog-synthesis,
.catalog-thai-context {
  display: block;
  font-size: 1.25rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.catalog-romanization,
.catalog-meaning,
.catalog-id,
.catalog-voice-label,
.catalog-revision {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.catalog-id,
.catalog-revision {
  overflow-wrap: anywhere;
}

.catalog-voice-label {
  font-weight: 600;
}

.catalog-table audio {
  display: block;
  width: 240px;
  height: 42px;
}

.catalog-report {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.catalog-report:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .catalog-summary dl {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .catalog-tools {
    margin-top: 1rem;
  }

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