/* ==========================================================================
   Sueños Digitales — “Señal” (the tilde, stood upright)
   Paper daylight up top, midnight at the bottom. One iris accent.
   ========================================================================== */

:root {
  --paper: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #17171C;
  --muted: #5A5A64;
  --iris: #4C3FD6;
  --iris-deep: #4032BC;
  --tint: #ECEBFB;
  --gold: #F0B354;
  --midnight: #0B1026;
  --periwinkle: #6B7BE0;
  --periwinkle-light: #8B97E8;
  --midnight-muted: #A6ADD3;
  --hairline: #E4E3DE;

  --font-body: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-arabic: "SF Arabic", "Segoe UI", "Noto Sans Arabic", "Geeza Pro", sans-serif;

  /* spacing scale */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;
  --s9: 6.5rem;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ul, li { margin: 0; padding: 0; }
ul { list-style: none; }
img, svg { display: block; max-width: 100%; }

html {
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 68.75rem; /* 1100px */
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

h1, h2, .claim {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  margin-bottom: var(--s6);
}

a {
  color: var(--iris);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--iris-deep); }

:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: 3px;
  border-radius: 2px;
}
.midnight :focus-visible {
  outline-color: var(--periwinkle-light);
}

::selection { background: var(--tint); color: var(--ink); }

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  background: var(--iris);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 500;
  transition: top 120ms ease;
}
.skip-link:focus-visible { top: 0; color: #fff; }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  padding-block: var(--s3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  color: var(--ink);
}
.brand-tile { flex: none; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: currentColor;
  white-space: nowrap;
}
.enye { color: var(--iris); }

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
}
.site-nav a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  padding: var(--s1) 0;
  border-bottom: 2px solid transparent;
  transition: border-color 140ms ease, color 140ms ease;
}
.site-nav a:hover {
  color: var(--iris);
  border-bottom-color: var(--iris);
}

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--s9) var(--s8);
}

.hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-pixel {
  position: absolute;
  left: calc(12.5% - 5px);
  top: calc(28.75% - 5px);
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--gold);
}

.hero-inner { position: relative; }

.hero h1 {
  font-size: clamp(2.75rem, 8vw, 5rem);
  max-width: 12ch;
}

.hero-sub {
  margin-top: var(--s5);
  max-width: 34rem;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--muted);
}

.hero-actions {
  margin-top: var(--s6);
  display: flex;
  align-items: center;
  gap: var(--s5);
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 0.9rem 1.5rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 140ms ease, transform 140ms ease;
}
.btn-primary {
  background: var(--iris);
  color: #fff;
}
.btn-primary:hover {
  background: var(--iris-deep);
  color: #fff;
}
.btn:active { transform: translateY(1px); }

.quiet-link {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--iris);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: color 140ms ease;
}
.quiet-link:hover { color: var(--iris); }

/* ---- About ---- */
.about {
  border-top: 1px solid var(--hairline);
  padding-block: var(--s8);
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}
.claim {
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  max-width: 12ch;
}
.about-copy p + p { margin-top: var(--s4); }
.about-copy { color: var(--muted); font-size: 1.05rem; }

/* ---- Apps ---- */
.apps {
  border-top: 1px solid var(--hairline);
  padding-block: var(--s8);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: var(--s6) var(--s5);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 140ms ease, transform 140ms ease;
}
.card:hover {
  border-color: var(--iris);
  color: var(--ink);
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) {
  .card, .card:hover, .btn, .btn:active { transform: none; transition: none; }
}

.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
[lang="ar"] {
  font-family: var(--font-arabic);
  letter-spacing: normal; /* never track connected Arabic script */
}
.card-title .arabic {
  font-family: var(--font-arabic);
  font-size: 1.1em; /* ~10% larger for x-height parity with Latin titles */
  letter-spacing: normal; /* never track connected Arabic script */
  display: inline-block;
}

.card-tag {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--iris);
}

.card-body {
  color: var(--muted);
  font-size: 0.95rem;
}

