/* ==========================================================================
   My Diary — mydiary.habitics.net
   Habitics s.r.o.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
:root {
  --bg:            #fff8f6;
  --bg-tint:       #ffeef1;
  --surface:       #ffffff;
  --surface-2:     #fdf2ef;
  --ink:           #241e38;
  --ink-soft:      #5c5570;
  --muted:         #8b8399;
  --brand:         #e15c8a;
  --brand-strong:  #c94873;
  --brand-soft:    #ffe4ec;
  --accent:        #7c6cf0;
  --accent-soft:   #eeeaff;
  --border:        #f2e4e0;
  --shadow-sm:     0 1px 2px rgba(36, 30, 56, .06), 0 2px 8px rgba(36, 30, 56, .04);
  --shadow-md:     0 4px 12px rgba(36, 30, 56, .07), 0 12px 32px rgba(36, 30, 56, .06);
  --shadow-lg:     0 8px 24px rgba(36, 30, 56, .09), 0 24px 64px rgba(36, 30, 56, .08);
  --radius:        16px;
  --radius-lg:     24px;
  --maxw:          1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #17131f;
    --bg-tint:      #221a2c;
    --surface:      #201a2b;
    --surface-2:    #281f35;
    --ink:          #f5eff7;
    --ink-soft:     #c2b8cf;
    --muted:        #958ba4;
    --brand:        #ff7fa8;
    --brand-strong: #ff9dbd;
    --brand-soft:   #3b2130;
    --accent:       #a99bff;
    --accent-soft:  #2b2440;
    --border:       #342a44;
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:    0 4px 12px rgba(0, 0, 0, .45);
    --shadow-lg:    0 8px 24px rgba(0, 0, 0, .5);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-strong); }
a:hover { color: var(--brand); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 780; }
h3 { font-size: 1.12rem; font-weight: 700; }
p  { margin: 0; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* Len vertikalny padding. Skratka `padding: ... 0` tu prebijala bocny
   gutter z .wrap na prvkoch, ktore maju obe triedy (napr. privacy band
   <div class="wrap section">), takze text na mobile lezal na hrane. */
.section { padding-top: clamp(56px, 9vw, 104px); padding-bottom: clamp(56px, 9vw, 104px); }
section[id] { scroll-margin-top: 84px; }

.section-head { max-width: 640px; margin: 0 auto clamp(36px, 5vw, 56px); text-align: center; }
.section-head p { margin-top: 14px; color: var(--ink-soft); font-size: 1.05rem; }

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand-strong);
  margin-bottom: 12px;
}

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow-sm); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
}
.nav-links a:hover { color: var(--brand-strong); }

