/* TagMyLove Match! — premium product manual
   Drop in as /public/styles/manual.css. No markup changes required.
   Designed to coexist with homepage.css, loaded before this file.
*/

:root {
  /* Reuse the exact RGB tokens defined by homepage.css. */
  --manual-bg: rgb(var(--black));
  --manual-surface: #111; /* same dark surface as homepage footer */
  --manual-surface-deep: rgb(var(--black));
  --manual-line: rgba(var(--gray), .22);
  --manual-ink: rgb(var(--white));
  --manual-muted: rgb(var(--gray));
  --manual-pink: rgb(var(--pink));
  --manual-pink-soft: rgba(var(--pink), .11);
  --manual-radius: 26px;
  --manual-content: 1160px;
}

html { scroll-behavior: smooth; }
body.day {
  background: var(--manual-bg);
  color: var(--manual-ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.day::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 920px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 37% at 86% 9%, rgba(var(--dark-pink), .19), transparent 75%),
    radial-gradient(ellipse 46% 36% at 12% 33%, rgba(var(--dark-blue), .12), transparent 72%);
}
body.day, body.day * { box-sizing: border-box; }
body.day ::selection { color: rgb(var(--black)); background: var(--manual-pink); }

/* Top brand strip */
body.day > header.width-limit {
  position: relative;
  width: min(calc(100% - 48px), var(--manual-content));
  max-width: none;
  min-height: 92px;
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--manual-line);
}
body.day > header .logo a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--manual-ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.04em;
  font-size: 1.12rem;
}
body.day > header .logo img { display: block; width: 36px; height: 36px; object-fit: contain; }
body.day > header .logo a:hover { color: var(--manual-pink); }

/* Intro */
body.day > main[role="main"] {
  width: min(calc(100% - 48px), var(--manual-content));
  max-width: none;
  margin: 0 auto;
  padding: clamp(56px, 9vw, 116px) 0 120px;
}
body.day > main[role="main"] > h1 {
  max-width: 900px;
  margin: 0 0 clamp(68px, 10vw, 120px);
  padding: 0 0 35px;
  position: relative;
  color: var(--manual-ink);
  font-size: clamp(2.75rem, 6.5vw, 6.1rem);
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: -.065em;
  text-wrap: balance;
}
body.day > main[role="main"] > h1::before {
  content: "TAGMYLOVE / MATCH!";
  display: block;
  margin-bottom: 25px;
  color: var(--manual-pink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .74rem;
  letter-spacing: .21em;
  line-height: 1.4;
  font-weight: 650;
}
body.day > main[role="main"] > h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 76px;
  height: 2px;
  background: linear-gradient(90deg, var(--manual-pink), rgba(var(--pink), 0));
}

