/*
  DmytroApps / Rillowen — shared stylesheet.
  Plain CSS, no build step, no framework. Custom properties define the design
  system (colors, spacing, radii); components below use them exclusively so
  light/dark mode and any future palette tweak stay centralized here.
*/

:root {
  /* Light mode palette — warm off-white matched to the Rillowen app icon
     background, with a darkened version of the icon's blue as the accent.
     #2f6fb0 (not the icon's literal #4f8fd1) is used specifically so link
     text reaches WCAG AA (>=4.5:1) against both --background and --surface:
     ~4.88:1 on --background (#faf7f1) and ~5.22:1 on --surface (#ffffff). */
  --background: #faf7f1;
  --surface: #ffffff;
  --surface-muted: #f3ede1;
  --text-primary: #2a2a28;
  --text-secondary: #6b6862;
  --accent: #2f6fb0;
  --border: #e5ddcd;
  --focus-ring: #2f6fb0;

  --radius-small: 6px;
  --radius-medium: 14px;
  --radius-large: 24px;

  --content-width: 1080px;
  --content-width-narrow: 720px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #16181b;
    --surface: #1e2126;
    --surface-muted: #24272c;
    --text-primary: #edeae2;
    --text-secondary: #a5a199;
    --accent: #7bb3ea;
    --border: #2c2f34;
    --focus-ring: #7bb3ea;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 1.0625rem;
}

img {
  max-width: 100%;
  display: block;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 4vw + 1rem, 3rem);
  margin: 0 0 var(--space-3);
}

h2 {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  margin: 0 0 var(--space-3);
}

h3 {
  font-size: 1.15rem;
  margin: 0 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
  color: var(--text-secondary);
}

/* Skip link — visible only on keyboard focus */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-3);
  background: var(--surface);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  z-index: 100;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--space-3);
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container--narrow {
  max-width: var(--content-width-narrow);
}

/* Header / nav */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 650;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-small);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

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

/* Badge placeholder (App Store CTA stand-in until a real URL exists) */

.badge-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-medium);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border: 1px dashed var(--border);
}

/* Hero */

.hero {
  padding: var(--space-7) 0 var(--space-6);
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  /* Vertically centers the text column against the screenshot once the
     two-column layout kicks in below, so the middle of the text block
     lines up with the middle of the image. On the single-column mobile
     layout this has no visible effect (each item sizes to its own row). */
  align-items: center;
}

@media (min-width: 900px) {
  .hero .container {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.hero-copy,
.hero-media {
  /* Defensive: grid items default to an automatic min-width based on their
     content, which for an image-containing item can be its intrinsic
     size. Without this, a future larger/undersized image could force this
     row wider than the viewport at narrow widths. */
  min-width: 0;
}

.hero-copy .tagline {
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 500;
}

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

/* Screenshot frame — sized to the real iPhone screenshot aspect ratio
   (1320:2868) so no layout shift occurs while the image loads, and no
   cropping/letterboxing occurs once it has. Reused by the hero screenshot
   and each scene card below. */

.screenshot-frame {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 1320 / 2868;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  overflow: hidden;
  box-shadow: 0 24px 48px -28px rgba(20, 20, 18, 0.35);
}

.screenshot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Scenes grid — real screenshots of each scene. */

.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  /* It's a <ul>: reset the browser's default 40px left padding, which
     otherwise shifts the whole grid right of the section heading/intro. */
  list-style: none;
  margin: var(--space-5) 0 0;
  padding: 0;
}

@media (min-width: 700px) {
  .scene-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.scene-card {
  /* Same defensive automatic-min-width override as .hero-media above. */
  min-width: 0;
  border-radius: var(--radius-large);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.scene-card__frame {
  aspect-ratio: 1320 / 2868;
  width: 100%;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 18, 0.04);
}

.scene-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scene-card__body {
  padding: var(--space-3);
  /* Centers the caption under the screenshot above it, on the same
     vertical axis as the image (which fills the full card width). */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.scene-card__name {
  font-weight: 600;
  color: var(--text-primary);
  /* Stacks the Free/Premium tag under the scene name, centered, rather
     than spreading them apart — reads cleaner at narrow (2-column mobile
     grid) card widths than trying to fit both on one centered line. */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.scene-card__tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-radius: var(--radius-small);
  padding: 2px var(--space-2);
}

/* Sections */

.section {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border);
}

/* First section under a page's h1 (e.g. Privacy/Support intro): no top
   border (nothing to separate from above it) and no bottom padding (the
   next .section already adds its own top padding). */
.section--flush {
  border-top: none;
  padding-bottom: 0;
}

.section-intro {
  max-width: 640px;
}

/* Justify the longer marketing-section intro paragraphs so the right edge
   reads neater — scoped to .section-intro so headings, the hero tagline,
   captions, and narrow cards elsewhere on the page are unaffected. */
.section-intro p {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  text-wrap: pretty;
}

.feature-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 700px) {
  .feature-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  padding: var(--space-4);
  color: var(--text-secondary);
}

.feature-list strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: var(--space-6);
  color: var(--text-secondary);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-grid {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (min-width: 700px) {
  .plan-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  padding: var(--space-5);
  background: var(--surface);
}

.plan-card h3 {
  margin-bottom: var(--space-2);
}

.plan-card ul {
  margin: var(--space-3) 0 0;
  padding-left: 1.1em;
  color: var(--text-secondary);
}

.plan-card li {
  margin-bottom: var(--space-1);
}

.price-slot {
  margin-top: var(--space-3);
  font-weight: 600;
  color: var(--text-primary);
}

/* App list / cards on root page */

.app-card {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  padding: var(--space-5);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}

.app-card img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-medium);
  flex-shrink: 0;
}

.app-card__copy {
  flex: 1 1 220px;
}

.app-card__copy h2 {
  margin-bottom: var(--space-1);
}

.app-card__copy p {
  margin-bottom: 0;
}

/* Prose (privacy / support content) */

.prose h2 {
  margin-top: var(--space-6);
}

.prose h2:first-of-type {
  margin-top: 0;
}

.prose ul {
  color: var(--text-secondary);
}

/* Justify Privacy/Support body copy (paragraphs and list items) for a
   neater right edge. Single-line items (e.g. the standalone mailto address
   paragraph, or short list entries) are unaffected in practice — CSS never
   stretches the last (only) line of justified text. Headings, the FAQ
   question text (<h3>), and everything outside .prose (nav, footer) stay
   left-aligned since they aren't matched by this selector. */
.prose p,
.prose li {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  text-wrap: pretty;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: var(--space-4) 0;
}

.faq-item:first-child {
  border-top: none;
  padding-top: 0;
}

.faq-item h3 {
  color: var(--text-primary);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  color: var(--text-secondary);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.site-footer nav a {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

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

.site-footer p {
  margin: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
