/*
 * Tabula — spreadsheet-style new tab page browser extension.
 *
 * Copyright (C) 2026 withersky
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

/* Tabula landing page — styles
   Mirror the extension's own UI: same palette as options.css
   (#1a1a24 background, indigo primary rgba(120,140,255,.95),
   cards #23232e, radius 8–14px) and a CSS mockup of the new-tab
   page built with the same tokens as newtab.css. */

:root {
  --bg: #1a1a24;
  --bg-elev: #23232e;
  --bg-elev-2: #2a2a36;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e8e8f0;
  --muted: rgba(232, 232, 240, 0.6);
  --primary: rgba(120, 140, 255, 0.95);
  --primary-fg: #0f0f1a;
  --primary-soft: rgba(180, 190, 255, 0.95);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: linear-gradient(180deg, #1a1a24 0%, #15151e 100%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 420px at 50% -120px, rgba(120, 140, 255, 0.13), transparent 65%);
}

/* ----- Blurred Bing "image of the day" background ----- */
/* The image layer sits above the gradient (z-index 0) but below all content
   (everything else lives in normal flow with default z-index:auto > 0 only
   where positioned). We keep the page gradient as a fallback; the image fades
   in once it finishes loading. A dark overlay + blur make text readable. */

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg); /* исходный цвет фона (#1a1a24) */
  /* Исходный фон сайта ДО Bing — градиент #1a1a24→#15151e. Он же
     выступает fallback-ом: если картинка не загрузилась, слой просто
     показывает этот градиент вместо прозрачности. */
  background-image: linear-gradient(180deg, #1a1a24 0%, #15151e 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* start hidden — JS reveals it after a successful load (или при сбое,
     чтобы стал виден fallback-градиент) */
  opacity: 0;
  transition: opacity 800ms ease;
  /* heavy blur + slight scale so the blur has no hard edges */
  filter: blur(22px) saturate(1.05);
  transform: scale(1.08);
}

.site-bg.loaded { opacity: 1; }

/* Dark, slightly tinted scrim for contrast over any picture */
.site-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20, 20, 30, 0.72) 0%, rgba(15, 15, 24, 0.86) 100%),
    radial-gradient(900px 420px at 50% -120px, rgba(120, 140, 255, 0.10), transparent 65%);
}

/* Keep the content above the background layers */
main,
.footer {
  position: relative;
  z-index: 1;
}

/* topbar already uses sticky + z-index:30 to stay above content on scroll */

.container { width: min(1100px, 100% - 40px); margin-inline: auto; }

/* ---------- Topbar (same as options page) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border-strong);
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav { display: flex; gap: 6px; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 8px;
  transition: color 160ms ease, background 160ms ease;
}

.nav a:hover {
  color: var(--text);
  background: rgba(120, 140, 255, 0.18);
}

.nav .nav-external {
  color: var(--primary-soft);
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.lang-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.lang-btn:hover { color: var(--text); }

.lang-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 56px; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-text h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 26px;
  font-size: 15.5px;
  color: var(--muted);
  max-width: 480px;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons — same language as .btn / .btn.primary in the extension */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn-download:hover {
  background: rgba(120, 140, 255, 1);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.btn-download:active { transform: translateY(0); }

.btn-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 7px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.btn-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.btn-browser { font-size: 15px; }

.btn-os {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.78;
}

.version-note {
  margin: 18px 0 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.link-releases {
  display: inline-block;
  font-size: 13px;
  color: var(--primary-soft);
  text-decoration: none;
}

.link-releases:hover { text-decoration: underline; }

/* ---------- Mockup of the extension UI ---------- */
.mock {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #14141c;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  user-select: none;
  animation: mockIn 500ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes mockIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mock-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 10px 12px;
}

.mock-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 5px 11px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  line-height: 1.15;
}

.mock-time {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.mock-date {
  font-size: 9px;
  opacity: 0.65;
}

.mock-search {
  justify-self: stretch;
  min-width: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mock-weather {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.25;
}

.mock-wx-icon { font-size: 17px; }

.mock-wx-text { display: flex; flex-direction: column; }

.mock-wx-line { white-space: nowrap; }

.mock-wx-city {
  font-size: 10px;
  opacity: 0.6;
  white-space: nowrap;
}

.mock-gear {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.mock-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 10px 10px;
}

.mock-row {
  display: grid;
  grid-template-columns: 24px repeat(6, minmax(0, 1fr));
  gap: 1px;
}

.mock-corner,
.mock-col,
.mock-num {
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

.mock-row-head .mock-col { min-height: 16px; }
.mock-corner { min-height: 16px; }
.mock-num { border-right: 1px solid rgba(255, 255, 255, 0.12); }

.mock-cell {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  overflow: hidden;
}

.mock-cell.filled { cursor: pointer; }

.mock-cell.filled:hover { background: rgba(255, 255, 255, 0.07); }

.mock-cell.selected {
  background: rgba(120, 140, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(120, 140, 255, 0.55);
}

.mock-cell.selected.active {
  background: rgba(120, 140, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(120, 140, 255, 0.9);
}

.mock-fav {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.10);
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
}

.mock-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.mock-sheetbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.mock-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 10px;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}

.mock-tab.active {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
}

.mock-add {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-size: 13px;
  margin-left: 2px;
}

/* ---------- Sections ---------- */
.features,
.install {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.features h2,
.install h2 {
  margin: 0 0 30px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 160ms ease, transform 160ms ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.card h3 {
  margin: 10px 0 6px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.card-icon { font-size: 24px; }

.install-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.install-card h3 { margin: 0 0 10px; }

.install-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.install-card li { margin-bottom: 7px; }

.install-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--primary-soft);
  font-size: 12.5px;
}

.install-variant-hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.install-variant {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.install-variant-title {
 Margin: 0 0 8px;
 Font-size: 13.5px;
 Font-weight: 600;
 Color: var(--text);
}

.install-variant-note {
 Margin: 10px 0 0;
 Font-size: 12.5px;
 Color: var(--muted);
}

.hint {
  margin: 20px auto 0;
  max-width: 680px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

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

.footer a:hover { color: var(--primary-soft); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-text h1 br { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .topbar-right { gap: 8px; }
  .lang-switch { padding: 2px; }
  .lang-btn { padding: 4px 7px; }
  .nav a { padding: 6px 8px; font-size: 12.5px; }
  .mock-topbar { grid-template-columns: 1fr auto; row-gap: 8px; }
  .mock-clock { grid-column: 1; }
  .mock-gear { grid-column: 2; grid-row: 1; justify-self: end; }
  .mock-search { grid-column: 1 / -1; grid-row: 2; }
  .mock-weather { display: none; }
  .mock-date { display: none; }
  .mock-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .mock-num, .mock-corner { display: none; }
  .mock-row-head .mock-col { display: none; }
  .btn-download { min-width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mock { animation: none; }
  .card, .btn-download { transition: none; }
}
