/* home.kayali.cloud: wallpaper, clock, search; apps + status only on the tailnet. */
:root {
  --ink: #ffffff;
  --ink2: rgba(255, 255, 255, 0.82);
  --ink3: rgba(255, 255, 255, 0.72);
  --glass: rgba(18, 20, 26, 0.48);
  --glass-hover: rgba(48, 52, 62, 0.62);
  --line: rgba(255, 255, 255, 0.18);
  --ok: #6ee7a0;
  --warn: #fbbf24;
  --bad: #f87171;
  --mute: rgba(255, 255, 255, 0.55);
  --fallback: #1b2027;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fallback);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
p { margin: 0; }
a { color: var(--ink2); }
a:hover { color: var(--ink); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bg, .veil { position: fixed; inset: 0; }
.bg { background-size: cover; background-position: center; opacity: 0; transition: opacity .6s ease; }
.bg.on { opacity: 1; }
.veil { background: rgba(8, 10, 14, 0.30); }
body.tailnet .veil { background: rgba(8, 10, 14, 0.36); }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 48px 56px 32px;
  gap: 28px;
}

/* top */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.when { display: flex; flex-direction: column; gap: 4px; }
.clock { font-size: 72px; font-weight: 300; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; }
.date { font-size: 18px; color: var(--ink2); }
.badge { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.badge svg { width: 16px; height: 16px; }

/* middle */
.middle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; padding-bottom: 40px; }
body.tailnet .middle { padding-bottom: 0; }
.search {
  width: 100%; max-width: 680px; height: 64px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 10px 0 22px; border-radius: 18px;
}
.search:focus-within { border-color: rgba(255, 255, 255, 0.42); }
.search-icon { width: 22px; height: 22px; flex: none; opacity: .85; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 19px;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--ink3); }
.search input::-webkit-search-cancel-button { filter: invert(1); }
.search button {
  flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: rgba(255, 255, 255, 0.16); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.search button:hover { background: rgba(255, 255, 255, 0.26); }
.search button:focus-visible, .tile:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.search button svg { width: 20px; height: 20px; }

.apps { width: 100%; max-width: 880px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 8px 14px; border-radius: 16px;
  color: var(--ink); text-decoration: none;
  background: rgba(18, 20, 26, 0.42);
  transition: background .15s;
  min-height: 44px;
}
.tile:hover { background: var(--glass-hover); color: var(--ink); }
.tile svg { width: 28px; height: 28px; stroke-width: 1.8; }
.tile .name { font-size: 14px; font-weight: 500; text-align: center; }
.tile.down { opacity: .55; }
.tile .state { font-size: 11px; color: var(--ink2); margin-top: -6px; }

/* bottom */
.bottom { display: flex; flex-direction: column; gap: 10px; }
.status { display: flex; flex-direction: column; gap: 10px; }
.status-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 12px; color: var(--ink2); }
.status-title { font-weight: 600; letter-spacing: .08em; text-transform: uppercase; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-age { white-space: nowrap; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.check { display: flex; gap: 10px; padding: 14px 16px; border-radius: 14px; background: rgba(18, 20, 26, 0.50); }
.check svg { width: 18px; height: 18px; flex: none; margin-top: 1px; stroke-width: 2.2; }
.check.ok svg { color: var(--ok); }
.check.warn svg { color: var(--warn); }
.check.bad svg { color: var(--bad); }
.check.mute svg { color: var(--mute); }
.check.bad { border-color: rgba(248, 113, 113, 0.55); }
.check .txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.check .l { font-size: 14px; font-weight: 600; }
.check .n { font-size: 12px; color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.check.mute .l { color: var(--ink2); }
.credit { text-align: right; font-size: 12px; color: var(--ink3); }

/* tablet */
@media (max-width: 1100px) {
  .checks { grid-template-columns: repeat(3, 1fr); }
}
/* phone */
@media (max-width: 640px) {
  .page { padding: max(28px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); gap: 22px; }
  .clock { font-size: 52px; letter-spacing: -1.5px; }
  .date { font-size: 15px; }
  .badge { padding: 6px 10px; font-size: 12px; margin-top: 4px; }
  .badge span { display: none; }
  .badge::after { content: "Tailnet"; }
  .middle { justify-content: flex-start; padding-top: 10vh; gap: 22px; }
  body.tailnet .middle { padding-top: 0; }
  .search { height: 56px; padding: 0 6px 0 16px; border-radius: 16px; gap: 10px; }
  .search-icon { width: 20px; height: 20px; }
  .search input { font-size: 17px; }
  .apps { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .tile { padding: 12px 2px 10px; gap: 6px; border-radius: 14px; }
  .tile svg { width: 24px; height: 24px; }
  .tile .name { font-size: 11px; }
  .tile .state { font-size: 10px; margin-top: -3px; }
  .status { border-radius: 16px; padding: 6px 14px; background: rgba(18, 20, 26, 0.52); border: 1px solid var(--line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
  .status-head { padding-top: 6px; }
  .checks { display: flex; flex-direction: column; gap: 0; }
  .check { padding: 8px 0; border: 0; border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; align-items: center; }
  .check + .check { border-top: 1px solid rgba(255, 255, 255, 0.10); }
  .check svg { width: 16px; height: 16px; margin: 0; }
  .check .txt { flex-direction: row; align-items: baseline; gap: 10px; }
  .check .l { font-size: 13px; width: 104px; flex: none; }
  .check .n { -webkit-line-clamp: 1; }
}
@media (prefers-reduced-motion: reduce) { .bg { transition: none; } }