@media (max-width: 720px) { .nav-links { display: none; } }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(225, 92, 138, .35);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 40%, transparent);
}
.btn-primary:hover { background: var(--brand-strong); color: #fff; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--brand); }

/* Store badges */
.stores { display: flex; flex-wrap: wrap; gap: 14px; }

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px 11px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform .15s ease, opacity .15s ease;
}
.store-btn:hover { transform: translateY(-2px); color: #fff; opacity: .92; }
.store-btn svg { width: 26px; height: 26px; flex: none; fill: currentColor; }
.store-btn span { display: block; line-height: 1.15; }
.store-btn .s-top { font-size: .68rem; opacity: .8; letter-spacing: .02em; }
.store-btn .s-bot { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

@media (prefers-color-scheme: dark) {
  .store-btn { background: var(--surface-2); border: 1px solid var(--border); }
}

/* --- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(56px, 8vw, 92px) 0 clamp(48px, 7vw, 76px);
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 50% auto;
  width: 900px;
  height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--bg-tint) 0%, transparent 62%);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 22px;
}
.pill img { width: 20px; height: 20px; flex: none; }

.hero h1 { max-width: 15ch; margin: 0 auto; }
.hero h1 em { font-style: normal; color: var(--brand); }

.hero-sub {
  max-width: 52ch;
  margin: 20px auto 0;
  font-size: clamp(1.02rem, 2vw, 1.16rem);
  color: var(--ink-soft);
}

.hero .stores { justify-content: center; margin-top: 34px; }

/* Stats */
.stats {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(20px, 5vw, 52px);
  margin-top: 44px;
}
.stat { text-align: center; }
.stat b {
  display: block;
  font-size: clamp(1.4rem, 3.4vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
}
.stat span {
  display: block;
  margin-top: 2px;
  font-size: .8rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.stat + .stat { border-left: 1px solid var(--border); padding-left: clamp(20px, 5vw, 52px); }

/* --- Screenshot rail ---------------------------------------------------- */
.shots {
  position: relative;
  overflow: hidden;
  padding: clamp(44px, 6vw, 78px) 0 clamp(40px, 5vw, 72px);
}
/* soft glow so the rail sits on something instead of floating */
.shots::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 58%;
  width: min(1240px, 140%);
  aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, var(--bg-tint) 0%, transparent 66%);
  /* % not vw: vw counts the scrollbar and would shift the glow off-centre */
  pointer-events: none;
  z-index: 0;
}
.shots > * { position: relative; z-index: 1; }
.shots .section-head { margin-bottom: clamp(28px, 4vw, 42px); }

.rail-wrap {
  position: relative;
  --per: 3;                       /* cards resting in view */
  --gap: clamp(14px, 1.6vw, 26px);
  /* never wider than the source image, never taller than the viewport, and
     always narrow enough that --per of them leave a gutter to centre in */
  --card: min(
    300px,
    calc(64vh * 0.5625),
    calc((90vw - (var(--per) - 1) * var(--gap)) / var(--per))
  );
  --track: calc(var(--per) * var(--card) + (var(--per) - 1) * var(--gap));
  /* centre the resting cards rather than anchoring them to the text column.
     % (not vw) so a classic scrollbar cannot pull the track off-centre. */
  --rail-pad: max(24px, calc((100% - var(--track)) / 2));
}
@media (max-width: 760px) { .rail-wrap { --per: 2; } }

.rail {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--rail-pad);
  padding: 10px var(--rail-pad) 26px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  /* cards dissolve into the gutters as they scroll past the track */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, rgba(0,0,0,.32) calc(var(--rail-pad) * .55), #000 var(--rail-pad), #000 calc(100% - var(--rail-pad)), rgba(0,0,0,.32) calc(100% - var(--rail-pad) * .55), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, rgba(0,0,0,.32) calc(var(--rail-pad) * .55), #000 var(--rail-pad), #000 calc(100% - var(--rail-pad)), rgba(0,0,0,.32) calc(100% - var(--rail-pad) * .55), transparent 100%);
}
.rail::-webkit-scrollbar { display: none; }
.rail:focus-visible { outline-offset: -2px; }

.rail figure {
  margin: 0;
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: var(--card);
}
.rail img {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--surface-2);
  transition: transform .22s ease, box-shadow .22s ease;
}
@media (hover: hover) {
  .rail figure:hover img { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
}

/* Arrows (revealed by JS) */
.rail-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  margin-top: -8px; /* offset the rail's bottom padding */
  transform: translateY(-50%);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: opacity .2s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.rail-btn[hidden] { display: none; }
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.rail-btn:disabled { opacity: 0; pointer-events: none; }
.rail-btn.prev { left: max(10px, calc(var(--rail-pad) - 54px)); }
.rail-btn.next { right: max(10px, calc(var(--rail-pad) - 54px)); }
@media (max-width: 900px), (hover: none) {
  .rail-btn { display: none; }
}

/* Position dots (revealed by JS) */
.rail-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.rail-dots[hidden] { display: none; }
.rail-dots button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.rail-dots button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  transition: width .22s ease, background .22s ease;
}
.rail-dots button:hover::before { background: color-mix(in srgb, var(--ink) 42%, transparent); }
.rail-dots button[aria-current="true"]::before {
  width: 20px;
  background: var(--brand);
}

@media (max-width: 520px) {
  /* phones swipe, so anchor to the page margin and let cards peek instead */
  .rail-wrap {
    --card: min(66vw, 260px);
    --rail-pad: 18px;
  }
  .rail-btn { display: none; }
}

/* --- Feature cards ------------------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-soft); font-size: .97rem; }

.icon-tile {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: var(--brand-soft);
}
.icon-tile img { width: 34px; height: 34px; }
.icon-tile.v2 { background: var(--accent-soft); }
.icon-tile.v3 { background: #fdf0d9; }
.icon-tile.v4 { background: #dff1e6; }
.icon-tile.v5 { background: #dcecfb; }
.icon-tile.v6 { background: #fbe2f2; }

@media (prefers-color-scheme: dark) {
  .icon-tile.v3 { background: #3a2f1d; }
  .icon-tile.v4 { background: #1e3527; }
  .icon-tile.v5 { background: #1d2c3f; }
  .icon-tile.v6 { background: #3a2033; }
}

/* --- Privacy band ------------------------------------------------------- */
.band {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.band-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
  align-items: center;
}
@media (min-width: 860px) {
  .band-inner { grid-template-columns: 1.05fr .95fr; gap: 56px; }
}

.band h2 { margin-bottom: 16px; }
.band p { color: var(--ink-soft); }

.checks { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 14px; }
.checks li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: .99rem;
  color: var(--ink-soft);
}
.checks svg { width: 21px; height: 21px; flex: none; margin-top: 2px; color: var(--brand); }
.checks b { color: var(--ink); font-weight: 700; }

.lock-art {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.lock-art .big { display: flex; justify-content: center; }
.lock-art .big img { width: 104px; height: 104px; }
.lock-art h3 { margin: 18px 0 8px; font-size: 1.22rem; }
.lock-art p { font-size: .95rem; }

/* --- CTA ---------------------------------------------------------------- */
.cta { text-align: center; }
.cta .wrap > p { max-width: 46ch; margin: 16px auto 0; color: var(--ink-soft); }
.cta .stores { justify-content: center; margin-top: 30px; }
.cta img.app-icon {
  width: 78px;
  height: 78px;
  border-radius: 20px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-lg);
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 44px 0 52px;
  font-size: .92rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: center;
  justify-content: space-between;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 22px; }
.footer-links a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--brand-strong); }
.copy { color: var(--muted); }

/* --- Legal pages -------------------------------------------------------- */
.legal { padding: clamp(44px, 6vw, 72px) 0 clamp(60px, 8vw, 96px); }
.legal .wrap { max-width: 800px; }

.legal-head { margin-bottom: 36px; }
.legal-head h1 { font-size: clamp(1.9rem, 4.6vw, 2.7rem); }
.legal-head .updated {
  margin-top: 10px;
  font-size: .88rem;
  color: var(--muted);
}

.legal-body { font-size: 1.01rem; color: var(--ink-soft); }
.legal-body .intro {
  font-size: 1.08rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 34px;
}
.legal-body h2 {
  font-size: 1.28rem;
  font-weight: 750;
  color: var(--ink);
  margin: 42px 0 12px;
}
.legal-body h3 {
  font-size: 1.04rem;
  color: var(--ink);
  margin: 28px 0 8px;
}
.legal-body p { margin: 0 0 14px; }
.legal-body ul, .legal-body ol { padding-left: 1.35em; margin: 0 0 16px; }
.legal-body li { margin-bottom: 10px; }
.legal-body strong { color: var(--ink); font-weight: 700; }

/* Numbered EULA clauses */
.legal-body ol.clauses { list-style: decimal; padding-left: 1.4em; }
.legal-body ol.clauses > li { margin-bottom: 22px; }
.legal-body ol.clauses > li::marker { color: var(--brand); font-weight: 700; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--brand-strong); }

/* --- A11y --------------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  html, .rail { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
