:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #182039;
  background: #f7f8fc;
  --muted: #525d73;
  --line: #dfe4ee;
  --accent: #344bb6;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

.container {
  width: min(var(--container-max, 960px), calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 750;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 8px;
}

.catalog {
  flex: 1;
  padding-block: clamp(40px, 8vw, 92px) 64px;
}

h1 {
  margin: 0 0 clamp(24px, 4vw, 36px);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-card {
  --accent-app: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px rgb(24 32 57 / 6%), 0 2px 8px rgb(24 32 57 / 4%);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 4px;
  background: var(--accent-app);
}

.app-card-diary { --art-bg: #e9edfb; --art-light: #f7f8ff; --accent-app: #3f5bd9; }
.app-card-renamer { --art-bg: #e1f1ea; --art-light: #f3fbf7; --accent-app: #1e9e6a; }
.app-card-ayubandhu { --art-bg: #f7e8da; --art-light: #fff9f3; --accent-app: #e07b2c; }
.app-card-meridian { --art-bg: #eee5f6; --art-light: #fbf6ff; --accent-app: #8a4fc4; }
.app-card-pdf { --art-bg: #dfe8ff; --art-light: #f5f8ff; --accent-app: #2f6df0; }

.app-card-gps { --art-bg: #dde8f0; --art-light: #f4f8fb; --accent-app: #3b6a96; }

.app-card-food { --art-bg: #fbe3d3; --art-light: #fff6f0; --accent-app: #d9561c; }

.app-card-gluco { --art-bg: #eadff2; --art-light: #f9f4fd; --accent-app: #6b2a7a; }

.app-card-flora { --art-bg: #e3efd6; --art-light: #f6fbf0; --accent-app: #4f8a2b; }

.app-card-travel { --art-bg: #fde8cc; --art-light: #fff8ee; --accent-app: #d97800; }

.app-card-crystal { --art-bg: #dde4f2; --art-light: #f4f6fc; --accent-app: #2f4a7a; }

.app-card-tidepool { --art-bg: #d6ecf5; --art-light: #f1fafd; --accent-app: #0c7d96; }

.app-card-pincode { --art-bg: #dcefe6; --art-light: #f3fbf7; --accent-app: #0b8f66; }

.app-art {
  display: grid;
  min-height: clamp(140px, 19vw, 188px);
  place-items: center;
  background:
    radial-gradient(rgb(24 32 57 / 7%) 1px, transparent 1px) 0 0 / 16px 16px,
    radial-gradient(ellipse at 50% 20%, var(--art-light), var(--art-bg));
  border-bottom: 1px solid var(--line);
}

.app-art img {
  display: block;
  border-radius: 22px;
  object-fit: contain;
  box-shadow: 0 1px 2px rgb(24 32 57 / 12%), 0 10px 24px rgb(24 32 57 / 16%);
  transition: transform 0.25s ease;
}

.app-card-copy {
  flex: 1;
  padding: 18px 20px 12px;
}

.app-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-app) 12%, #fff);
  color: var(--accent-app);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.app-tag + .app-tag {
  margin-left: 6px;
}

.app-card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.app-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.app-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 20px;
  padding: 14px 0 16px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.app-platform {
  color: var(--muted);
}

.app-card-cta {
  color: var(--accent-app);
  font-weight: 650;
}

.app-card-cta span {
  display: inline-block;
  transition: transform 0.2s ease;
}

.app-card:hover,
.app-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent-app) 45%, var(--line));
  box-shadow: 0 2px 4px rgb(24 32 57 / 8%), 0 14px 32px rgb(24 32 57 / 14%);
  transform: translateY(-3px);
}

.app-card:hover .app-art img {
  transform: scale(1.05);
}

.app-card:hover .app-card-cta span {
  transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
  .app-card,
  .app-art img,
  .app-card-cta span {
    transition: none;
  }

  .app-card:hover,
  .app-card:hover .app-art img,
  .app-card:hover .app-card-cta span {
    transform: none;
  }
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site-footer,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.site-footer {
  justify-content: space-between;
  padding-block: 20px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-links a {
  color: inherit;
  text-underline-offset: 3px;
}

.app-detail {
  flex: 1;
  padding-block: clamp(32px, 6vw, 68px);
}

.app-back {
  color: var(--accent);
  text-underline-offset: 3px;
}

.app-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  align-items: start;
  gap: clamp(24px, 6vw, 64px);
  margin-top: 24px;
}

.app-detail-logo {
  display: block;
  margin-bottom: 20px;
  border-radius: 20px;
}

.app-detail h1 {
  margin-bottom: 16px;
}

.app-detail h2 {
  margin: 32px 0 12px;
  font-size: 1.25rem;
}

.app-detail p,
.app-detail li,
.app-preview figcaption {
  color: var(--muted);
  line-height: 1.55;
}

.app-detail ul {
  padding-inline-start: 20px;
}

.app-detail li + li {
  margin-top: 8px;
}

.app-preview {
  width: min(100%, 320px);
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
}

.app-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.app-preview figcaption {
  margin-top: 12px;
  font-size: 0.875rem;
}

@media (max-width: 720px) {
  .app-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .container {
    width: calc(100% - 32px);
  }

  .app-card p {
    font-size: 0.875rem;
  }
}

.directory-page {
  --container-max: 1600px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-search {
  position: relative;
  max-width: 520px;
  margin: 0 0 clamp(20px, 3vw, 28px);
}

.app-search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.app-search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: inherit;
  font: inherit;
  box-shadow: 0 1px 2px rgb(24 32 57 / 6%);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(52 75 182 / 18%);
  outline: none;
}

.app-grid > li[hidden],
.search-empty[hidden] {
  display: none;
}

.search-empty {
  margin: 24px 0 0;
  color: var(--muted);
}

/* ---------- Compact directory tiles ---------- */
.directory-page .catalog {
  padding-block: clamp(20px, 4vw, 40px) 40px;
}

.directory-page h1 {
  margin-bottom: 16px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.directory-page .site-header .header-inner {
  min-height: 56px;
}

.directory-page .app-search {
  margin-bottom: 16px;
}

.directory-page .app-search input {
  height: 42px;
}

.directory-page .app-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.directory-page .app-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: 16px;
}

.directory-page .app-card::before {
  inset: 0 auto 0 0;
  width: 4px;
  height: auto;
}

.directory-page .app-art {
  min-height: 0;
  background: none;
  border: 0;
}

.directory-page .app-art img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgb(24 32 57 / 12%), 0 4px 10px rgb(24 32 57 / 14%);
}

.directory-page .app-card-copy {
  padding: 0;
  min-width: 0;
}

.directory-page .app-tag {
  margin-bottom: 4px;
  padding: 1px 8px;
  font-size: 0.7rem;
}

.directory-page .app-card h2 {
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.directory-page .app-card p {
  font-size: 0.875rem;
  line-height: 1.35;
}

.directory-page .app-card-foot {
  margin: 0;
  padding: 0;
  border: 0;
}

.directory-page .app-platform {
  display: none;
}

.directory-page .app-card-cta {
  font-size: 0;
}

.directory-page .app-card-cta span {
  font-size: 1.25rem;
}

@media (max-width: 560px) {
  .directory-page .app-grid {
    gap: 8px;
  }

  .directory-page .app-card {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 10px 12px 10px 10px;
  }

  .directory-page .app-art img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .directory-page .app-card:hover {
    transform: none;
  }
}

/* Title lives in the header */
.directory-page .header-inner {
  justify-content: space-between;
  gap: 16px;
}

.directory-page .header-inner h1 {
  margin: 0;
  font-size: clamp(0.95rem, 2.5vw, 1.25rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-align: right;
}

.directory-page .site-footer {
  margin-top: auto;
  padding-block: 14px;
}

.directory-page .header-inner h1 {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.directory-page .app-search {
  margin-inline: auto;
}

.directory-page .site-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: #f7f8fc;
}

/* Title bar: deep purple to deep red */
.directory-page .site-header {
  background: linear-gradient(90deg, #3b0a6b, #8a0f2a);
  border-bottom: 0;
  color: #fff;
}

.directory-page .site-header .brand,
.directory-page .site-header .header-inner h1 {
  color: #fff;
}

/* Footer: slim, black at 30% transparency, full width */
.directory-page .site-footer {
  width: 100%;
  margin-inline: 0;
  padding: 6px max(20px, calc((100% - var(--container-max)) / 2 + 20px));
  border-top: 0;
  background: rgb(0 0 0 / 70%);
  color: rgb(255 255 255 / 80%);
  font-size: 0.75rem;
  line-height: 1.2;
}

.directory-page .site-footer,
.directory-page .footer-links {
  gap: 4px 16px;
}

.directory-page .site-footer a:hover {
  color: #fff;
}

.directory-page .site-footer {
  background: rgb(59 10 107 / 70%);
}

.directory-page .footer-links a {
  text-decoration: none;
}

.directory-page .site-footer {
  padding-block: 8.5px;
  background: rgb(26 4 48 / 70%);
}

.directory-page .site-footer {
  background: #000;
}

.directory-page .app-card h2 {
  font-size: 0.95rem;
}

/* Description spans the full card, below the icon row */
.directory-page .app-card {
  row-gap: 8px;
}

.directory-page .app-card .app-desc {
  grid-column: 1 / -1;
}

/* Tags sit below the title */
.directory-page .app-card h2 {
  margin-bottom: 4px;
}

.directory-page .app-tag {
  margin: 0;
}

.directory-page .app-tag + .app-tag {
  margin-left: 4px;
}

/* One accent color for every card */
.directory-page .app-card {
  --accent-app: #2f6fd8;
}

.directory-page .site-header .header-inner {
  min-height: 48px;
}
