/* ============================================================================
   MaxlimWebs — apps.css
   The software showcase (bento cards), product pages, the admin gate and
   toasts. Same tokens as style.css, so light and dark both come for free.
   ========================================================================== */

/* ── 1. Bento showcase ─────────────────────────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.bento-empty {
  grid-column: 1 / -1;
  padding: clamp(24px, 4vw, 40px);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-weak);
}
.bento-empty p { color: var(--text-strong); font-size: 14px; }
.bento-empty-sub { margin-top: 10px !important; color: var(--text-weak) !important; font-size: 12.5px !important; }

.bento-note {
  margin-top: 18px;
  color: var(--text-weak);
  font-size: 12.5px;
}

/* ── 2. App card ───────────────────────────────────────────────────────── */
.app-card {
  padding: 0;
  overflow: hidden;
}
.app-card:hover { background: var(--bg-interactive-weaker); }

.app-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}

.app-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border-weak);
  background: var(--bg-weak);
  overflow: hidden;
}
.app-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.app-card:hover .app-card-media img { transform: scale(1.015); }
.app-card-blank { display: block; width: 100%; height: 100%; background: var(--bg-weak-hover); }

/* no screenshot → the icon sits centred on a blueprint grid, never stretched */
.app-card-media--blank {
  display: grid;
  place-items: center;
  background-image: linear-gradient(var(--border-weak) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-weak) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
  background-position: center;
}
.app-card-hero-icon {
  width: 72px !important;
  height: 72px !important;
  border: 1px solid var(--border-weak);
  border-radius: 16px;
  background: var(--bg);
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.app-card:hover .app-card-hero-icon { transform: scale(1.05); }
.app-card--wide .app-card-hero-icon { width: 96px !important; height: 96px !important; }

/* platform dots over the media */
.app-card-osbar {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.osbar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-weaker);
  opacity: 0.45;
}
.osbar-dot.is-on { background: var(--bg-interactive); opacity: 1; }

.app-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  padding: clamp(16px, 2.2vw, 22px);
}

.app-card-head { display: flex; align-items: flex-start; gap: 12px; }
.app-card-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-weak);
  border-radius: 8px;
  background: var(--bg-weak);
  object-fit: cover;
}
.app-card-titles { min-width: 0; }
.app-card-name {
  font-size: 15.5px;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
.app-card-ver {
  color: var(--text-weak);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.app-card-tagline { margin-top: 3px; color: var(--text-weak); font-size: 12.5px; }
.app-card-copy { color: var(--text-weak); font-size: 12.8px; line-height: 1.6; }

.app-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-weak);
  font-size: 12px;
}
.app-card-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-weight: 500;
}
.app-card-dl svg { width: 13px; height: 13px; }
.app-card-platforms { margin-left: auto; color: var(--text-weak); font-size: 11px; }
.app-card-go { display: inline-flex; color: var(--text-weak); }
.app-card-go svg { width: 14px; height: 14px; transition: transform 0.25s ease; }
.app-card:hover .app-card-go { color: var(--on-interactive); }
.app-card:hover .app-card-go svg { transform: translateX(3px); }
.app-card:hover .app-card-dl { background: var(--hl); color: var(--on-interactive); }

/* featured tile: first card spans the row, media beside the copy */
.app-card--wide { grid-column: span 2; }
.app-card--wide .app-card-link { flex-direction: row; }
.app-card--wide .app-card-media {
  flex: 1 1 56%;
  aspect-ratio: 16 / 10;      /* keep the row tight — no dead space beside the copy */
  border-bottom: 0;
  border-right: 1px solid var(--border-weak);
}
.app-card--wide .app-card-body {
  flex: 1 1 44%;
  justify-content: center;      /* short copy centres instead of leaving a gap */
}
.app-card--wide .app-card-foot { margin-top: 18px; }
.app-card--wide .app-card-copy { font-size: 13px; }
.app-card--wide .app-card-name { font-size: 17px; }

