
/* =========================================================
   MEGAVALLIA WEBSITE — COMPLETE STYLESHEET
   Dark theme • Public Feed • Features • Download • Legal Pages
   ========================================================= */

/* --- Global Styles & Variables --- */

:root {
  --bg-primary: #090b14;
  --bg-secondary: #111425;
  --bg-tertiary: #1a1e36;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --text-main: #ffffff;
  --text-muted: #8a8d9e;
  --border-color: rgba(255, 255, 255, 0.1);
  --danger: #ff4757;
  --success: #22c55e;
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 16px;
  --content-width: 1400px;
  --header-height: 76px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
}

img {
  display: block;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}

::selection {
  background: rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* --- Shared Layout --- */

.container {
  width: min(100% - 10%, var(--content-width));
  margin-inline: auto;
}

.section {
  padding: 80px 5%;
}

.section > *,
.hero > *,
.creator-band > * {
  min-width: 0;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px 5%;
  min-height: var(--header-height);
  background: rgba(9, 11, 20, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand .logo {
  background: var(--accent);
  color: #fff;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand span span {
  color: var(--accent-hover);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
  color: var(--text-main);
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.user-display {
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Buttons --- */

.btn {
  background: var(--accent);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius-small);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  line-height: 1.4;
}

.btn:hover {
  background: #5558e8;
  opacity: 0.96;
}

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

.btn.small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

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

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn.full-width {
  width: 100%;
  margin-top: 8px;
}

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

.hero {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 80px 5% 65px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 50px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  top: -180px;
  left: -160px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.09);
  filter: blur(80px);
  pointer-events: none;
}

.hero-copy {
  flex: 1 1 520px;
  max-width: 650px;
  position: relative;
  z-index: 2;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-hover);
  font-weight: 700;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-hover);
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 590px;
  margin-bottom: 30px;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

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

/* --- Hero Art / App Mockup --- */

.art {
  position: relative;
  flex: 0 0 320px;
  width: 320px;
  height: 380px;
  margin-right: 10px;
}

.mock {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 16px;
  position: absolute;
}

.mock.front {
  width: 260px;
  bottom: 0;
  right: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.mock:not(.front) {
  width: 235px;
  top: 20px;
  left: 0;
  opacity: 0.75;
}

.video {
  background: var(--bg-tertiary);
  height: 200px;
  border-radius: var(--radius-small);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video .live {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.72);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--danger);
  font-weight: 800;
}

.video .play {
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.85);
}

.mock-info {
  margin-top: 12px;
}

.mock-info b {
  display: block;
  font-size: 0.9rem;
}

.mock-info small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Section Headings --- */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 32px;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  line-height: 1.2;
  margin-top: 6px;
}

.pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.status {
  color: var(--text-muted);
  font-style: normal;
  margin-bottom: 20px;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

#feed-status {
  min-height: 1.5em;
}

/* --- Public Feed Grid --- */

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 24px;
  align-items: stretch;
}

.feed-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.feed-card:hover {
  border-color: rgba(129, 140, 248, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.feed-card .thumb {
  background: var(--bg-tertiary);
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: var(--accent-hover);
  font-size: 2rem;
}

.feed-card .thumb img,
.feed-card .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-card .thumb video {
  background: #000;
}

.feed-card .thumb.text-only {
  min-height: 140px;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.17), transparent 45%),
    var(--bg-tertiary);
}

