@font-face {
  font-family: "Noto Sans Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/fonts/noto-sans-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Noto Sans Variable";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/fonts/noto-sans-latin-wght-italic.woff2") format("woff2-variations");
}

:root {
  --navy: #10384f;
  --teal: #00617f;
  --cyan: #00bcff;
  --green: #89d329;
  --bg: #f8fafc;
  --line: #e2e8f0;
  --line2: #cbd5e1;
  --muted: #64748b;
  --text2: #475569;
  --soft: #f1f5f9;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; }
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: "Noto Sans Variable", "Noto Sans", ui-sans-serif, system-ui, sans-serif;
  color: var(--navy);
  min-height: 100vh;
  padding-bottom: 7rem;
  background: linear-gradient(133.25deg, rgba(0, 188, 255, 0.07) 10%, rgba(137, 211, 41, 0.05) 45%, rgba(0, 97, 127, 0.06) 85%), var(--bg);
}
::selection { background: rgba(0, 188, 255, 0.2); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd {
  font-family: var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 10px;
}
.icon { display: block; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.bg-tint { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: 0.4;
  background:
    radial-gradient(circle at 15% 40%, rgba(0, 188, 255, 0.12), transparent 40%),
    radial-gradient(circle at 85% 65%, rgba(137, 211, 41, 0.12), transparent 40%); }

/* Header */
.topbar { position: sticky; top: 0; z-index: 60; padding: 1rem 1.25rem; background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--cyan), var(--teal), var(--green)); box-shadow: 0 1px 6px rgba(0, 188, 255, 0.4); }
.topbar-inner { max-width: 80rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand-logo { width: 36px; height: 36px; border-radius: 12px; padding: 1.5px; display: block;
  background: linear-gradient(135deg, var(--cyan), var(--teal), var(--green)); }
.brand-logo > span { width: 100%; height: 100%; background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.brand-logo img { width: 22px; height: auto; }
.brand-name { font-size: 1.25rem; font-weight: 900; letter-spacing: -0.025em; }
.controls { display: flex; align-items: center; gap: 0.75rem; width: 100%; }
.search { position: relative; flex: 1; display: block; }
#search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search input { width: 100%; background: var(--soft); border: 1px solid var(--line2); border-radius: 999px; padding: 8px 48px 8px 40px;
  font: inherit; font-size: 0.875rem; color: var(--navy); outline: none; transition: all 0.2s; }
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--cyan); background: #fff; box-shadow: 0 0 0 3px rgba(0, 188, 255, 0.2); }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search-clear:hover { color: var(--navy); }
.search-hint { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; display: none; background: #fff; }
.toggle { display: flex; background: var(--soft); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.toggle button { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; color: var(--muted); font-size: 0.75rem; }
.toggle button:hover { color: var(--navy); }
.toggle button.active { background: var(--navy); color: #fff; font-weight: 700; }
.toggle span { display: none; font-family: var(--mono); font-size: 10px; }
.offline { position: absolute; bottom: -2rem; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px; background: var(--navy); color: var(--cyan); font: 11px var(--mono); border: 1px solid rgba(0, 188, 255, 0.4); white-space: nowrap; }
.offline[hidden] { display: none; }

/* Hero */
.hero { max-width: 80rem; margin: 0 auto; padding: 2rem 1rem; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 0.75rem; font: 700 11px var(--mono); letter-spacing: 0.25em; text-transform: uppercase; color: var(--teal); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.hero h1 { font-size: 3rem; font-weight: 900; letter-spacing: -0.05em; line-height: 0.88; margin-bottom: 1rem; }
.hero h1 span { background: linear-gradient(90deg, var(--teal), var(--cyan), var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; }
.hero-row p { color: var(--text2); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; }
.keys { display: none; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line2);
  font: 11px var(--mono); color: var(--text2); }
.keys b { color: var(--teal); }

/* Grid */
main { max-width: 80rem; margin: 0 auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 3.5rem; }
main noscript { display: block; text-align: center; padding: 4rem 0; }
.section-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.section-head h2 { font-size: 0.75rem; font-weight: 900; letter-spacing: 0.1em; color: var(--teal); text-transform: uppercase; flex-shrink: 0; }
.section-head hr { flex: 1; height: 1px; border: 0; background: var(--line); }
.section-head span { font: 700 10px var(--mono); color: var(--muted); flex-shrink: 0; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }

.card { content-visibility: auto; contain-intrinsic-size: 1px 360px; position: relative; display: flex; flex-direction: column; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; outline: none; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.3s; }
.card:hover { border-color: rgba(0, 188, 255, 0.6); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); transform: translateY(-4px); }
.card:focus-visible, .card.focused { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--cyan), 0 20px 25px -5px rgba(0, 188, 255, 0.15); transform: translateY(-4px); outline: none; }
.frame { position: relative; width: 100%; overflow: hidden; background: var(--soft); border-bottom: 1px solid var(--line); aspect-ratio: 16 / 9; transition: all 0.3s; }
.mobile .frame { aspect-ratio: 9 / 16; }
.preview { position: relative; width: 100%; height: 100%; overflow: hidden; background: #edf2f7; }
.preview img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(0.98); transition: opacity 0.3s, transform 0.7s; }
.preview.loaded img { opacity: 1; transform: none; }
.card:hover .preview img { transform: scale(1.05); }
.preview.error img { display: none; }
.preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, #f1f5f9 30%, #fff 50%, #e2e8f0 70%); background-size: 200% 100%; animation: shimmer 1.6s infinite; }
.preview.loaded::before { display: none; }
.preview.error::before { animation: none; background: var(--bg); }
.preview.error::after { content: "Preview unavailable"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); }
@keyframes shimmer { to { background-position: -200% 0; } }

.overlay-actions { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(16, 56, 79, 0.65); backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.2s; }
.card:hover .overlay-actions, .card.focused .overlay-actions { opacity: 1; }
.btn-quick { display: flex; align-items: center; gap: 6px; background: #fff; color: var(--navy); padding: 6px 14px; border-radius: 999px; font-size: 0.75rem; font-weight: 900; box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2); }
.btn-ext { display: flex; padding: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); }
.btn-ext:hover { background: #fff; color: var(--navy); }
.tag { position: absolute; top: 8px; right: 8px; z-index: 10; padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.9);
  font: 700 8px var(--mono); border: 1px solid var(--line2); pointer-events: none; text-transform: uppercase; }

.body { padding: 1rem; display: flex; flex-direction: column; flex: 1; }
.title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.badge { padding: 6px; border-radius: 8px; color: #fff; display: flex; }
.title-row > div:last-child { min-width: 0; }
.title-row h3 { font-size: 0.875rem; font-weight: 900; letter-spacing: -0.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat { font: 700 9px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); }
.desc { font-size: 11px; color: var(--text2); line-height: 1.6; margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--soft); display: flex; align-items: center; justify-content: space-between; font-size: 10px; }
.foot .hint { font-family: var(--mono); color: var(--muted); }
.launch { display: flex; align-items: center; gap: 4px; font-weight: 900; color: var(--teal); transition: color 0.2s; text-decoration: none; }
.launch:hover { color: var(--cyan); }

.empty { padding: 5rem 1rem; text-align: center; background: #fff; border: 1px dashed var(--line2); border-radius: 24px; color: var(--text2); }
.empty svg { margin: 0 auto 12px; color: #94a3b8; }
.empty p { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.empty button { padding: 8px 16px; background: var(--navy); color: #fff; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.empty button:hover { background: var(--teal); }

/* Category bar */
.categories { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 50; padding: 6px; display: flex; gap: 6px;
  max-width: 95vw; overflow-x: auto; scrollbar-width: none; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(20px);
  border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); }
.categories::-webkit-scrollbar { display: none; }
.categories button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 12px; font-size: 10px; font-weight: 900;
  letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; color: var(--text2); transition: all 0.2s; }
.categories button:hover { color: var(--navy); background: var(--soft); }
.categories button.active { background: var(--navy); color: #fff; }
.categories sup { font: 700 8.5px var(--mono); padding: 2px 6px; border-radius: 999px; min-width: 16px; text-align: center; background: var(--line); color: var(--teal); line-height: 1.2; }
.categories button.active sup { background: var(--cyan); color: var(--navy); }

/* Quick view */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(16, 56, 79, 0.5); backdrop-filter: blur(12px); animation: fade 0.2s; }
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.dlg { position: relative; width: 100%; max-width: 56rem; background: #fff; border: 1px solid var(--line); border-radius: 24px; overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); animation: pop 0.2s; max-height: 90vh; display: flex; flex-direction: column; }
@keyframes pop { from { transform: translateY(12px) scale(0.96); } }
.dlg-close { position: absolute; top: 1rem; right: 1rem; z-index: 10; padding: 10px; border-radius: 999px; background: var(--soft); display: flex; align-items: center; gap: 6px; }
.dlg-close:hover { background: var(--line); }
.dlg-close kbd { display: none; background: #fff; font-weight: 700; }
.dlg-body { display: flex; flex-direction: column; overflow-y: auto; }
.dlg-media { width: 100%; background: var(--bg); border-bottom: 1px solid var(--line); position: relative; min-height: 220px; aspect-ratio: 16 / 9; flex-shrink: 0; }
.dlg-media.mobile { aspect-ratio: 9 / 16; max-height: 500px; }
.dlg-media .pill { position: absolute; bottom: 12px; left: 12px; z-index: 10; padding: 2px 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line2); font: 700 9px var(--mono); }
.dlg-info { padding: 1.5rem; display: flex; flex-direction: column; }
.dlg-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; padding-right: 3rem; }
.dlg-head .badge { width: 48px; height: 48px; border-radius: 12px; align-items: center; justify-content: center; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.dlg-head h2 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.025em; }
.dlg-head .cat { font-size: 12px; letter-spacing: 0.15em; }
.dlg h4 { font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 6px; font-weight: 400; }
.dlg .quote { font-style: italic; color: #334155; font-size: 0.875rem; line-height: 1.6; border-left: 2px solid var(--cyan); padding: 8px 12px; background: #f0f9ff; border-radius: 0 8px 8px 0; margin-bottom: 1rem; }
.dlg .detail { color: var(--text2); font-size: 0.875rem; line-height: 1.6; margin-bottom: 2rem; }
.dlg-open { width: 100%; padding: 14px; background: var(--navy); color: #fff; border-radius: 16px; font-weight: 900; font-size: 0.875rem; display: flex;
  align-items: center; justify-content: center; gap: 10px; text-decoration: none; box-shadow: 0 10px 15px rgba(16, 56, 79, 0.2); transition: all 0.2s; }
.dlg-open:hover { background: var(--teal); }
.dlg-open:active { transform: scale(0.98); }
.dlg-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 0 4px; font: 11px var(--mono); color: var(--muted); }
.dlg-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

@media (min-width: 640px) {
  .topbar { padding: 1.25rem; }
  .hero { padding: 3.5rem 1.5rem 2rem; }
  .hero h1 { font-size: 6rem; }
  main { padding: 0 1.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .search-hint { display: inline-block; }
  .keys { display: flex; }
  .dlg-close kbd { display: inline-block; }
  .dlg-info { padding: 2rem; }
}
@media (min-width: 768px) {
  .topbar-inner { flex-direction: row; justify-content: space-between; }
  .controls { width: auto; }
  .search { flex: none; width: 20rem; }
  .dlg-body { flex-direction: row; }
  .dlg-media, .dlg-media.mobile { width: 50%; max-height: none; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); }
  .dlg-info { width: 50%; overflow-y: auto; }
}
@media (min-width: 1024px) {
  main, .hero { padding-left: 2rem; padding-right: 2rem; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .toggle span { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }
