/* Lirnyk site styles. Palette and system type carried over from the original page;
   indigo and cream come from the app icon and are used only for the demo stage. */

:root {
  color-scheme: light dark;
  --paper: #fbf9f5;
  --surface: #ffffff;
  --ink: #2a2420;
  --muted: #6b6055;
  --rule: #e4ddd1;
  --accent: #9a5d08;
  --button: #8a5306;
  --button-ink: #fbf9f5;
  --key: #ffffff;
  --key-edge: #cbc1b2;
  --mark: #f6e3c0;

  --indigo: #1f2a6e;
  --indigo-deep: #141b4d;
  --cream: #f4ead6;
  --amber: #f2a93b;
  --selection: #b3cdfb;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: ui-serif, "New York", Charter, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 38rem;
  --wide: 68rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1815;
    --surface: #26201c;
    --ink: #f0eae0;
    --muted: #a79b8c;
    --rule: #3a322a;
    --accent: #e0a542;
    --button: #e0a542;
    --button-ink: #1c1815;
    --key: #342d27;
    --key-edge: #4d443a;
    --mark: #4a3a22;
    --indigo-deep: #10163f;
    --selection: #3d5a95;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; text-wrap: pretty; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--mark);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus { top: 0.75rem; }

/* Layout */

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}
.brand img { width: 32px; height: 32px; }

.site-nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

main section { padding: clamp(3.5rem, 8vw, 6rem) 0 0; }

.section-head { max-width: var(--measure); margin-bottom: 2rem; }
.section-head h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.section-head p { color: var(--muted); margin: 0; }

.prose { max-width: var(--measure); }

/* Keycaps: the page's recurring motif */

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9em;
  height: 1.9em;
  padding: 0 0.45em;
  font-family: var(--sans);
  font-size: 0.85em;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  background: var(--key);
  border: 1px solid var(--key-edge);
  border-bottom-width: 3px;
  border-radius: 6px;
  vertical-align: 0.05em;
}
kbd + kbd { margin-left: 0.2em; }
.combo { white-space: nowrap; }

/* Hero */

.hero { padding-top: clamp(2rem, 6vw, 4.5rem); }

