/* gleb.onl — shared design system (main page + Tao reader).
   Palette inherited from the Don Quijote reader (paper/night). */

:root {
  --paper: 43 36% 96%;
  --ink: 26 22% 9%;
  --ink-2: 26 14% 32%;
  --ink-3: 28 10% 48%;
  --line: 36 24% 86%;
  --accent: 16 80% 52%;
  --accent-soft: 16 80% 52% / .08;
  --wash: 40 40% 92%;
  --shadow: 26 30% 20% / .07;
  --radius: .625rem;
  --font-serif: "Literata", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="night"] {
  --paper: 255 28% 10%;
  --ink: 40 30% 87%;
  --ink-2: 38 16% 66%;
  --ink-3: 260 10% 50%;
  --line: 255 16% 21%;
  --accent: 18 100% 63%;
  --accent-soft: 18 100% 63% / .1;
  --wash: 255 20% 15%;
  --shadow: 260 40% 2% / .5;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: hsl(var(--paper));
  color: hsl(var(--ink));
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: hsl(var(--accent) / .22); }

a { color: inherit; }

/* ——— site header ——— */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.15rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  border-radius: var(--radius);
}

.brand .mark {
  display: block;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: .45rem;
  box-shadow: 0 1px 3px hsl(var(--shadow));
}

.brand .wordmark {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: .01em;
  color: hsl(var(--ink));
}

/* ——— theme toggle ——— */
.theme-toggle {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--ink-3));
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.theme-toggle:hover {
  color: hsl(var(--ink));
  background: hsl(var(--wash));
}

.theme-toggle:active { transform: scale(.94); }

.theme-toggle:focus-visible {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 2px;
}

.theme-toggle svg { width: 1.125rem; height: 1.125rem; }

.theme-toggle .icon-moon { display: none; }
[data-theme="night"] .theme-toggle .icon-sun { display: none; }
[data-theme="night"] .theme-toggle .icon-moon { display: block; }

/* ——— buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  padding: .625rem 1.125rem;
  border: 1px solid hsl(var(--line));
  background: hsl(var(--paper));
  color: hsl(var(--ink));
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.btn:hover {
  border-color: hsl(var(--accent) / .55);
  background: hsl(var(--accent-soft));
  transform: translateY(-1px);
  box-shadow: 0 4px 14px hsl(var(--shadow));
}

.btn-accent {
  background: hsl(var(--accent));
  border-color: hsl(var(--accent));
  color: hsl(43 36% 96%);
}

.btn-accent:hover {
  background: hsl(var(--accent) / .92);
  border-color: hsl(var(--accent) / .92);
  color: hsl(43 36% 96%);
}

/* ——— shared bits ——— */
.eyebrow {
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: hsl(var(--ink-3));
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.chip {
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: hsl(var(--ink-2));
  background: hsl(var(--wash));
  border: 1px solid hsl(var(--line));
  border-radius: 999px;
  padding: .2rem .65rem;
  white-space: nowrap;
}

/* ——— footer ——— */
.site-footer {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid hsl(var(--line));
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  color: hsl(var(--ink-3));
  font-size: .875rem;
}

.site-footer a {
  color: hsl(var(--ink-2));
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-footer a:hover {
  color: hsl(var(--accent));
  border-bottom-color: hsl(var(--accent) / .5);
}

/* ——— shared page scaffolding (subpages) ——— */
.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: -0.015em;
  margin: 3.25rem 0 .75rem;
}

.page-lede {
  font-family: var(--font-serif);
  font-style: italic;
  color: hsl(var(--ink-2));
  font-size: 1.125rem;
  margin: 0 0 2.5rem;
}

/* ——— landing / menu buttons ——— */
.menu {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  max-width: 34rem;
  padding-bottom: 4rem;
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  background: hsl(var(--paper));
  border: 1px solid hsl(var(--line));
  border-radius: calc(var(--radius) * 1.4);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.menu-btn:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--accent) / .5);
  box-shadow: 0 10px 26px hsl(var(--shadow));
}

.menu-btn:focus-visible {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 3px;
}

.menu-ico {
  position: relative;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: .7rem;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAF6EF;
  border: 1px solid hsl(var(--line));
}

.menu-ico img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: .6rem;
}

.menu-ico svg { width: 1.75rem; height: 1.75rem; }

.menu-tg-badge {
  position: absolute;
  right: -.55rem;
  bottom: -.55rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #229ED9;
  border: 2px solid hsl(var(--paper));
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-tg-badge svg { width: .85rem; height: .85rem; }

.menu-txt {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}

.menu-txt strong {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

.menu-txt span {
  font-size: .875rem;
  color: hsl(var(--ink-3));
}

.menu-arrow {
  margin-left: auto;
  color: hsl(var(--accent));
  font-size: 1.2rem;
  transition: transform .18s ease;
}

.menu-btn:hover .menu-arrow { transform: translateX(3px); }

/* ——— app showcase ——— */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.4rem;
  padding-bottom: 3.5rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  text-decoration: none;
  padding: 1.5rem;
  background: hsl(var(--paper));
  border: 1px solid hsl(var(--line));
  border-radius: calc(var(--radius) * 1.4);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: hsl(var(--accent) / .5);
  box-shadow: 0 14px 34px hsl(var(--shadow));
}

.app-card .app-logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  border: 1px solid hsl(var(--line));
}

.app-card h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin: 0;
}

.app-card p {
  font-size: .9rem;
  color: hsl(var(--ink-2));
  margin: 0;
  flex-grow: 1;
}

.app-card .card-open {
  color: hsl(var(--accent));
  font-weight: 600;
  font-size: .9rem;
}

/* ——— app detail page ——— */
.feature-pic {
  width: 100%;
  border-radius: calc(var(--radius) * 1.4);
  border: 1px solid hsl(var(--line));
  display: block;
  margin: 1.75rem 0 1.5rem;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-head img {
  width: 4rem;
  height: 4rem;
  border-radius: .9rem;
  border: 1px solid hsl(var(--line));
}

.detail-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin: 0;
}

.store-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  align-items: center;
  margin: 1.25rem 0 .5rem;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  border-radius: .65rem;
  padding: .55rem 1.1rem;
  background: hsl(var(--ink));
  color: hsl(var(--paper));
  opacity: .55;
  cursor: default;
}

.store-btn svg { width: 1.4rem; height: 1.4rem; }

.store-btn .sb-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.store-btn .sb-txt small {
  font-size: .55rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .8;
}

.store-btn .sb-txt strong { font-size: .95rem; }

.store-note {
  font-size: .8rem;
  color: hsl(var(--ink-3));
  font-style: italic;
  margin: 0 0 2rem;
}

.app-desc {
  font-size: 1rem;
  line-height: 1.75;
  color: hsl(var(--ink));
  padding-bottom: 3.5rem;
}

.app-desc p { margin: 0 0 1rem; }

.app-desc h3 {
  font-family: var(--font-sans);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: hsl(var(--ink-3));
  margin: 1.9rem 0 .7rem;
}

.app-desc ul {
  margin: 0 0 1.2rem;
  padding-left: 1.2rem;
}

.app-desc li { margin: .35rem 0; }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: hsl(var(--ink-3));
  text-decoration: none;
  margin-top: 2.5rem;
}

.backlink:hover { color: hsl(var(--accent)); }
