/* ============================================================
   Marence Apps — Design System
   Style: matches marence.at/toni
   Theme: automatic dark / light via prefers-color-scheme
   ============================================================ */

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
  --bg:           #f2f2f7;
  --surface:      #ffffff;
  --card:         #ffffff;
  --accent:       #4a6cf7;
  --accent-hover: #3b5bdb;
  --text:         #111111;
  --text-muted:   #6b7280;
  --border:       rgba(0, 0, 0, 0.08);
  --nav-bg:       rgba(242, 242, 247, 0.85);

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 32px rgba(74,108,247,0.18);
  --radius-card:  14px;
  --radius-pill:  50px;
  --radius-icon:  22.37%;
  --nav-height:   64px;

  --transition:   0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #111111;
    --surface:      #1a1a1a;
    --card:         #1e1e1e;
    --accent:       #4a6cf7;
    --accent-hover: #6b8bff;
    --text:         #f5f5f5;
    --text-muted:   #9ca3af;
    --border:       rgba(255,255,255,0.07);
    --nav-bg:       rgba(17,17,17,0.85);

    --shadow-sm:    0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.18);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.35);
    --shadow-hover: 0 8px 32px rgba(74,108,247,0.25);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 52px + 24px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a   { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ── Layout helpers ──────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 64px 0; }
section + section { padding-top: 0; }

/* ── Navigation ──────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav__logo-icon {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  overflow: hidden;
}

.nav__links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.nav__links a:hover,
.nav__links a.is-active {
  color: var(--accent);
  background: rgba(74,108,247,0.1);
}

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav__burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile nav drawer */
.nav__drawer {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
  gap: 4px;
}

.nav__drawer.is-open { display: flex; }

.nav__drawer a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: background var(--transition);
}

.nav__drawer a:hover {
  background: rgba(74,108,247,0.08);
  color: var(--accent);
}

/* ── Typography ──────────────────────────────────────────── */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
  line-height: 1.25;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(74,108,247,0.12);
  color: var(--accent);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

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

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--sm {
  padding: 6px 16px;
  font-size: 0.8125rem;
}

.btn--lg {
  padding: 14px 32px;
  font-size: 1rem;
}

.btn--icon {
  padding: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* App Store badge button */
.btn--appstore {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.btn--appstore:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card--hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* ── App Icon ─────────────────────────────────────────────── */
.app-icon {
  border-radius: var(--radius-icon);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 2em;
  line-height: 1;
  background: var(--surface);
  border: 1px solid var(--border);
}

.app-icon--sm  { width: 56px;  height: 56px;  font-size: 1.6rem; }
.app-icon--md  { width: 80px;  height: 80px;  font-size: 2.2rem; }
.app-icon--lg  { width: 112px; height: 112px; font-size: 3rem;   }

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}

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

/* ── Flash messages ──────────────────────────────────────── */
.flash-wrap {
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
}

.flash {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.flash--success {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border-bottom-color: rgba(34, 197, 94, 0.2);
}

.flash--error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-bottom-color: rgba(239, 68, 68, 0.18);
}

@media (prefers-color-scheme: dark) {
  .flash--success { color: #4ade80; }
  .flash--error   { color: #f87171; }
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: 96px 0 72px;
  text-align: center;
}

.hero__eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero__title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text);
}

.hero__title em {
  font-style: normal;
  color: var(--accent);
}

.hero__subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── App Grid (Hub Page) ─────────────────────────────────── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding-bottom: 80px;
}

.app-card {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-decoration: none;
  color: inherit;
}

.app-card:hover { text-decoration: none; }

.app-card__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.app-card__meta {
  flex: 1;
  min-width: 0;
}

.app-card__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card__tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.app-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* ── App Detail ───────────────────────────────────────────── */
.app-hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
}

.app-hero__inner {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.app-hero__body {
  flex: 1;
  min-width: 0;
}

.app-hero__name {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.app-hero__tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.app-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ── Features list ───────────────────────────────────────── */
.features-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 0;
  margin-top: 24px;
}

.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
}

.features-list li::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 6l3 3 5-5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Description prose ───────────────────────────────────── */
.prose {
  font-size: 0.9875rem;
  color: var(--text);
  line-height: 1.75;
  max-width: 720px;
}

.prose p + p { margin-top: 1rem; }
.prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  color: var(--text);
}
.prose h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}
.prose ul, .prose ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}
.prose li { margin: 0.35rem 0; }
.prose strong { font-weight: 700; }
.prose a { color: var(--accent); }

/* ── Page tabs (sticky below nav) ────────────────────────── */
.page-tabs-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.page-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }

.page-tab {
  padding: 14px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}

.page-tab:hover {
  color: var(--text);
  text-decoration: none;
}

.page-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Legal pages (privacy, terms) ────────────────────────── */
.legal-page {
  padding: 64px 0 96px;
}

.legal-page__meta {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.legal-page__meta p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Contact Form section ────────────────────────────────── */
.contact-section {
  padding: 64px 0 96px;
}

.contact-form {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 0;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer__brand {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.footer__copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  list-style: none;
}

.footer__links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer__links a:hover { color: var(--accent); }

/* ── Back link ───────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--transition);
  margin-bottom: 32px;
  margin-top: 28px;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.back-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Screenshots gallery ─────────────────────────────────── */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.screenshot {
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

.screenshots-placeholder {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 24px;
}

/* ── 404 page ────────────────────────────────────────────── */
.error-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}

.error-page__code {
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  opacity: 0.2;
  margin-bottom: 16px;
}

.error-page__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-page__text {
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Utilities ───────────────────────────────────────────── */
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mt-48 { margin-top: 48px; }

.mb-8  { margin-bottom: 8px;  }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

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

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav__links  { display: none; }
  .nav__burger { display: flex; }

  .hero { padding: 64px 0 48px; }

  .app-hero__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .app-hero__actions { justify-content: center; }

  .contact-form { padding: 24px 20px; }

  .apps-grid { grid-template-columns: 1fr; }

  .features-list { grid-template-columns: 1fr; }

  section { padding: 48px 0; }
}

@media (max-width: 480px) {
  .container,
  .container--narrow { padding: 0 16px; }

  .hero__title { font-size: 2rem; }

  .section-title { font-size: 1.5rem; }

  .app-card { padding: 20px 18px; }

  .footer__inner { flex-direction: column; align-items: flex-start; }
}