.hero h1 {
  max-width: 15ch;
  font-size: clamp(2.35rem, 1.3rem + 4.2vw, 4.25rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: 1.25rem;
}
.hero h1:lang(uk) {
  max-width: 21ch;
  font-size: clamp(2.1rem, 1.2rem + 3.4vw, 3.6rem);
}
.hero h1 kbd {
  font-size: 0.42em;
  vertical-align: 0.5em;
  border-bottom-width: 4px;
}

.hero .lede {
  max-width: 30rem;
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 0;
}
.button-primary { background: var(--button); color: var(--button-ink); }
.button-primary:hover { filter: brightness(1.1); }
.button svg { width: 1.1rem; height: 1.1rem; flex: none; }

.brew {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  max-width: 100%;
  min-width: 0;
}
.brew code {
  background: none;
  padding: 0 0.25rem 0 1.2rem;
  font-size: 0.88rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brew code::before { content: "$ "; color: var(--muted); }
.copy {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1.1rem 0 0.8rem;
  border: 0;
  border-left: 1px solid var(--rule);
  border-radius: 0 999px 999px 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.copy:hover { color: var(--ink); }
.copy svg { width: 1rem; height: 1rem; }

.requirements {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

/* Demo stage */

.demo { margin: clamp(2.5rem, 6vw, 4rem) 0 0; }

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 85% 0%, #2c3a94 0%, transparent 60%),
    linear-gradient(160deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  padding: 0 clamp(0.75rem, 4vw, 3rem) clamp(4.5rem, 9vw, 6rem);
  min-height: 25rem;
}

.menubar {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  height: 1.9rem;
  margin: 0 calc(-1 * clamp(0.75rem, 4vw, 3rem)) clamp(1.5rem, 4vw, 2.75rem);
  padding: 0 1rem;
  font-size: 0.78rem;
  color: var(--cream);
  background: rgb(255 255 255 / 0.08);
}
.menubar b { font-weight: 650; }
.menubar .spacer { flex: 1; }
.menubar .m-hide { display: none; }
.menubar .glyph { width: 22px; height: 14px; }
@media (min-width: 40rem) { .menubar .m-hide { display: inline; } }

.window {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 30px 60px -20px rgb(5 8 30 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.06);
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 2.6rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.lights { display: flex; gap: 0.45rem; }
.lights i { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: #ec6a5e; }
.lights i:nth-child(2) { background: #f4bf4f; }
.lights i:nth-child(3) { background: #61c554; }

.mail-fields { margin: 0; padding: 0 1.25rem; font-size: 0.85rem; }
.mail-fields div {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.mail-fields dt { color: var(--muted); }
.mail-fields dd { margin: 0; }

.mail-body {
  position: relative;
  padding: 1.25rem 1.25rem 1.5rem;
  min-height: 11.5rem;
  font-family: var(--serif);
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.15rem);
  line-height: 1.65;
}
.mail-body p { margin: 0 0 0.75em; }
.mail-body .sign { color: var(--muted); }

.draft {
  background-image: linear-gradient(var(--selection), var(--selection));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: -0.2em;
  background: var(--ink);
  opacity: 0;
}

.hud {
  position: absolute;
  right: 1rem;
  bottom: -1.1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: rgb(30 30 34 / 0.92);
  color: #f3f1ec;
  font-family: var(--sans);
  font-size: 0.82rem;
  box-shadow: 0 10px 24px -8px rgb(0 0 0 / 0.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
}
.hud .dots { display: inline-flex; gap: 3px; }
.hud .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); opacity: 0.35; }

.keys {
  position: absolute;
  left: 50%;
  bottom: clamp(1.25rem, 3vw, 1.75rem);
  display: flex;
  gap: 0.4rem;
  transform: translateX(-50%);
  font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem);
}
.keys kbd {
  min-width: 2.3em;
  height: 2.3em;
  color: var(--indigo-deep);
  background: var(--cream);
  border-color: #c9bb9c;
  border-bottom-width: 4px;
  font-size: 1em;
  margin: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, border-bottom-width 0.1s;
}

/* Demo steps, driven by data-step on .stage */

.stage[data-step="select"] .draft,
.stage[data-step="keys"] .draft,
.stage[data-step="working"] .draft,
.stage[data-step="restored"] .draft { background-size: 100% 100%; }
.stage[data-step="restored"] .draft { transition: none; }

.stage[data-step="keys"] .keys-run kbd,
.stage[data-step="working"] .keys-run kbd,
.stage[data-step="undo"] .keys-undo kbd { opacity: 1; transform: none; }
.stage[data-step="keys"] .keys-run kbd:nth-child(2) { transition-delay: 0.08s; }
.stage[data-step="keys"] .keys-run kbd:nth-child(3) { transition-delay: 0.16s; }
.stage[data-step="undo"] .keys-undo kbd:nth-child(2) { transition-delay: 0.08s; }
.stage[data-step="working"] .keys kbd { opacity: 0; transition-delay: 0.4s; }

.stage[data-step="working"] .hud { opacity: 1; transform: none; }
.stage[data-step="working"] .hud .dots i { animation: dot 0.9s infinite; }
.stage[data-step="working"] .hud .dots i:nth-child(2) { animation-delay: 0.15s; }
.stage[data-step="working"] .hud .dots i:nth-child(3) { animation-delay: 0.3s; }
.stage[data-step="working"] .glyph { animation: pulse 0.9s ease-in-out infinite; }

.stage[data-step="done"] .caret { animation: blink 1.05s steps(1) infinite; }
.stage[data-step="done"] .draft { animation: settle 0.5s ease-out; }

@keyframes dot { 50% { opacity: 1; } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes settle { from { opacity: 0.2; } }

.demo figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 0.9rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.demo figcaption p { margin: 0; }
.demo-toggle {
  border: 0;
  background: none;
  padding: 0.25rem 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* How it works: a real sequence, so it is numbered */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem 3rem;
  counter-reset: step;
}
@media (min-width: 48rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  counter-increment: step;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}
.steps li::before {
  content: counter(step);
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.steps h3 { font-size: 1.2rem; font-weight: 650; margin-bottom: 0.45rem; }
.steps p { color: var(--muted); margin: 0; }

/* Profiles: one rough sentence, three rewrites */

.sample-source {
  max-width: var(--measure);
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--key-edge);
  font-family: var(--serif);
  color: var(--muted);
}

.profiles { margin: 0; }
.profile {
  display: grid;
  gap: 0.4rem 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
}
.profile:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 48rem) { .profile { grid-template-columns: 13rem 1fr; } }
.profile dt { display: flex; align-items: center; gap: 0.75rem; font-weight: 650; }
.profile dt span:first-child { min-width: 5.5rem; }
.profile dd { margin: 0; font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; max-width: 44rem; }
.profiles-note { margin-top: 1.25rem; color: var(--muted); max-width: var(--measure); }

/* Your own profiles: dashed outline marks it as something you add */

.custom {
  display: grid;
  gap: 1.5rem 3rem;
  margin-top: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px dashed var(--key-edge);
  border-radius: 14px;
}
@media (min-width: 48rem) { .custom { grid-template-columns: 1fr 1.15fr; align-items: start; } }
.custom h3 { font-size: 1.25rem; font-weight: 650; margin-bottom: 0.6rem; }
.custom-text p { color: var(--muted); }
.custom-text .custom-ideas { margin: 0; }
.custom-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 0.95rem;
}
.custom-card > div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
}
.custom-card > div + div { border-top: 1px solid var(--rule); }
.custom-card dt { color: var(--muted); }
.custom-card dd { margin: 0; }
.custom-card .result { font-family: var(--serif); font-size: 1.05rem; line-height: 1.6; }

/* Ways to run it */

.ways { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
@media (min-width: 48rem) { .ways { grid-template-columns: 1.15fr 1fr; } }
.way { background: var(--surface); padding: 1.5rem 1.6rem; }
.way h3 { font-size: 1.15rem; font-weight: 650; margin-bottom: 0.5rem; }
.way p { color: var(--muted); margin: 0 0 0.75rem; }
.way p:last-child { margin: 0; }
.way ul { margin: 0.25rem 0 0; padding-left: 1.1rem; color: var(--muted); }

/* Privacy */

.privacy-line {
  max-width: 24ch;
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

/* Ukrainian before and after */

.compare { display: grid; gap: 1.25rem; }
.pair {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}
@media (min-width: 48rem) { .pair { grid-template-columns: 1fr auto 1fr; align-items: start; } }
.pair blockquote {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  font-family: var(--serif);
  line-height: 1.65;
}
.pair .before { background: var(--surface); border: 1px solid var(--rule); color: var(--muted); }
.pair .after { background: var(--indigo); color: var(--cream); }
.pair .via {
  align-self: center;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.85rem;
}

/* FAQ */

.faq { max-width: 46rem; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 1.25rem; color: var(--muted); max-width: var(--measure); }
.faq details > div p:last-child { margin: 0; }

/* Footer */

.site-footer {
  margin-top: clamp(4rem, 9vw, 7rem);
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--muted);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.site-footer p { margin: 0; }

/* Plain document pages: privacy, support, changelog */

.doc { padding-top: clamp(2rem, 5vw, 3.5rem); }
.doc h1 {
  font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.doc .lede { font-size: 1.15rem; color: var(--muted); max-width: var(--measure); }
.doc h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 2.75rem 0 0.75rem;
}
.doc h3 { font-size: 1.08rem; font-weight: 650; margin: 1.75rem 0 0.5rem; }
.doc ul, .doc ol { padding-left: 1.25rem; margin: 0 0 1em; }
.doc li { margin-bottom: 0.4em; }
.doc .prose > :first-child { margin-top: 0; }

.release { padding: 2rem 0; border-top: 1px solid var(--rule); }
.release:first-of-type { margin-top: 2rem; }
.release h2 { margin: 0 0 0.25rem; }
.release time { display: block; color: var(--muted); font-size: 0.92rem; margin-bottom: 1rem; }

/* Motion preferences */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
}
