/* Cloudtria base styles (shared across pages)
   Notes:
   - Landing-page layout is scoped to body.landing so content pages (privacy/terms) render normally.
   - Manual theme override (data-theme) is defined at the end so it wins over prefers-color-scheme.
*/

/* ---------- Theme toggle button (UI) ---------- */
.theme-toggle {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-dark);
}
.theme-toggle:hover { color: var(--text-dark); }
.theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}
/* ---------- END Theme toggle button ---------- */

:root {
  /* Brand palette */
  --primary: #f761a1;
  --secondary: #8c1bab;

  /* Accents / neutrals */
  --accent-1: #495057;
  --accent-2: #212429;
  --white: #ffffff;

  /* Theme variables (default = dark) */
  --bg-dark: #121316;
  --text-dark: #ffffff;
  --muted-dark: #c5c6ca;
  --muted2-dark: #70769a;

  --hover-accent: #a40858;
  --shadow-tone: #503f40;
  --slate: #5a6470;

  /* Spacing scale */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --radius: 14px;
  --btn-h: 52px;

  --container-w: 960px;
}

/* System light mode (no user toggle) */
@media (prefers-color-scheme: light) {
  :root {
    --bg-dark: #ffffff;
    --accent-2: #ffffff;
    --text-dark: #121316;
    --muted-dark: #5a6470;
    --muted2-dark: #70769a;
    --accent-1: rgba(33, 36, 41, 0.18);
  }
}

* {
  box-sizing: border-box;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img, svg {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-dark);

  /* Background gradient */
  background:
    radial-gradient(circle at 18% 10%, rgba(247, 97, 161, 0.16), transparent 55%),
    radial-gradient(circle at 82% 18%, rgba(140, 27, 171, 0.16), transparent 58%),
    radial-gradient(circle at 50% 92%, rgba(164, 8, 88, 0.10), transparent 60%),
    var(--bg-dark);
}

/* ---------------------------------------------
   Shared layout + components (content pages)
--------------------------------------------- */

.container {
  max-width: var(--container-w);
  padding: 40px 24px;
  width: 100%;
  margin: 0 auto;

  line-height: 1.5;
  letter-spacing: 0.1px;
  text-align: left;
}

.card {
  background: color-mix(in srgb, var(--accent-2) 92%, transparent);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-4);
  border: 1px solid var(--accent-1);
  box-shadow: 0 18px 40px rgba(80, 63, 64, 0.22);
  display: flex;
  flex-direction: column;
  text-align: left;
}

@media (prefers-color-scheme: light) {
  .card { box-shadow: 0 18px 40px rgba(18, 19, 22, 0.08); }
}

/* Top bar for content pages (privacy/terms/about) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

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

.brand img {
  display: block;
  height: 34px;
  width: auto;
}

.nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.nav a {
  color: var(--muted-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.nav a:hover {
  color: var(--text-dark);
  border-bottom-color: var(--primary);
}

.meta { color: var(--muted-dark); margin: 6px 0 0 0; }
.sites { margin: 12px 0 0 0; }

p { color: var(--muted-dark); margin: 0 0 var(--space-3); }
ul { color: var(--muted-dark); margin: 0 0 var(--space-3); padding-left: 20px; }
li { margin: 6px 0; }

h1 { margin: 0 0 var(--space-2); }
h2 { margin: var(--space-5) 0 var(--space-2); }

.footer, footer {
  margin-top: var(--space-6);
  font-size: 0.85rem;
  color: var(--muted-dark);
  border-top: 1px solid var(--accent-1);
  padding-top: var(--space-4);
}
.footer a, footer a {
  color: var(--muted-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer a:hover, footer a:hover {
  color: var(--text-dark);
  border-bottom-color: var(--primary);
}

/* ---------------------------------------------
   Landing page layout (index.php)
   Add: <body class="landing"> on your landing page
--------------------------------------------- */

body.landing {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.landing .container {
  text-align: center;
}

/* Keep the landing H1 accessible but visually hidden */
body.landing h1 {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.logo {
  max-width: 220px;
  margin-bottom: var(--space-4);
}

p.intro {
  color: var(--muted-dark);
  margin: 0 0 var(--space-6);
  font-size: 1.05rem;
  font-weight: 400;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

.card img {
  max-height: 56px;
  margin: 0 auto var(--space-4);
  display: block;
}

.card p {
  color: var(--muted2-dark);
  font-size: 0.95rem;
  margin: 0 0 var(--space-5);
}

.spacer { flex-grow: 1; }

.btn {
  position: relative;
  display: block;
  width: 100%;
  height: var(--btn-h);
  line-height: var(--btn-h);
  border-radius: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;

  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
  will-change: transform, filter;
}

@media (prefers-color-scheme: light) {
  .btn { border: 1px solid rgba(18, 19, 22, 0.10); }
}

.btn:hover {
  transform: translateY(-2px);
  filter: saturate(1.05);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 220% 220%;
  animation: gradientShift 10s ease-in-out infinite;
  z-index: 0;
}

.btn span {
  position: relative;
  z-index: 1;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-protect::before {
  background-image: linear-gradient(135deg, var(--primary), var(--hover-accent), var(--primary));
}

.btn-hosting::before {
  background-image: linear-gradient(135deg, var(--secondary), #5a6470, var(--secondary));
}

.btn-protect:hover {
  box-shadow:
    0 14px 26px rgba(80, 63, 64, 0.30),
    0 0 0 3px rgba(247, 97, 161, 0.20),
    0 0 30px rgba(247, 97, 161, 0.28);
}

.btn-hosting:hover {
  box-shadow:
    0 14px 26px rgba(80, 63, 64, 0.30),
    0 0 0 3px rgba(140, 27, 171, 0.18),
    0 0 30px rgba(140, 27, 171, 0.26);
}

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

.btn-protect:focus-visible {
  box-shadow:
    0 0 0 3px rgba(247, 97, 161, 0.35),
    0 0 0 6px rgba(247, 97, 161, 0.18);
}

.btn-hosting:focus-visible {
  box-shadow:
    0 0 0 3px rgba(140, 27, 171, 0.35),
    0 0 0 6px rgba(140, 27, 171, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .btn::before { animation: none; }
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

/* ---------------------------------------------
   Manual theme override (user toggle)
   Must be last so it overrides prefers-color-scheme
--------------------------------------------- */

:root[data-theme="dark"] {
  --bg-dark: #121316;
  --accent-2: #212429;
  --text-dark: #ffffff;
  --muted-dark: #c5c6ca;
  --muted2-dark: #70769a;
  --accent-1: #495057;
}

:root[data-theme="light"] {
  --bg-dark: #ffffff;
  --accent-2: #ffffff;
  --text-dark: #121316;
  --muted-dark: #5a6470;
  --muted2-dark: #70769a;
  --accent-1: rgba(33, 36, 41, 0.18);
}

/* Theme toggle: top-right slider */
.theme-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 8px 10px;
  border-radius: 999px;

  /* These should inherit nicely from your theme variables if you have them */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-theme="dark"] .theme-switch {
  background: rgba(18, 19, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.theme-switch__label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;

  background-color: rgba(0, 0, 0, 0.18);
  transition: background-color 0.2s ease;
}

body[data-theme="dark"] .slider {
  background-color: rgba(255, 255, 255, 0.18);
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;

  border-radius: 50%;
  background: #fff;

  transition: transform 0.2s ease;
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Keyboard focus */
.switch input:focus-visible + .slider {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
