/* ═══════════════════════════════════════
   ELEMENTILE — elementile.online
   Theme: Minimal white/grey with bevels
   ═══════════════════════════════════════ */

/* ─── CSS Custom Properties ─── */
:root {
  /* Light theme (default) */
  --bg: #ffffff;
  --bg-gradient: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
  --card-bg: #f2f2f2;
  --card-border: #e8e8e8;
  --card-bevel-top: rgba(255, 255, 255, 0.9);
  --card-bevel-bottom: rgba(0, 0, 0, 0.08);
  --card-bevel-inset-top: rgba(255, 255, 255, 0.95);
  --card-bevel-inset-bottom: rgba(0, 0, 0, 0.05);
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #333333;
  --accent-hover: #555555;
  --icon-bg: #e8e8e8;
  --icon-color: #333333;
  --status-bg: #f8f8f8;
  --status-border: #e0e0e0;
  --toggle-bg: #e8e8e8;
  --toggle-color: #555555;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --bevel-light: inset 0 1px 0 rgba(255,255,255,0.95);
  --bevel-dark: inset 0 -1px 0 rgba(0,0,0,0.07);
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #222222 100%);
  --card-bg: #2a2a2a;
  --card-border: #333333;
  --card-bevel-top: rgba(255, 255, 255, 0.05);
  --card-bevel-bottom: rgba(0, 0, 0, 0.4);
  --card-bevel-inset-top: rgba(255, 255, 255, 0.03);
  --card-bevel-inset-bottom: rgba(0, 0, 0, 0.2);
  --text-primary: #e0e0e0;
  --text-secondary: #999999;
  --text-muted: #666666;
  --accent: #cccccc;
  --accent-hover: #aaaaaa;
  --icon-bg: #333333;
  --icon-color: #cccccc;
  --status-bg: #252525;
  --status-border: #333333;
  --toggle-bg: #333333;
  --toggle-color: #aaaaaa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --bevel-light: inset 0 1px 0 rgba(255,255,255,0.06);
  --bevel-dark: inset 0 -1px 0 rgba(0,0,0,0.3);
}

/* ─── Reset ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease, color 0.4s ease;
  padding: 16px;
  line-height: 1.5;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm), var(--bevel-light), var(--bevel-dark);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  box-shadow: var(--shadow-md), var(--bevel-light), var(--bevel-dark);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  position: absolute;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg); }
[data-theme="light"] .theme-toggle .icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="dark"]  .theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"]  .theme-toggle .icon-sun  { opacity: 1; transform: rotate(0deg); }

/* ─── Language Picker ─── */
.lang-picker {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 176px;
}

.lang-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm), var(--bevel-light), var(--bevel-dark);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.lang-btn:hover {
  box-shadow: var(--shadow-md), var(--bevel-light), var(--bevel-dark);
  transform: scale(1.08);
}

.lang-btn.active {
  background: var(--accent);
  color: var(--bg);
}

/* ─── Container ─── */
.container {
  width: 100%;
  max-width: 720px;
  margin: auto;
  padding: 60px 0 40px;
}

/* ─── Download Card ─── */
.download-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px 32px 32px;
  box-shadow:
    var(--shadow-lg),
    var(--bevel-light),
    var(--bevel-dark);
  transition: all 0.4s ease;
}

/* ─── Header ─── */
.header {
  text-align: center;
  margin-bottom: 36px;
}

.title {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: color 0.4s ease;
}

.slogan {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
  transition: color 0.4s ease;
}

.subtitle {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: var(--text-muted);
  margin-top: 8px;
  transition: color 0.4s ease;
}

/* ─── Countdown Timer ─── */
.countdown {
  text-align: center;
  margin: 16px 0 24px;
  padding: 14px 20px;
  background: var(--status-bg);
  border: 1px solid var(--status-border);
  border-radius: 14px;
  transition: all 0.4s ease;
  box-shadow: var(--bevel-light), var(--bevel-dark);
}

.countdown-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.countdown-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

.countdown-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.2;
}

.countdown-unit-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.countdown-sep {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 14px;
}

/* ─── Stats line ─── */
.stats-line {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ─── Platform Grid ─── */
.platforms {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 8px 16px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;

  /* Bevel effect */
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    var(--bevel-light),
    var(--bevel-dark);
}

.platform-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 40%);
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] .platform-btn::after {
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 40%);
}

.platform-btn:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.10),
    var(--bevel-light),
    var(--bevel-dark);
}

[data-theme="dark"] .platform-btn:hover {
  box-shadow:
    0 8px 24px rgba(0,0,0,0.30),
    var(--bevel-light),
    var(--bevel-dark);
}

.platform-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.platform-btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* Pressed/loading state */
.platform-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.platform-btn.loading .icon-circle {
  animation: pulse-load 1.2s ease-in-out infinite;
}