/* ── 3. Product page ───────────────────────────────────────────────────── */
.product-section { border-top: 0; padding-top: clamp(28px, 4vw, 44px); }

.product-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: clamp(20px, 3vw, 30px);
  color: var(--text-weak);
  font-size: 12.5px;
}
.product-back svg { width: 14px; height: 14px; }
.product-back:hover { background: var(--hl); color: var(--hl-text); }

.product-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(22px, 3.4vw, 42px);
  align-items: start;
  padding-bottom: clamp(26px, 4vw, 44px);
  border-bottom: 1px solid var(--border-weak);
}
.product-id { display: flex; align-items: flex-start; gap: 16px; }
.product-icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border: 1px solid var(--border-weak);
  border-radius: 14px;
  background: var(--bg-weak);
  object-fit: cover;
}
.product-name {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
}
.product-tagline { margin-top: 8px; color: var(--text-weak); font-size: 14.5px; }

.product-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}
/* inline icons inside buttons need an intrinsic size or flex stretches them */
.btn > svg { width: 14px; height: 14px; flex: 0 0 auto; }
.product-actions .btn-lg > svg { width: 15px; height: 15px; }
.product-actions .btn { white-space: nowrap; }
.product-file {
  flex: 1 0 100%;
  color: var(--text-weak);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}
.product-note {
  color: var(--text);
  border-left: 2px solid var(--accent, var(--border-strong));
  padding-left: 10px;
}
.product-note a { text-decoration: underline; text-underline-offset: 3px; }
.btn-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border-weak);
  color: var(--text-weak);
  font-size: 11.5px;
}
.btn-meta svg { width: 11px; height: 11px; }

.product-secondary {
  margin-top: 20px;
  color: var(--text-weak);
  font-size: 12.5px;
}
.product-secondary a {
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: var(--text-weaker);
  text-underline-offset: 3px;
}
.product-secondary a:hover { background: var(--hl); text-decoration-color: transparent; }
.product-secondary .muted { color: var(--text-weak); }

.product-shot { margin: 0; }
.product-shot img {
  width: 100%;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius);
  background: var(--bg-weak);
}
.product-shot .fig { margin-top: 10px; }

/* body + sidebar */
.product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: clamp(24px, 4vw, 48px);
  padding-block: clamp(26px, 4vw, 44px);
}
.product-body { max-width: 68ch; }

/* markdown output */
.product-body > * + * { margin-top: 16px; }
.product-body h2 { font-size: 19px; margin-top: 30px; }
.product-body h2.md-mid { font-size: 16px; margin-top: 26px; }
.product-body h2.md-deep { font-size: 13.5px; margin-top: 22px; letter-spacing: 0.02em; }
.product-body p { color: var(--text-weak); font-size: 14px; line-height: 1.75; }
.product-body strong { color: var(--text-strong); font-weight: 600; }
.product-body a {
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: var(--text-weaker);
  text-underline-offset: 3px;
}
.product-body a:hover { background: var(--hl); text-decoration-color: transparent; }
.product-body ul,
.product-body ol { padding-left: 0; list-style: none; }
.product-body ul li,
.product-body ol li {
  position: relative;
  padding-left: 22px;
  color: var(--text-weak);
  font-size: 14px;
  line-height: 1.7;
}
.product-body ul li + li,
.product-body ol li + li { margin-top: 7px; }
.product-body ul li::before {
  content: '–';
  position: absolute;
  left: 2px;
  color: var(--text-weaker);
}
.product-body ol { counter-reset: md-ol; }
.product-body ol li { counter-increment: md-ol; }
.product-body ol li::before {
  content: counter(md-ol) '.';
  position: absolute;
  left: 0;
  color: var(--text-weaker);
  font-size: 12px;
}
.product-body blockquote {
  padding-left: 16px;
  border-left: 2px solid var(--bg-interactive);
  color: var(--text-weak);
  font-style: italic;
}
.product-body hr { border: 0; border-top: 1px solid var(--border-weak); }
.product-body code,
.md-inline {
  padding: 2px 5px;
  border: 1px solid var(--border-weak);
  border-radius: 2px;
  background: var(--bg-weak);
  color: var(--text-strong);
  font-size: 12.5px;
}
.md-code {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius);
  background: var(--bg-weak);
  color: var(--text-strong);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
}

