:root {
  --bg: #0e0f13;
  --fg: #ffffff;
  --muted: #9aa0a6;
  --accent: #6cf2c2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

/* SITE TITLE */

.site-title {
  position: absolute;
  top: 1.5rem;
  left: 0;
  right: 0;
  margin: 0;
  font-size: clamp(4rem, 13vw, 10rem);
  font-weight: 700;
  text-align: center;
  color: rgba(255, 255, 255, 0.06);
  letter-spacing: 0.2em;
  pointer-events: none;
  user-select: none;
}

/* SIGN IN BUTTON (fixed top-right) */

#auth-slot {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 1000;
}

.signin-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--fg);
  padding: 0.35rem 1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

.signin-btn:hover {
  opacity: 0.9;
}

/* HIDDEN */

.hidden {
  display: none !important;
}

/* LAUNCHER */

.launcher-page {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2.5rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

.launcher-page .site-title {
  font-size: clamp(2.5rem, 8vw, 6rem);
}

.launcher-welcome {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 400;
}

.launcher-title {
  font-size: 2rem;
  font-weight: 600;
}

.launcher-grid {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.launcher-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 168px;
  max-width: calc(50% - 0.75rem);
  min-height: 132px;
  padding: 1rem 0.75rem;
  box-sizing: border-box;
  text-align: center;
  background: #1a1b20;
  border: 1px solid #2a2b30;
  border-radius: 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.launcher-btn:hover {
  border-color: var(--accent);
  background: #22232a;
}

.launcher-sub {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.3;
}

.launcher-icon {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.launcher-icon.icon-library {
  mask-image: url("/icons/LS_lib.svg");
  -webkit-mask-image: url("/icons/LS_lib.svg");
}

.launcher-icon.icon-write {
  mask-image: url("/icons/LS_write.svg");
  -webkit-mask-image: url("/icons/LS_write.svg");
}

.launcher-icon.icon-view {
  mask-image: url("/icons/LS_view.svg");
  -webkit-mask-image: url("/icons/LS_view.svg");
}

.launcher-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.launcher-account {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.launcher-account-sep {
  opacity: 0.5;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  text-underline-offset: 2px;
  opacity: 0.6;
  transition:
    opacity 0.2s ease,
    color 0.2s ease;
}

.link-btn:hover {
  opacity: 1;
  color: var(--accent);
  text-decoration: underline;
}

/* SCROLL SNAP CONTAINER */

.snap-container {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

/* SECTIONS */

.snap {
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100vh;

  padding: 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* HERO */

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: 1rem;
}

.accent {
  color: var(--accent);
}

.subclaim {
  font-size: 1.25rem;
  color: var(--accent);
  min-height: 1.6em;
  margin-bottom: 1.5rem;
  transition: opacity 0.8s ease;
}

.description {
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* BUTTONS */

.cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: #000;
}

.btn.secondary {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(108, 242, 194, 0.08);
}

.btn.secondary:hover {
  background: rgba(108, 242, 194, 0.16);
}

/* Riga d'aiuto sotto i pulsanti: porta alle pagine-percorso del manuale */
.cta-help {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.cta-help a {
  color: var(--accent);
  text-decoration: none;
}

.cta-help a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .cta-help {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
  }

  .cta-help .site-footer__sep {
    display: none;
  }
}

/* SECTIONS */

.section {
  h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  h2 + h2 {
    margin-top: -0.25rem;
  }
  h3 {
    color: var(--accent);
  }
  p {
    color: var(--muted);
    max-width: 480px;
    line-height: 1.6;
  }
}

.accent {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

/* USE CASES */

.usecases {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
  max-width: 700px;
}

.usecases > div {
  flex: 1 1 180px;
  max-width: 220px;
  text-align: center;
}

.usecases p {
  font-size: 0.9rem;
}

/* FEATURES */

.features {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  max-width: 520px;
  text-align: left;
}

.features li {
  padding: 0.5rem 0;
  color: var(--muted);
}

/* FINAL */

.final h2 {
  margin-bottom: 2rem;
}

/* PERSISTENT LEGAL FOOTER (pinned to the bottom of the final section) */

.site-footer {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

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

.site-footer a:hover {
  color: var(--fg);
}

.site-footer__sep {
  color: var(--muted);
  opacity: 0.6;
}

/* AUTH OVERLAY */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  /* flex-start + margin:auto on the card instead of align-items:center: the
     card stays centred when it fits, and when it doesn't (signup form on a
     small phone, keyboard open) it starts at the top and the overlay scrolls.
     Centred, its top and bottom — submit button included — were cut off. */
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.auth-overlay.hidden {
  display: none;
}

/* AUTH FORMS (dark) */

.auth-card {
  width: 100%;
  max-width: 420px;
  margin: auto 0;
  padding: 2rem;
  background: #1a1b20;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.auth-card a {
  text-decoration: none;
  color: var(--accent);
  cursor: pointer;
}

.auth-title {
  margin-bottom: 1.5rem;
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  color: var(--fg);
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #333;
  background: #0e0f13;
  color: var(--fg);
  font-size: 1rem;
}

/* Password field with the "show password" eye (pwToggle in app.js). The
   `text` selector above keeps the style while the password is shown. */
.auth-pw {
  position: relative;
}

.auth-field .auth-pw input {
  padding-right: 2.6rem;
}

/* Edge draws its own reveal eye: one is enough. */
.auth-pw input::-ms-reveal {
  display: none;
}

.auth-pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
}

.auth-pw-toggle[aria-pressed="false"] .auth-pw-slash {
  display: none;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-checkbox input {
  flex: 0 0 auto;
  width: auto;
}

.auth-checkbox label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-forgot {
  text-align: left;
  margin-top: 0.3rem;
  font-size: 14px;
}

.auth-actions {
  margin-top: 1rem;
  text-align: center;
}

.auth-actions button {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #000;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.auth-actions .auth-cancel-btn {
  margin-top: 0.5rem;
  background: #2a2b30;
  color: var(--muted);
}

.auth-divider {
  width: 100%;
  color: #555;
  margin: 1.5rem 0;
  text-align: center;
}

.auth-google {
  width: 100%;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-google button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #333;
  border-radius: 22px;
  background: #1a1b20;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}

.auth-google button:hover {
  border-color: var(--accent);
}

/* In-app browsers (Instagram, TikTok…): a way out instead of the Google button */
.auth-in-app {
  margin-bottom: 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid #333;
  border-radius: 12px;
  background: #1a1b20;
  text-align: center;
  font-size: 0.9rem;
}

.auth-in-app p {
  margin: 0 0 0.6rem;
}

.auth-in-app .in-app-title {
  font-weight: 500;
}

.auth-in-app .in-app-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.auth-in-app .in-app-btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.auth-message-sent {
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.auth-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.auth-legal {
  font-size: 0.8rem;
  opacity: 0.8;
}

.auth-hint {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  opacity: 0.75;
}

.auth-error a {
  text-decoration: underline;
}

.auth-message {
  min-height: 40px;
  margin-top: 1rem;
  font-size: 0.9rem;
  text-align: center;
}

.auth-error {
  min-height: 40px;
  margin-top: 1rem;
  color: #ff6b6b;
  font-size: 0.9rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.auth-info {
  min-height: 40px;
  margin-top: 1rem;
  color: var(--accent);
  font-size: 0.9rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

/* ACCESSIBILITY */

@media (prefers-reduced-motion: reduce) {
  .snap-container {
    scroll-snap-type: none;
  }
}

/* MOBILE / NARROW VIEWPORT */

@media (max-width: 600px) {
  /* Al font-size f il titolo è largo ~9.4f: la seconda parte del min()
     lo tiene dentro lo schermo con 16px di margine per lato fino a 320px.
     text-indent compensa il letter-spacing dopo l'ultima lettera, che
     altrimenti sposta la scritta a sinistra del centro. */
  .hero .site-title,
  .launcher-page .site-title {
    font-size: min(2.5rem, calc((100vw - 2rem) / 9.6));
    letter-spacing: 0.12em;
    text-indent: 0.12em;
    top: 3.5rem;
  }

  #auth-slot {
    top: 12px;
    right: 16px;
  }

  .lang-switch {
    bottom: 12px;
    right: 16px;
  }

  /* Il selettore delle lingue è fisso in basso a destra (12px + ~28px):
     il footer sale sopra di lui e, se il testo è lungo (FR), va a capo —
     senza i «·», che resterebbero appesi a fine riga. */
  .site-footer {
    bottom: 3.25rem;
    padding: 0 16px;
    flex-wrap: wrap;
    column-gap: 1.1rem;
    row-gap: 0.25rem;
  }

  .site-footer .site-footer__sep {
    display: none;
  }
}

/* LANGUAGE SWITCHER (fixed bottom-right) */

.lang-switch {
  position: fixed;
  bottom: 16px;
  right: 24px;
  z-index: 1000;
  display: flex;
  gap: 2px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.lang-switch__item {
  color: var(--fg);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.lang-switch__item:hover {
  opacity: 0.8;
}

.lang-switch__item.is-active {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