/* Each chapter: editorial text + cinematic animation panel */
body.day > main[role="main"] > section {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  column-gap: clamp(28px, 5vw, 88px);
  align-items: center;
  padding: clamp(42px, 7vw, 90px) 0;
  margin: 0;
  border-top: 1px solid var(--manual-line);
  isolation: isolate;
}
body.day > main[role="main"] > section > h2,
body.day > main[role="main"] > section > p,
body.day > main[role="main"] > section > ul,
body.day > main[role="main"] > section > ol {
  grid-column: 1;
  min-width: 0;
}
body.day > main[role="main"] > section > h2 {
  margin: 0 0 20px;
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  line-height: 1.17;
  letter-spacing: -.042em;
  font-weight: 630;
  color: var(--manual-ink);
  text-wrap: balance;
}
body.day > main[role="main"] > section > p,
body.day > main[role="main"] > section > ul,
body.day > main[role="main"] > section > ol {
  margin-top: 0;
  margin-bottom: 0;
  color: var(--manual-muted);
  font-size: clamp(.98rem, 1.28vw, 1.1rem);
  line-height: 1.85;
}
body.day > main[role="main"] > section > h2 + p,
body.day > main[role="main"] > section > h2 + ol,
body.day > main[role="main"] > section > h2 + ul { margin-top: 0; }
body.day > main[role="main"] > section > p + ul { margin-top: 18px; }
body.day > main[role="main"] > section li { padding-left: .45em; margin: 0 0 12px; }
body.day > main[role="main"] > section li::marker { color: var(--manual-pink); }
body.day > main[role="main"] > section :is(ul, ol) { padding-left: 1.4em; }
body.day > main[role="main"] > section strong { color: rgb(var(--white)); font-weight: 700; }
body.day > main[role="main"] > section a {
  color: var(--manual-pink);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
body.day > main[role="main"] > section a:hover { color: rgb(var(--light-purple)); }
body.day > main[role="main"] > section a:focus-visible,
body.day > header a:focus-visible { outline: 2px solid var(--manual-pink); outline-offset: 5px; border-radius: 4px; }
body.day > main[role="main"] > section ol > i {
  display: block;
  margin: 12px 0 4px;
  padding: 14px 18px;
  border-left: 2px solid var(--manual-pink);
  border-radius: 0 10px 10px 0;
  background: var(--manual-pink-soft);
  color: rgb(var(--gray));
  font-style: normal;
  font-size: .94rem;
}

/* Preserve current EJS structure: animation is a direct section child. */
body.day > main[role="main"] > section > [data-animation] {
  grid-column: 2;
  grid-row: 1 / span 5;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 340px;
  aspect-ratio: 1.18;
  overflow: hidden;
  border: 1px solid rgba(var(--white), .10);
  border-radius: var(--manual-radius);
  background:
    radial-gradient(circle at 50% 48%, rgba(var(--dark-pink), .105), transparent 52%),
    radial-gradient(circle at 80% 5%, rgba(var(--dark-blue), .13), transparent 45%),
    linear-gradient(150deg, var(--manual-surface), var(--manual-surface-deep) 72%);
  box-shadow: 0 28px 65px rgba(var(--black), .24), inset 0 1px 0 rgba(var(--white), .045);
}
body.day > main[role="main"] > section > [data-animation]::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 16px;
  border: 1px solid rgba(var(--white), .045);
  border-radius: calc(var(--manual-radius) - 11px);
  pointer-events: none;
}
body.day [data-animation] > [data-lottie],
body.day [data-animation] > video,
body.day [data-animation] > noscript {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
body.day [data-animation] video { display: block; object-fit: contain; }
body.day [data-animation] [data-lottie] svg { display: block; width: 100% !important; height: 100% !important; }
body.day [data-animation] img { max-width: 100%; height: auto; display: block; }
/* Vital: don't override the hidden attribute toggled by Lottie fallback JS. */
body.day [data-animation] > [hidden] { display: none !important; }

/* A smaller visual change of rhythm for consecutive chapters */
@media (min-width: 901px) {
  body.day > main[role="main"] > section:nth-of-type(even) { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  body.day > main[role="main"] > section:nth-of-type(even) > :not([data-animation]) { grid-column: 2; }
  body.day > main[role="main"] > section:nth-of-type(even) > [data-animation] { grid-column: 1; }
}
@media (max-width: 900px) {
  body.day > main[role="main"] > section { grid-template-columns: minmax(0, 1fr); gap: 0; }
  body.day > main[role="main"] > section > :is(h2,p,ul,ol),
  body.day > main[role="main"] > section > [data-animation] { grid-column: 1; }
  body.day > main[role="main"] > section > [data-animation] {
    grid-row: auto;
    margin-top: 28px;
    min-height: 0;
    aspect-ratio: 1.35;
  }
}
@media (max-width: 540px) {
  body.day > header.width-limit { width: min(calc(100% - 36px), var(--manual-content)); min-height: 76px; }
  body.day > main[role="main"] { width: min(calc(100% - 36px), var(--manual-content)); padding: 64px 0 90px; }
  body.day > main[role="main"] > h1 { margin-bottom: 68px; padding-bottom: 27px; }
  body.day > main[role="main"] > h1::before { font-size: .66rem; letter-spacing: .15em; }
  body.day > main[role="main"] > section { padding: 42px 0 48px; }
  body.day > main[role="main"] > section > h2 { margin-bottom: 13px; }
  body.day > main[role="main"] > section > [data-animation] { aspect-ratio: 1.1; border-radius: 19px; }
  body.day > main[role="main"] > section > [data-animation]::after { inset: 11px; border-radius: 11px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

[hidden] {
  display: none !important;
}

/* Плавная прокрутка */
html {
  scroll-behavior: smooth;
}

/* Оглавление */
.manual-toc {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 900px;
  margin: 32px auto 64px;
}

.manual-toc a {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid rgba(var(--white), 0.1);
  border-radius: 12px;
  background: rgba(var(--white), 0.04);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.manual-toc a:hover,
.manual-toc a:focus-visible {
  background: rgba(var(--pink), 0.08);
  border-color: rgba(var(--pink), 0.5);
}

/* Отступ при переходе */
main section[id] {
  scroll-margin-top: 30px;
}

/* Мобильная версия */
@media (max-width: 640px) {
  .manual-toc {
    grid-template-columns: 1fr;
    margin-bottom: 40px;
  }
}

/* Учитываем настройки доступности */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* Clean manual lists: override decorative dashes from homepage.css. */
body.day > main[role="main"] > section > ol,
body.day > main[role="main"] > section > ul {
  list-style-position: outside;
  padding-left: 1.65em;
}

body.day > main[role="main"] > section > ol {
  list-style-type: decimal;
}

body.day > main[role="main"] > section > ul {
  list-style-type: disc;
}

body.day > main[role="main"] > section > ol > li,
body.day > main[role="main"] > section > ul > li {
  display: list-item;
  padding-left: .25em;
  margin-bottom: 16px;
  text-indent: 0;
}

/* Suppress the extra dash; retain genuine list markers. */
body.day > main[role="main"] > section > ol > li::before,
body.day > main[role="main"] > section > ul > li::before {
  content: none !important;
  display: none !important;
}

body.day > main[role="main"] > section > ol > li::marker,
body.day > main[role="main"] > section > ul > li::marker {
  color: var(--manual-pink);
}

/* Animation media fills the panel without a bottom gap. */
body.day > main[role="main"] > section > [data-animation] {
  aspect-ratio: 1.28;
  min-height: 0;
  display: block;
  overflow: hidden;
}

body.day [data-animation] > [data-lottie],
body.day [data-animation] > video,
body.day [data-animation] > noscript {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

body.day [data-animation] > video {
  display: block;
  object-fit: cover;
  aspect-ratio: auto;
}

body.day [data-animation] > [data-lottie] canvas,
body.day [data-animation] > [data-lottie] svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

body.day [data-animation] > noscript img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.day [data-animation] > [hidden] { display: none !important; }

/* Brand gradients from homepage.css (.match). */
body.day > main[role="main"] > h1 {
  background: linear-gradient(to top, rgb(var(--light-purple)), rgb(var(--purple)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.day > main[role="main"] > section > h2 {
  background: linear-gradient(to top, rgb(var(--white)), rgb(var(--gray)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.day > main[role="main"] > h1::before {
  background: none;
  -webkit-text-fill-color: rgb(var(--pink));
}
body.day > main[role="main"] > section a:hover,
.manual-toc a:hover { color: rgb(var(--light-purple)); }