/* sidebar */
.product-side { display: grid; gap: 22px; align-content: start; }
.side-block { padding-top: 4px; }
.side-head {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-weak);
  color: var(--text-weak);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dl-list li + li { margin-top: 4px; }
.dl-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.dl-list a:hover { background: var(--bg-weak-hover); border-color: var(--border-weak); }
.dl-list li.is-mine a { background: var(--bg-interactive-weaker); border-color: var(--border-weak); }
.dl-icon { display: inline-flex; color: var(--text-weak); }
.dl-icon svg { width: 15px; height: 15px; }
.dl-text { display: flex; flex-direction: column; min-width: 0; }
.dl-text strong { color: var(--text-strong); font-size: 13px; font-weight: 500; }
.dl-text span {
  color: var(--text-weak);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dl-mine {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 2px;
  background: var(--hl);
  color: var(--hl-text);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.dl-none { color: var(--text-weak); font-size: 12.5px; }
.dl-absent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--text-weaker, var(--text-weak));
  opacity: .6;
}
.dl-absent .dl-text span { color: var(--text-weaker, var(--text-weak)); font-style: italic; }

.spec-list { display: grid; gap: 9px; }
.spec-list > div { display: flex; justify-content: space-between; gap: 12px; }
.spec-list dt { color: var(--text-weak); font-size: 12px; }
.spec-list dd { color: var(--text-strong); font-size: 12px; text-align: right; }
.spec-list dd a { text-decoration: underline; text-decoration-color: var(--text-weaker); text-underline-offset: 3px; }

.side-block--cta {
  padding: 16px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius);
  background: var(--bg-weak);
}
.side-cta-copy { margin-bottom: 12px; color: var(--text-weak); font-size: 12.5px; }

.product-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--border-weak);
  border-radius: var(--radius);
  background: var(--bg-weak);
}
.product-cta-copy { color: var(--text-strong); font-size: 14.5px; font-weight: 500; }
.product-cta .btn-invert svg { width: 14px; height: 14px; }

/* ── 4. Admin gate ─────────────────────────────────────────────────────── */
.gate-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border: 1px solid var(--border-weak);
  border-radius: 50%;
  background: var(--bg-weak);
  color: var(--text-strong);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
}
.pw-toggle:hover { background: var(--bg-weak-hover); color: var(--text-strong); }

/* footer admin lock */
.lock-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--text-weaker);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.lock-btn:hover { color: var(--text-strong); background: var(--bg-weak-hover); border-color: var(--border-weak); }

/* ── 5. Dashboard host frame + toast ───────────────────────────────────── */
.admin-frame {
  position: fixed;
  inset: 0;
  z-index: 85;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}
.admin-frame[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 95;
  transform: translate(-50%, 12px);
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-strong);
  color: var(--text-inverted);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 18px 40px hsl(0 0% 0% / 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--ok { border-color: var(--bg-interactive); }
.toast--warn { border-color: #d6a35a; }

/* ── 6. Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .product-hero { grid-template-columns: minmax(0, 1fr); }
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .product-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .app-card--wide { grid-column: span 1; }
  .app-card--wide .app-card-link { flex-direction: column; }
  .app-card--wide .app-card-media {
    aspect-ratio: 16 / 10;
    border-right: 0;
    border-bottom: 1px solid var(--border-weak);
  }
  .product-side { grid-template-columns: minmax(0, 1fr); }
  .product-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .product-id { flex-direction: column; gap: 12px; }
  .product-cta { flex-direction: column; align-items: flex-start; }
}
