/* apps.nithishb.com hub. Dark only; tokens first, then layout, then components. */

:root {
  color-scheme: dark;

  /* Neutral ramp — never pure black; elevation is a lighter surface plus a 1px border. */
  --bg: #121419;
  --surface: #1a1d23;
  --surface-hover: #21252c;
  --surface-active: #171a1f;
  --border: #2c313a;
  --border-strong: #434a56;
  --border-control: #6a7280; /* >= 3:1 on --surface and --surface-hover, so a button's edge reads */
  --text: #e8eaee;
  --text-muted: #a4abb6;

  /* One accent, desaturated for dark. --on-accent is the text colour on an accent fill. */
  --accent: #7fc4b2;
  --on-accent: #10201b;
  --danger: #f2998f;

  /* Type: system sans + system mono, 1.25 scale. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --text-sm: 0.8125rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.953rem;

  /* Two radii: cards, and everything smaller. */
  --radius-lg: 12px;
  --radius-sm: 8px;

  --gutter: 16px;
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--accent); }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- layout ------------------------------------------------------------------------------- */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px var(--gutter) 64px;
}

.masthead { margin-bottom: 32px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  margin-bottom: 8px;
}

h1 {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.lede {
  color: var(--text-muted);
  max-width: 52ch;
}

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

/* ---- card --------------------------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card:not(.card--skeleton):hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.card:not(.card--skeleton):active { background: var(--surface-active); }

.card__main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  flex: 1;
}

.card__mark {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.card__initial {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--accent);
}

.card__icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card__body { min-width: 0; }

.card__name {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.card__link {
  color: var(--text);
  text-decoration: none;
}

/* The name link covers the whole card, so the card is one big target without nesting links. */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}

.card__link:focus-visible { outline: none; }

.card__link:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card__desc {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 61px; /* a 44px button + 16px padding + the 1px rule, so skeleton and card match */
  padding: 8px 8px 8px 16px;
  border-top: 1px solid var(--border);
}

.card__path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sits above the stretched link so it stays its own target. */
.card__android {
  position: relative;
  z-index: 1;
  flex: none;
}

/* ---- buttons ------------------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--surface-hover); }
.button:active { background: var(--surface-active); }

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button--primary:hover { background: #95d0c0; border-color: #95d0c0; }
.button--primary:active { background: #6fb3a1; border-color: #6fb3a1; }
.button--primary:disabled:hover { background: var(--accent); border-color: var(--accent); }

.button__icon { flex: none; }

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

.bone {
  display: block;
  height: 14px;
  width: 90%;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--surface-hover);
}

.bone--title { width: 40%; height: 20px; margin-top: 2px; }
.bone--short { width: 72px; margin-top: 0; }

.card--skeleton .card__mark,
.card--skeleton .bone { animation: pulse 1.2s ease-out infinite alternate; }

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .card--skeleton .card__mark,
  .card--skeleton .bone { animation: none; }
}

/* ---- status: empty / error ---------------------------------------------------------------- */

.status {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.status__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.status--error { border-color: var(--danger); }
.status--error .status__title { color: var(--danger); }

.status__detail {
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.status .button { margin-top: 8px; }
