/*
 * Sukud design system - adaptive dashboard grid (ui.bento, ui.tile)
 *
 * The grid measures itself (container queries), so a dashboard inside a
 * narrow column or beside an open panel adapts exactly like it does to the
 * screen. Spans per size are tokens; nothing else changes per breakpoint.
 */

.sk-bento { container-type: inline-size; container-name: bento; min-width: 0; }
.sk-bento__grid {
  --cols: 2;
  --gap: 12px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: var(--gap);
  align-items: stretch;
}
.sk-bento__grid > * { min-width: 0; grid-column: span var(--span, var(--cols)); grid-row: span var(--rows, 1); }

/* Phones: two columns. Small facts pair up, everything else is full width. */
.sk-tile--s { --span: 1; }
.sk-tile--m, .sk-tile--l, .sk-tile--xl, .sk-tile--full, .sk-tile--tall, .sk-tile--hero { --span: 2; }

/* Tablets and narrow desktops: twelve columns, wide tiles full width.
   Small facts sit four to a row once there is room, so a row of four
   stats never breaks three and one. */
@container bento (min-width: 640px) {
  .sk-bento__grid { --cols: 12; --gap: 14px; }
  .sk-tile--s, .sk-tile--m { --span: 6; }
  .sk-tile--l, .sk-tile--xl, .sk-tile--full, .sk-tile--hero { --span: 12; }
  .sk-tile--tall { --span: 6; --rows: 2; }
}
@container bento (min-width: 760px) {
  .sk-tile--s { --span: 3; }
}
/* Medium tiles pair up on tablets. The one beside the hero on wide screens,
   and one left over at the end, take the whole row instead of half of it. */
@container bento (min-width: 640px) and (max-width: 1039.98px) {
  .sk-bento__grid > .sk-hero + .sk-tile--m,
  .sk-bento__grid > .sk-tile--xl + .sk-tile--m,
  .sk-bento__grid > :not(.sk-tile--m) + .sk-tile--m:last-child,
  .sk-bento__grid > :not(.sk-tile--m) + .sk-tile--m + .sk-tile--m + .sk-tile--m:last-child { --span: 12; }
}

/* Wide: twelve columns. */
@container bento (min-width: 1040px) {
  .sk-bento__grid { --cols: 12; --gap: 16px; }
  .sk-tile--s { --span: 3; }
  .sk-tile--m { --span: 4; }
  .sk-tile--l { --span: 6; }
  .sk-tile--xl { --span: 8; }
  .sk-tile--full { --span: 12; }
  .sk-tile--tall { --span: 4; --rows: 2; }
  .sk-tile--hero { --span: 8; --rows: 2; }
}

/* ---------------------------------------------------------------- tile */
.sk-tile {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--sk-border-subtle);
  border-radius: 22px;
  background: var(--sk-surface);
  box-shadow: var(--sk-shadow-xs);
  color: var(--sk-fg);
}
[data-theme="dark"] .sk-tile { border-color: var(--sk-border); }
.sk-tile--sunken { background: var(--sk-surface-sunken); box-shadow: none; border-color: transparent; }
.sk-tile--plain { background: transparent; box-shadow: none; border-color: transparent; padding: 0; }
.sk-tile--accent {
  border: 0;
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(var(--sk-violet-rgb) / 0.55), transparent 55%),
    linear-gradient(145deg, var(--sk-brand-9), var(--sk-brand-10));
  color: #fff;
  box-shadow: 0 18px 36px -18px rgb(var(--sk-brand-rgb) / 0.8);
  isolation: isolate;
  overflow: hidden;
}
.sk-tile--accent::after {
  content: ''; position: absolute; z-index: -1; right: -60px; bottom: -80px;
  width: 240px; height: 240px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: 0 0 0 36px rgb(255 255 255 / 0.04), 0 0 0 72px rgb(255 255 255 / 0.03);
}
.sk-tile--accent .sk-tile__subtitle, .sk-tile--accent .sk-tile__link { color: rgb(255 255 255 / 0.82); }
.sk-tile--accent .sk-tile__icon { background: rgb(255 255 255 / 0.18); color: #fff; }
/* Dark mode: the same hues, deep and calm instead of glowing on a dark page. */
[data-theme="dark"] .sk-tile--accent {
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(var(--sk-violet-rgb) / 0.2), transparent 55%),
    linear-gradient(145deg, color-mix(in oklab, var(--sk-brand-9) 44%, var(--sk-surface)), color-mix(in oklab, var(--sk-brand-10) 28%, var(--sk-surface)));
  box-shadow: inset 0 0 0 1px rgb(var(--sk-brand-rgb) / 0.24), 0 18px 36px -24px rgb(0 0 0 / 0.7);
}
[data-theme="dark"] .sk-tile--accent::after { border-color: rgb(255 255 255 / 0.07); box-shadow: 0 0 0 36px rgb(255 255 255 / 0.025), 0 0 0 72px rgb(255 255 255 / 0.018); }
[data-theme="dark"] .sk-tile--accent .sk-tile__icon { background: rgb(255 255 255 / 0.1); }