@keyframes pulse-load {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.92); }
}

/* Success state */
.platform-btn.success {
  border-color: #4caf50;
}

.platform-btn.success .icon-circle {
  background: #4caf50;
  color: white;
}

/* ─── Icon Circle ─── */
.icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--icon-bg);
  color: var(--icon-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.06),
    inset 0 -1px 0 rgba(255,255,255,0.5);
}

[data-theme="dark"] .icon-circle {
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.3),
    inset 0 -1px 0 rgba(255,255,255,0.05);
}

.icon-circle svg,
.icon-circle img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.platform-name {
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-primary);
  transition: color 0.4s ease;
}

.platform-version {
  font-size: clamp(0.55rem, 1.4vw, 0.65rem);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  transition: color 0.4s ease;
}

/* ─── Status Area ─── */
.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--status-bg);
  border: 1px solid var(--status-border);
  border-radius: 12px;
  transition: all 0.4s ease;
  box-shadow:
    var(--bevel-light),
    var(--bevel-dark);
}

.status-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon svg {
  width: 100%;
  height: 100%;
}

.status-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  transition: color 0.4s ease;
}

.status.downloading .status-icon {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status.success .status-text {
  color: #4caf50;
}

.status.error .status-text {
  color: #e53935;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  transition: color 0.4s ease;
}

/* ─── Toast / Notifications ─── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Responsive ─── */

/* Tablet & small laptop — 720p */
@media (max-width: 720px) {
  .download-card {
    padding: 28px 20px 24px;
    border-radius: 20px;
  }

  .platforms {
    gap: 10px;
  }

  .icon-circle {
    width: 52px;
    height: 52px;
  }

  .icon-circle svg,
  .icon-circle img {
    width: 26px;
    height: 26px;
  }

  .platform-btn {
    padding: 16px 6px 12px;
  }

  .countdown { margin: 12px 0 18px; padding: 10px 14px; }
  .countdown-value { font-size: 1.2rem; }
  .countdown-unit { min-width: 32px; }
  .countdown-unit-label { font-size: 0.55rem; }
  .countdown-sep { font-size: 1rem; }
}

/* Large phone — portrait */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .download-card {
    padding: 24px 16px 20px;
    border-radius: 16px;
  }

  .platforms {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .platform-btn {
    padding: 14px 4px 10px;
    border-radius: 12px;
    gap: 8px;
  }

  .icon-circle {
    width: 44px;
    height: 44px;
  }

  .icon-circle svg,
  .icon-circle img {
    width: 22px;
    height: 22px;
  }

  .platform-name {
    font-size: 0.6rem;
  }

  .platform-version {
    font-size: 0.5rem;
  }

  .header {
    margin-bottom: 24px;
  }

  .countdown { margin: 8px 0 14px; padding: 8px 10px; }
  .countdown-value { font-size: 1rem; }
  .countdown-unit { min-width: 28px; }
  .countdown-unit-label { font-size: 0.5rem; }
  .countdown-sep { font-size: 0.85rem; padding-bottom: 10px; }
}

/* Small phone — 360px */
@media (max-width: 380px) {
  .platforms {
    gap: 6px;
  }

  .platform-btn {
    padding: 10px 3px 8px;
    gap: 6px;
  }

  .icon-circle {
    width: 36px;
    height: 36px;
  }

  .icon-circle svg,
  .icon-circle img {
    width: 18px;
    height: 18px;
  }

  .platform-name {
    font-size: 0.5rem;
  }

  .platform-version {
    display: none;
  }
}

/* Landscape orientation on phones */
@media (max-height: 480px) and (orientation: landscape) {
  .container {
    padding: 20px 0;
  }

  .download-card {
    padding: 16px 20px;
  }

  .header {
    margin-bottom: 16px;
  }

  .title {
    font-size: 1.5rem;
  }

  .platforms {
    gap: 8px;
  }

  .platform-btn {
    padding: 12px 6px 10px;
  }

  .icon-circle {
    width: 40px;
    height: 40px;
  }

  .icon-circle svg,
  .icon-circle img {
    width: 20px;
    height: 20px;
  }
}

/* 4K and large screens */
@media (min-width: 1400px) {
  .container {
    max-width: 900px;
  }

  .download-card {
    padding: 48px 40px;
  }

  .icon-circle {
    width: 72px;
    height: 72px;
  }

  .icon-circle svg,
  .icon-circle img {
    width: 36px;
    height: 36px;
  }

  .platform-btn {
    padding: 24px 12px 20px;
  }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark theme scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #1a1a1a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

/* Print — minimal, no frills */
@media print {
  .theme-toggle,
  .lang-picker { display: none; }

  body {
    background: white !important;
    color: black !important;
  }

  .download-card {
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
}
