/* ==========================================================================
   FreeLater — static marketing site
   ==========================================================================
   Contents:
   1. Design tokens
   2. Base / typography
   3. Reusable: mesh gradients (.mesh-text / .mesh-icon)
   4. Reusable: glowing gradient borders (.glow + side modifiers)
   5. Buttons
   6. Header / nav
   7. Layout & sections
   8. Cards, steps, use cases
   9. Contact form
   10. Legal pages
   11. Footer
   12. Reveal animation
   13. Responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Lexend+Deca:wght@100..900&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@4.5.0/fonts/remixicon.css');

/* 1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #010116;
  --bg-soft: #0c0e20;
  --panel: rgba(16, 18, 40, 0.72);
  --panel-solid: #101228;
  --text: #eceefb;
  --muted: #9aa0c7;
  --line: rgba(154, 160, 199, 0.18);

  --cyan: #34e5ff;
  --teal: #3ff2c8;
  --blue: #4f7dff;
  --purple: #9b5cff;
  --magenta: #e14fff;
  --pink: #ff5ca8;

  --font-body: 'Inter', system-ui, sans-serif;
  --font-title: 'Lexend Deca', system-ui, sans-serif;

  --radius: 18px;
  --max-width: 1120px;

  /* Default mesh gradient — override --mesh on any element for a variant */
  --mesh:
    radial-gradient(120% 180% at 12% 20%, rgba(63, 242, 200, 0.95) 0%, transparent 45%),
    radial-gradient(140% 160% at 85% 10%, rgba(79, 125, 255, 0.95) 0%, transparent 55%),
    radial-gradient(130% 170% at 82% 95%, rgba(225, 79, 255, 0.95) 0%, transparent 55%),
    linear-gradient(110deg, #4f7dff 0%, #9b5cff 55%, #e14fff 100%);
}

/* 2. Base / typography
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-title);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
}

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

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

[hidden] {
  display: none !important;
}

.eyebrow {
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--muted);
}

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

/* Skip-link target; only ever focused programmatically */
main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  background: var(--panel-solid);
  color: var(--text);
  font-family: var(--font-title);
  font-size: 0.9rem;
  text-decoration: none;
  transform: translateY(-250%);
}

.skip-link:focus {
  transform: none;
}

/* 3. Reusable: mesh gradients
   --------------------------------------------------------------------------
   .mesh-text — clips the mesh gradient to the text (use on a <span> inside
                a heading to highlight words).
   .mesh-icon — paints the mesh gradient through an SVG mask. Set the icon:
                <span class="mesh-icon" style="--icon: url('icon.svg')"></span>
   Override the gradient anywhere with --mesh. */