.disclosure {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.card-link {
  margin-top: auto;
  padding-top: var(--s3);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--iris);
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.card-link .arrow {
  transition: transform 140ms ease;
  display: inline-block;
}
.card:hover .card-link .arrow { transform: translate(2px, -2px); }

.store-note {
  margin-top: var(--s6);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- Capabilities ---- */
.capabilities {
  border-top: 1px solid var(--hairline);
  padding-block: var(--s8);
}

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: var(--s6) var(--s5);
}

.cap h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin-top: var(--s4);
  line-height: 1.35;
}
.cap p {
  margin-top: var(--s2);
  color: var(--muted);
  font-size: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--tint);
  color: var(--iris);
}
.chip svg { width: 1.5rem; height: 1.5rem; }

/* ---- Midnight surfaces (support + footer) ---- */
.midnight {
  background: var(--midnight);
  color: var(--paper);
}
.midnight a { color: var(--periwinkle-light); }
.midnight a:hover { color: #fff; }
.midnight .btn-support { color: #fff; } /* keep button text white despite .midnight a */

/* ---- Support band ---- */
.support {
  position: relative;
  overflow: hidden;
  padding-block: var(--s9);
  text-align: center;
}
.starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.starfield svg { width: 100%; height: 100%; }

.support-inner { position: relative; }
.support h2 {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  margin-bottom: var(--s3);
}
.support-sub {
  color: var(--midnight-muted);
  margin-bottom: var(--s6);
}
.btn-support {
  background: var(--iris);
  color: #fff;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  padding: 1.05rem 1.75rem;
  overflow-wrap: anywhere;
}
.btn-support:hover {
  background: var(--iris-deep);
  color: #fff;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-block: var(--s7);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.footer-brand { color: var(--paper); }
.footer-brand .brand-name { font-size: 1.1rem; }
.footer-brand .enye { color: var(--periwinkle-light); }

.footer-meta {
  color: var(--midnight-muted);
  font-size: 0.95rem;
}
.footer-domain { color: var(--midnight-muted); }
.footer-disclosure {
  color: var(--midnight-muted);
  font-size: 0.8rem;
}

/* ---- Legal pages (privacy policy) ---- */
.legal {
  padding-block: var(--s8);
}
.legal-inner { max-width: 70ch; }

.legal h1 {
  font-size: clamp(2rem, 5.5vw, 3rem);
}
.legal-updated {
  margin-top: var(--s3);
  color: var(--muted);
  font-size: 0.95rem;
}
.legal-intro {
  margin-top: var(--s5);
  color: var(--muted);
  font-size: 1.05rem;
}

.legal-toc {
  margin-top: var(--s6);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
  padding: var(--s5);
}
.legal-toc h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--iris);
  margin-bottom: var(--s3);
}
.legal-toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: var(--s6);
  font-size: 0.95rem;
  color: var(--muted);
}
.legal-toc li { break-inside: avoid; padding-block: 0.15rem; }
.legal-toc a {
  color: var(--ink);
  text-decoration-color: var(--hairline);
}
.legal-toc a:hover {
  color: var(--iris);
  text-decoration-color: var(--iris);
}

.legal section { margin-top: var(--s7); }
.legal section h2 {
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  margin-bottom: var(--s4);
}
.legal section p { margin-top: var(--s3); }
.legal section p:first-of-type { margin-top: 0; }
.legal section ul {
  list-style: disc;
  margin-top: var(--s3);
  padding-left: 1.25rem;
}
.legal section li + li { margin-top: var(--s2); }
.legal section li::marker { color: var(--iris); }

.legal-backtop {
  margin-top: var(--s7);
  font-size: 0.9rem;
}

@media (max-width: 34rem) {
  .legal-toc ol { columns: 1; }
}

/* ---- 404 page ---- */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  padding-block: var(--s8);
}
.error-inner { max-width: 34rem; }
.error-code {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: 1;
  color: var(--iris);
}
.error-page h1 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  margin-top: var(--s3);
}
.error-page p {
  margin-top: var(--s4);
  color: var(--muted);
}
.error-actions {
  margin-top: var(--s6);
  display: flex;
  align-items: center;
  gap: var(--s5);
  flex-wrap: wrap;
}

/* ---- Responsive ---- */
@media (max-width: 56rem) {
  .card-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .claim { max-width: none; }
}

@media (max-width: 30rem) {
  .hero { padding-block: var(--s8) var(--s7); }
  .header-inner { justify-content: center; }
  .site-nav { width: 100%; justify-content: center; }
  .hero-actions { gap: var(--s4); }
  .btn-support {
    display: block;
    max-width: 100%;
  }
}