.feed-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.feed-label {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  color: var(--accent-hover);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.feed-body h3 {
  font-size: 1rem;
  line-height: 1.5;
  margin: 7px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.feed-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
  overflow-wrap: anywhere;
}

/* --- Empty / Error States --- */

.empty {
  grid-column: 1 / -1;
  padding: 32px 20px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-medium);
  color: var(--text-muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.fineprint {
  margin-top: 30px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Creator Band --- */

.creator-band {
  background:
    radial-gradient(circle at 10% 50%, rgba(99, 102, 241, 0.09), transparent 35%),
    var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 50px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.creator-band h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.3;
  margin: 6px 0 8px;
}

.creator-band p {
  color: var(--text-muted);
  max-width: 650px;
}

/* --- Features Section --- */

.features h2 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 40px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 20px;
}

.feature-grid article {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  padding: 24px;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.feature-grid article:hover {
  border-color: rgba(129, 140, 248, 0.5);
  transform: translateY(-3px);
}

.feature-grid article span {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 12px;
  color: var(--accent-hover);
}

.feature-grid article h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.feature-grid article p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- About Section --- */

.about p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 800px;
  margin-top: 12px;
  line-height: 1.8;
}

.about h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

/* --- Download Section --- */

.download {
  background: linear-gradient(
    180deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  padding: 80px 5%;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.download .app-logo {
  width: 54px;
  height: 54px;
  background: var(--accent);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  margin: 0 auto 20px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.download h2 {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  line-height: 1.25;
  margin: 6px 0 10px;
}

.download p {
  color: var(--text-muted);
  margin: 0 auto 24px;
  max-width: 650px;
}

.download-action {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.download-action .btn {
  width: 100%;
}

.download-action small {
  display: block;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* --- AdSense Container --- */

.adsense-container {
  width: min(100% - 10%, 900px);
  margin: 40px auto;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-medium);
  text-align: center;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.ad-placeholder {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-small);
}

/* Note: These styles do not create real advertisements.
   Configure AdSense separately when your site is approved. */

/* --- Legal Pages --- */

.legal-page {
  width: min(100% - 10%, 900px);
  margin: 0 auto;
  padding: 64px 0 80px;
  min-height: 60vh;
}

.legal-page h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin-bottom: 12px;
}

.last-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 40px;
}

.legal-page section {
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 1.25rem;
  line-height: 1.4;
  margin-bottom: 12px;
  color: #fff;
}

.legal-page p,
.legal-page li {
  color: #b8bbca;
  font-size: 0.97rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.legal-page p + p {
  margin-top: 12px;
}

.legal-page ul,
.legal-page ol {
  padding-left: 24px;
  margin: 12px 0;
}

.legal-page li {
  padding-left: 4px;
  margin-bottom: 8px;
}

.legal-page a {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page a:hover {
  color: #a5b4fc;
}

/* --- Footer --- */

footer {
  padding: 36px 5%;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.footer-brand > span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.footer-links a,
footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a {
  font-size: 0.85rem;
}

.footer-links a:hover,
footer a:hover {
  color: #fff;
}

footer small {
  width: 100%;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Login Modal (if retained in index.html) --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 11, 20, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  border-radius: 6px;
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.modal-card h3 {
  font-size: 1.5rem;
  margin: 4px 0 6px;
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.input-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
}

.login-error {
  color: #ff5555;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* --- Responsive: Tablets --- */

@media (max-width: 1000px) {
  .topbar {
    gap: 18px;
  }

  .topbar nav {
    gap: 16px;
  }

  .hero {
    gap: 28px;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.3rem);
  }

  .art {
    flex-basis: 280px;
    width: 280px;
    transform: scale(0.92);
    transform-origin: center right;
  }
}

/* --- Responsive: Small Tablets and Phones --- */

@media (max-width: 680px) {
  :root {
    --header-height: auto;
  }

  html {
    scroll-padding-top: 125px;
  }

  .topbar {
    padding: 13px 5%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .brand .logo {
    width: 28px;
    height: 28px;
  }

  .topbar nav {
    order: 3;
    width: 100%;
    gap: 20px;
    overflow-x: auto;
    padding: 2px 0 5px;
    scrollbar-width: thin;
  }

  .topbar nav a {
    font-size: 0.86rem;
  }

  .user-actions {
    gap: 8px;
  }

  .user-display {
    font-size: 0.78rem;
  }

  .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .hero {
    padding: 52px 5% 40px;
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
  }

  .hero-copy {
    width: 100%;
    max-width: none;
  }

  .hero h1 {
    font-size: clamp(2.25rem, 9vw, 3.1rem);
    letter-spacing: -1px;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 22px;
  }

  .actions {
    gap: 10px;
  }

  .actions .btn {
    flex: 0 1 auto;
  }

  .art {
    width: min(100%, 320px);
    height: 335px;
    flex: none;
    align-self: center;
    margin: 0 auto;
    transform: none;
  }

  .mock.front {
    width: min(260px, 88%);
  }

  .mock:not(.front) {
    width: min(235px, 80%);
  }

  .video {
    height: 175px;
  }

  .section {
    padding: 55px 5%;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
  }

  .section-head h2 {
    font-size: 1.8rem;
  }

  .feed {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .feed-card .thumb {
    height: auto;
    min-height: 180px;
    aspect-ratio: 16 / 10;
  }

  .feed-body {
    padding: 15px;
  }

  .feed-body h3 {
    font-size: 1rem;
  }

  .creator-band {
    padding: 38px 5%;
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
  }

  .creator-band h2 {
    font-size: 1.55rem;
  }

  .creator-band .btn {
    max-width: 100%;
  }

  .features h2 {
    font-size: 1.9rem;
    margin-bottom: 28px;
  }

  .feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
  }

  .feature-grid article {
    padding: 21px;
  }

  .download {
    padding: 55px 5%;
  }

  .download h2 {
    font-size: 1.9rem;
  }

  .download-action {
    max-width: 100%;
  }

  .adsense-container {
    width: 90%;
    margin: 28px auto;
    padding: 12px;
  }

  .ad-placeholder {
    min-height: 90px;
  }

  .legal-page {
    width: 90%;
    padding: 42px 0 56px;
  }

  .legal-page h1 {
    font-size: 2.2rem;
  }

  .legal-page h2 {
    font-size: 1.15rem;
  }

  .legal-page p,
  .legal-page li {
    font-size: 0.94rem;
  }

  footer {
    padding: 30px 5%;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .footer-links {
    gap: 12px 18px;
  }

  footer small {
    margin-top: 2px;
  }

  .modal-card {
    padding: 28px 20px;
  }
}

/* --- Responsive: Very Small Phones --- */

@media (max-width: 380px) {
  .topbar nav {
    gap: 15px;
  }

  .topbar nav a {
    font-size: 0.82rem;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
  }

  .art {
    height: 310px;
  }

  .video {
    height: 155px;
  }

  .section-head h2 {
    font-size: 1.6rem;
  }

  .footer-links {
    gap: 10px 14px;
  }
}

/* --- Accessibility: Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .feed-card:hover,
  .feature-grid article:hover,
  .btn:active {
    transform: none;
  }
}

/* Megavallia feed: keep creator avatars small */
.feed-card .feed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feed-card .feed-avatar {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  max-width: 44px;
  min-height: 44px;
  max-height: 44px;
  flex: 0 0 44px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Keep post images and videos separate from profile pictures */
.feed-card .thumb {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
}

.feed-card .thumb img,
.feed-card .thumb video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