.mesh-text {
  background-image: var(--mesh);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mesh-icon {
  display: inline-block;
  width: var(--icon-size, 30px);
  height: var(--icon-size, 30px);
  flex: none;
  background-image: var(--mesh);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* 4. Reusable: glowing gradient borders
   --------------------------------------------------------------------------
   Add .glow to any element (needs its own background to cover the centre).
     --glow-colors : n colours laid around the perimeter (conic gradient).
     --glow-angle  : where the first colour starts (default 140deg).
     --glow-width  : border thickness (default 1px).
     --glow-blur   : halo softness. --glow-opacity : halo strength.
   Which sides shine: add .glow-top / .glow-right / .glow-bottom / .glow-left
   / .glow-x / .glow-y, or set --glow-mask yourself. Default: all sides. */
.glow {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius);
}

.glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: var(--glow-width, 1px);
  background: conic-gradient(
    from var(--glow-angle, 140deg),
    var(--glow-colors, var(--cyan), var(--blue), var(--purple), var(--magenta), var(--cyan))
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  background: conic-gradient(
    from var(--glow-angle, 140deg),
    var(--glow-colors, var(--cyan), var(--blue), var(--purple), var(--magenta), var(--cyan))
  );
  filter: blur(var(--glow-blur, 14px));
  opacity: var(--glow-opacity, 0.6);
  /* evenodd frame: keep only the halo that spills outside the element */
  clip-path: polygon(
    evenodd,
    -48px -48px,
    calc(100% + 48px) -48px,
    calc(100% + 48px) calc(100% + 48px),
    -48px calc(100% + 48px),
    -48px -48px,
    0 0,
    100% 0,
    100% 100%,
    0 100%,
    0 0
  );
  -webkit-mask-image: var(--glow-mask, none);
  mask-image: var(--glow-mask, none);
  pointer-events: none;
}

.glow-top    { --glow-mask: linear-gradient(to bottom, #000 25%, transparent 65%); }
.glow-bottom { --glow-mask: linear-gradient(to top, #000 25%, transparent 65%); }
.glow-left   { --glow-mask: linear-gradient(to right, #000 25%, transparent 65%); }
.glow-right  { --glow-mask: linear-gradient(to left, #000 25%, transparent 65%); }
.glow-x      { --glow-mask: linear-gradient(to right, #000 12%, transparent 42% 58%, #000 88%); }
.glow-y      { --glow-mask: linear-gradient(to bottom, #000 12%, transparent 42% 58%, #000 88%); }

/* 5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: none;
  text-decoration: none;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.btn-primary {
  background: linear-gradient(115deg, var(--blue), var(--purple) 60%, var(--magenta));
  box-shadow: 0 6px 24px rgba(123, 92, 255, 0.35);
  /* dark text: the gradient is too bright for --text to meet WCAG AA */
  color: var(--bg);
  font-weight: 600;
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(123, 92, 255, 0.5);
}

.btn-ghost {
  background: var(--panel-solid);
  --glow-opacity: 0.35;
}

/* Store badges */
.store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: inherit;
  gap: 1rem;
  margin-top: 2rem;
}

.store-badges a {
  display: inline-flex;
  border-radius: 8px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-badges a:hover {
  transform: translateY(-2px);
}

.store-badges img {
  display: block;
  height: 48px;
  width: auto;
}

/* 6. Header / nav
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(6, 7, 20, 0.75);
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  margin-right: auto;
}

.brand img {
  height: 36px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.site-nav a {
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.site-nav .btn {
  padding: 0.5rem 1.1rem;
  color: var(--text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* 7. Layout & sections
   -------------------------------------------------------------------------- */
main {
  overflow-x: clip;
}

.section {
  position: relative;
  padding: 7rem 1.25rem;
}

.section > .inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Background images render at their natural aspect ratio, stretched to the
   full section width, and may overflow the section vertically. They sit
   under every section's text (z-index 0 vs the .inner's 1). */
img.bg {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: auto;
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}

/* Bottom-anchored variants: sit on the section's bottom edge, overflow up */
img.bg-left,
img.bg-right,
img.bg-center {
  top: auto;
  bottom: 0;
  transform: none;
}

.section.center {
  text-align: center;
}

.section.center .inner {
  max-width: 780px;
}

.section .lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 46ch;
}

.section.center .lead {
  margin-inline: auto;
}

/* Split layout: text one side, media slot the other */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.split.reverse .copy {
  order: 2;
}

.split.reverse .media-slot {
  order: 1;
}

/* Placeholder for screenshots to be added later */
.media-slot {
  min-height: 460px;
  border-radius: 24px;
  border: 1px dashed rgba(154, 160, 199, 0.25);
  background: radial-gradient(
    80% 80% at 50% 50%,
    rgba(79, 125, 255, 0.1),
    transparent 70%
  );
}

/* Temporary: graphics not ready. Hide the empty media slots and collapse the
   split layout to a single column. Delete this block when screenshots land. */
.media-slot {
  display: none;
}

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

/* Hero */
.hero {
  padding-top: 11rem;
  min-height: min(92vh, 860px);
  display: flex;
  align-items: center;
}

.hero .copy p {
  max-width: 52ch;
}

/* 8. Icon features, steps, use cases
   -------------------------------------------------------------------------- */
/* Large centered icon with centered text below — no borders or backgrounds */
.icon-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2rem;
  margin-top: 4rem;
  text-align: center;
}

.feature-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.icon-features h3 {
  margin: 1rem 0 0.4rem;
}

.icon-features p {
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 34ch;
}

/* Numbered steps */
.steps {
  display: grid;
  gap: 1.1rem;
  margin-top: 2.5rem;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}

.step-num {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-solid);
  --glow-opacity: 0.4;
  --glow-blur: 10px;
}

.steps h3 {
  margin: 0 0 0.15rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Icon bullets with text on the right — no borders or backgrounds */
.use-case-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.25rem 3.5rem;
  margin-top: 3.5rem;
  padding: 0;
  list-style: none;
  text-align: left;
}

.use-case-list li {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
}

.bullet-icon {
  font-size: 1.9rem;
  line-height: 1.3;
}

.use-case-list h3 {
  margin: 0 0 0.25rem;
}

.use-case-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* 9. Contact form
   -------------------------------------------------------------------------- */
.contact-card {
  background: rgba(16, 18, 40, 0.85);
  padding: 2.5rem;
  max-width: 560px;
  margin: 3rem auto 0;
  text-align: left;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-family: var(--font-title);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.15s ease;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 0;
  border-color: var(--cyan);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.form-status {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.form-status.success {
  color: var(--teal);
}

.form-status.error {
  color: var(--pink);
}

/* 10. Legal pages
   -------------------------------------------------------------------------- */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 10rem 1.25rem 6rem;
}

.legal h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.legal h2 {
  font-size: 1.3rem;
  margin-top: 2.5rem;
}

.legal p,
.legal li {
  color: var(--muted);
}

.legal .updated {
  font-size: 0.85rem;
  margin-bottom: 3rem;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.legal th,
.legal td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
  color: var(--muted);
}

.legal th {
  color: inherit;
}

/* Column-header labels injected into each cell; only shown on the mobile
   stacked layout, hidden while the real header row is visible. */
.legal .legal-cell-label {
  display: none;
}

/* 11. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 3.5rem 1.25rem 2.5rem;
}

.site-footer .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer .brand img {
  height: 30px;
}

.site-footer .tagline {
  max-width: 38ch;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.75rem;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

.copyright {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

/* 12. Reveal animation
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Forced colors (e.g. Windows High Contrast): gradient-clipped text and the
   hamburger lines rely on backgrounds, which forced-colors removes */
@media (forced-colors: active) {
  .mesh-text {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: inherit;
  }

  .nav-toggle span {
    background: CanvasText;
  }
}

/* 13. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .split {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .split.reverse .copy {
    order: 1;
  }

  .split.reverse .media-slot {
    order: 2;
  }

  .media-slot {
    min-height: 260px;
  }

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

@media (max-width: 720px) {
  .section {
    padding: 4.5rem 1.25rem;
  }

  /* Multi-column legal tables overflow narrow screens; collapse each row
     into a stacked card and surface the header inside each cell. */
  .legal table,
  .legal tbody,
  .legal tr,
  .legal td {
    display: block;
    width: 100%;
  }

  .legal thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .legal tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0.75rem 0;
    padding: 0.25rem 0.75rem;
    overflow-wrap: anywhere;
  }

  .legal td {
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }

  .legal td:last-child {
    border-bottom: none;
  }

  .legal .legal-cell-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.7;
    margin-bottom: 0.15rem;
  }

  .hero {
    padding-top: 8rem;
    min-height: 0;
  }

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

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(6, 7, 20, 0.97);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1.25rem 1.25rem;
    display: none;
  }

  .site-nav a {
    padding: 0.8rem 0;
  }

  .site-header.nav-open .site-nav {
    display: flex;
  }

  .site-header.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .site-header.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .contact-card {
    padding: 1.5rem;
  }
}
