/* GridX palette — mirrors the Android app (Mantine-style + brand orange) */
:root,
:root[data-theme="dark"] {
  --bg: #1a1b1e;
  --surface: #25262b;
  --surface-2: #2c2e33;
  --border: #373a40;
  --text: #c1c2c5;
  --text-muted: #909296;
  --brand: #ffa903;
  --brand-pressed: #df8800;
  --on-brand: #1a1b1e;
  --success: #40c057;
  --warning: #fab005;
  --danger: #fa5252;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #f1f3f5;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #868e96;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  /* Guard against any element spilling past the viewport (no horizontal scroll).
     `clip` (not `hidden`) so it doesn't break the sticky header. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.container.narrow {
  max-width: 760px;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h2 {
  font-size: 1.9rem;
  letter-spacing: -0.01em;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
}

.nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger — hidden on desktop, shown in the mobile media query below */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: var(--brand);
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

/* Animate to an "X" when open */
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.lang-switch {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.lang-switch:hover {
  border-color: var(--brand);
  text-decoration: none;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.theme-toggle:hover {
  border-color: var(--brand);
}

:root[data-theme="dark"] .icon-sun {
  display: inline;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

:root[data-theme="light"] .icon-sun {
  display: none;
}

:root[data-theme="light"] .icon-moon {
  display: inline;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(
      ellipse 70% 50% at 50% -10%,
      color-mix(in srgb, var(--brand) 12%, transparent),
      transparent
    );
}

.hero-icon {
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.tagline {
  color: var(--brand);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 22px 0 18px;
}

.lead {
  max-width: 760px;
  margin: 0 auto 28px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  border-radius: 10px;
  padding: 11px 26px;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-pressed);
  color: var(--on-brand);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--brand);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Sections ---------- */

.section {
  padding: 64px 0;
}

.section.alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-text {
  font-size: 1.05rem;
}

.section-sub {
  color: var(--text-muted);
  margin-top: -6px;
  margin-bottom: 28px;
}

/* ---------- Compare ---------- */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 34px;
}

.compare-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}

.compare-col.gridx {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 25%, transparent);
}

.compare-col h3 {
  margin-bottom: 12px;
}

.compare-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.compare-col li {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.mark {
  font-weight: 700;
  flex: 0 0 auto;
}

.mark.good {
  color: var(--success);
}

.mark.bad {
  color: var(--danger);
}

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  transform: translateY(-2px);
}

.card-icon {
  font-size: 1.7rem;
  margin-bottom: 8px;
}

.card h3 {
  font-size: 1.08rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- Steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}

.step-n {
  color: var(--brand);
  font-weight: 800;
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.step h3 {
  font-size: 1.08rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- Compatibility ---------- */

.compat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.compat-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}

.compat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.compat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.compat-list li:last-child {
  border-bottom: none;
}

.badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge.ok {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.badge.soon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

/* ---------- Contact form ---------- */

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 28px;
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.req {
  color: var(--danger);
}

.contact-form input:not([type="file"]),
.contact-form select,
.contact-form textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.98rem;
  font-family: inherit;
  width: 100%;
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

/* Custom chevron: the native one hugs the right edge */
.contact-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a8e94' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.contact-form input.invalid,
.contact-form select.invalid,
.contact-form textarea.invalid {
  border-color: var(--danger);
}

.btn-submit {
  justify-self: start;
  min-width: 180px;
}

/* ---------- Attachments ---------- */

.file-field {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Visually hidden but focusable — the styled label is the visible control */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-btn {
  padding: 8px 18px;
  font-size: 0.95rem;
  cursor: pointer;
}

.file-input:focus-visible + .file-btn {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.file-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.label-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.file-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.file-size {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.file-remove {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 6px;
}

.file-remove:hover {
  color: var(--danger);
}

/* ---------- Video ---------- */

.video-block {
  max-width: 820px;
  margin: 44px auto 0;
  text-align: center;
}

.video-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  aspect-ratio: 16 / 9;
  border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--border));
  border-radius: 16px;
  background:
    radial-gradient(
      ellipse 60% 60% at 50% 40%,
      color-mix(in srgb, var(--brand) 10%, transparent),
      transparent
    ),
    var(--bg);
  text-align: center;
  padding: 20px;
}

.video-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.video-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand);
}

.video-play svg {
  margin-left: 3px; /* optically centre the triangle in the circle */
}

.video-caption {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 420px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  background: var(--surface);
}

.footer-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.footer-brand img {
  border-radius: 6px;
}

.footer-info {
  text-align: right;
  color: var(--text-muted);
  font-size: 0.92rem;
  display: grid;
  gap: 4px;
}

.footer-copy {
  font-size: 0.85rem;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(92vw, 480px);
  font-size: 0.95rem;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-left-color: var(--success);
}

.toast.fail {
  border-left-color: var(--danger);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .cards,
  .steps {
    grid-template-columns: 1fr;
  }

  .compare,
  .compat-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* Push the controls (lang, theme, hamburger) to the right edge of the header */
  .header-actions {
    margin-left: auto;
  }

  /* Make the three header controls the same height so they line up */
  .lang-switch,
  .theme-toggle,
  .nav-toggle {
    height: 36px;
  }

  .lang-switch,
  .theme-toggle {
    display: inline-flex;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Nav becomes a full-width dropdown under the header, toggled by the button */
  .nav {
    display: none;
    position: absolute;
    top: 60px; /* header height */
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin-left: 0;
    padding: 6px 20px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px 2px;
    font-size: 1.05rem;
  }

  .nav a + a {
    border-top: 1px solid var(--border);
  }

  .tagline {
    font-size: 1.5rem;
  }

  .footer-info {
    text-align: left;
  }
}