.sk-tile__head { display: flex; align-items: center; gap: 10px; min-height: 32px; margin-bottom: 14px; }
.sk-tile__icon { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--t-soft); color: var(--t-text); }
.sk-tile__titles { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.sk-tile__title { font-family: var(--sk-font-display); font-size: var(--sk-text-md); font-weight: var(--sk-weight-bold); letter-spacing: -0.012em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-tile__subtitle { font-size: var(--sk-text-xs); color: var(--sk-fg-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-tile__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sk-tile__link {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  font-size: var(--sk-text-xs); font-weight: var(--sk-weight-semibold);
  color: var(--sk-brand-11); text-decoration: none;
  padding: 6px 4px 6px 8px; margin-right: -4px; border-radius: var(--sk-radius-full);
}
.sk-tile__link .sk-icon { transition: transform var(--sk-dur-base) var(--sk-ease-spring); }
.sk-tile__link:hover .sk-icon { transform: translateX(3px); }
.sk-tile__link:focus-visible { outline: none; box-shadow: var(--sk-focus-ring); }
.sk-tile__body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sk-tile__body--flush { margin: 0 -18px -18px; gap: 0; }
.sk-tile__body--flush > :last-child { border-bottom-left-radius: 21px; border-bottom-right-radius: 21px; }
.sk-tile__empty { margin: auto 0; padding: 12px 0; font-size: var(--sk-text-sm); color: var(--sk-fg-subtle); text-align: center; text-wrap: pretty; }
.sk-tile__none { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 8px 8px; }
.sk-tile__none .sk-ill { max-width: 92px; }
.sk-tile__none .sk-tile__empty { margin: 0; padding: 4px 0 0; max-width: 32ch; }
/* Things laid out inside a tile: subject tiles, badges, people. */
.sk-tile__grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 180px), 100%), 1fr)); }

/* ---------------------------------------------------------------- hero */
.sk-hero { padding: 22px 24px; justify-content: center; }
.sk-hero__body { display: flex; align-items: center; gap: 20px; }
.sk-hero__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sk-hero__eyebrow { font-size: var(--sk-text-xs); font-weight: var(--sk-weight-semibold); letter-spacing: 0.02em; color: rgb(255 255 255 / 0.78); }
.sk-hero__title { font-family: var(--sk-font-display); font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); font-weight: var(--sk-weight-black); letter-spacing: -0.03em; line-height: 1.08; text-wrap: balance; }
.sk-hero__sub { max-width: 52ch; font-size: var(--sk-text-sm); line-height: 1.55; color: rgb(255 255 255 / 0.84); text-wrap: pretty; }
.sk-hero__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sk-hero__actions .sk-btn--ghost { color: #fff; }
.sk-hero__actions .sk-btn--ghost:hover { background: rgb(255 255 255 / 0.14); }
.sk-hero__aside { flex-shrink: 0; }
.sk-hero .sk-ring { color: #fff; }
.sk-hero .sk-ring__track { stroke: rgb(255 255 255 / 0.2); }
.sk-hero .sk-ring__arc { stroke: #fff; filter: none; }
.sk-hero .sk-ring__label { color: rgb(255 255 255 / 0.75); }
@media (max-width: 479.98px) {
  .sk-hero { padding: 18px; }
  .sk-hero__aside .sk-ring { --size: 84px !important; }
}
.sk-tile.is-offline::before {
  content: 'Saved copy';
  position: absolute; top: 12px; right: 14px;
  padding: 2px 8px; border-radius: var(--sk-radius-full);
  background: var(--sk-surface-sunken); color: var(--sk-fg-subtle);
  font-size: 10px; font-weight: var(--sk-weight-bold); letter-spacing: 0.03em;
}

/* Stats dropped straight into the grid fill their cell. */
.sk-bento__grid > .sk-stat { height: 100%; }

/* Entrance: tiles rise in, a moment apart, top-left to bottom-right. */
.sk-bento__grid > * { animation: sk-enter 360ms var(--sk-ease-out) backwards; }
.sk-bento__grid > :nth-child(2) { animation-delay: 35ms; }
.sk-bento__grid > :nth-child(3) { animation-delay: 70ms; }
.sk-bento__grid > :nth-child(4) { animation-delay: 105ms; }
.sk-bento__grid > :nth-child(5) { animation-delay: 140ms; }
.sk-bento__grid > :nth-child(6) { animation-delay: 175ms; }
.sk-bento__grid > :nth-child(n+7) { animation-delay: 210ms; }
@media (prefers-reduced-motion: reduce) { .sk-bento__grid > * { animation: none; } }
@media (max-width: 479.98px) { .sk-tile { padding: 14px 14px 16px; border-radius: 20px; } .sk-tile__body--flush { margin: 0 -14px -16px; } }
