/* =========================================================
   Public software portal
   ========================================================= */

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header {
    background: var(--bg);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__text strong {
  font-size: 15px;
  font-weight: 700;
}

.brand__text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.nav-link:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 8px;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 85% 15%, rgba(37, 99, 235, .17), transparent 34%),
    radial-gradient(circle at 10% 100%, rgba(124, 58, 237, .1), transparent 38%),
    linear-gradient(135deg, var(--surface), var(--bg-soft));
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 85% 15%, rgba(96, 165, 250, .16), transparent 34%),
    radial-gradient(circle at 10% 100%, rgba(124, 58, 237, .12), transparent 38%),
    linear-gradient(135deg, var(--surface), #0d1730);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, .12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .12) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 72%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 72%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

.hero h1 {
  max-width: 620px;
  font-size: clamp(30px, 4.7vw, 46px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.14;
  text-wrap: balance;
}

.hero__desc {
  max-width: 540px;
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 16px);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.hero__pill .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* ---------- app grid ---------- */

.apps-section {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.section-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
  box-shadow: var(--shadow-md);
}

.app-card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.app-card__heading {
  flex: 1;
  min-width: 0;
}

.app-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-card__title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-card__slug {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .01em;
}

.app-card__version {
  flex: 0 0 auto;
}

.app-card__desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.app-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.app-card__meta .icon {
  width: 13px;
  height: 13px;
}

.notes {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12.5px;
}

.notes summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
}

.notes summary::-webkit-details-marker {
  display: none;
}

.notes summary::before {
  content: "＋";
  display: inline-block;
  width: 14px;
  color: var(--accent);
  font-weight: 700;
}

.notes[open] summary::before {
  content: "－";
}

.notes p {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition);
}

.download-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: var(--accent-soft-2);
  text-decoration: none;
}

.download-btn__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-btn__meta {
  color: color-mix(in srgb, var(--accent) 68%, var(--muted));
  font-size: 11px;
  font-weight: 600;
}

.download-btn.is-disabled {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

.download-btn .icon {
  width: 15px;
  height: 15px;
}

.download-empty {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- skeleton ---------- */

.app-card--skeleton {
  min-height: 212px;
}

.app-card--skeleton .skeleton {
  height: 12px;
}

.app-card--skeleton .skeleton.is-title {
  width: 62%;
  height: 18px;
}

.app-card--skeleton .skeleton.is-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.app-card--skeleton .skeleton.is-line {
  width: 100%;
}

.app-card--skeleton .skeleton.is-short {
  width: 48%;
}

.app-card--skeleton .skeleton.is-button {
  width: 112px;
  height: 32px;
}

/* ---------- password gate ---------- */

.gate-wrap {
  display: grid;
  place-items: center;
  min-height: 320px;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.gate-icon .icon {
  width: 23px;
  height: 23px;
}

.gate-card h2 {
  font-size: 19px;
  letter-spacing: -.02em;
}

.gate-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

.gate-form {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.gate-form .input {
  flex: 1;
  min-width: 0;
}

.gate-form .btn {
  flex: 0 0 auto;
}

.gate-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

/* ---------- empty / footer ---------- */

.app-grid .empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .site-header__inner,
  .site-main,
  .site-footer__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand__text small {
    display: none;
  }

  .hero {
    border-radius: 20px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .app-card {
    padding: 17px;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .brand__text strong {
    font-size: 14px;
  }

  .nav-link {
    padding: 7px 8px;
    font-size: 12.5px;
  }

  .gate-card {
    padding: 22px;
  }

  .gate-form {
    flex-direction: column;
  }

  .gate-form .btn {
    width: 100%;
  }
}
