/*
Theme Name: Ритм
Theme URI: https://example.com/ritm
Author: Ritm
Description: Минималистичная тема для трекера привычек «Ритм»: лендинг приложения, блог, светлая и тёмная схема. Работает в паре с плагином «Ритм — трекер привычек», но может использоваться и без него.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: ritm-theme
Tags: blog, one-column, custom-logo, custom-menu, dark-mode, translation-ready
*/

:root {
  --accent: #6c5ce7;
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #efeff6;
  --text: #1c1c28;
  --muted: #6e6e85;
  --line: #e3e3ee;
  --radius: 20px;
  --wrap: 1120px;
  --shadow: 0 1px 2px rgba(20,20,40,.04), 0 10px 30px rgba(20,20,40,.07);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f14; --surface: #1a1a23; --surface-2: #23232e; --text: #ececf3; --muted: #9a9ab0; --line: #2c2c3a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f14; --surface: #1a1a23; --surface-2: #23232e; --text: #ececf3; --muted: #9a9ab0; --line: #2c2c3a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 1.6em 0 .6em; }
h1 { font-size: clamp(32px, 5vw, 48px); }
h2 { font-size: clamp(24px, 3.4vw, 32px); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 740px; margin: 0 auto; padding: 0 20px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 999; width: auto; height: auto; clip: auto; background: var(--surface); padding: 8px 14px; border-radius: 10px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: 16px; text-decoration: none; cursor: pointer; transition: filter .15s, transform .15s;
  background: var(--surface-2); color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--sm { padding: 8px 14px; font-size: 14px; border-radius: 11px; }

/* ---------- Шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 19px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand img { max-height: 36px; width: auto; }
.brand__mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); position: relative; flex: none; }
.brand__mark::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(#fff,#fff) 30% 68% / 12% 34% no-repeat,
    linear-gradient(#fff,#fff) 50% 60% / 12% 50% no-repeat,
    linear-gradient(#fff,#fff) 70% 66% / 12% 40% no-repeat;
}
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.main-nav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500; }
.main-nav a:hover, .main-nav .current-menu-item > a { background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle { display: none; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
@media (max-width: 820px) {
  .menu-toggle { display: inline-grid; }
  .main-nav { display: none; position: absolute; top: 66px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 20px 16px; }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; }
  .header-actions .btn span { display: none; }
}

/* ---------- Лендинг ---------- */
.hero { padding: 72px 0 40px; overflow: hidden; }
.hero .wrap { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.1fr .9fr; } }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; font-size: 14px; }
.hero h1 { margin: 18px 0 16px; font-size: clamp(38px, 6vw, 62px); line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__lead { font-size: 19px; color: var(--muted); max-width: 540px; margin: 0 0 28px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero__note { margin-top: 16px; font-size: 14px; color: var(--muted); }

.phone {
  width: 300px; max-width: 100%; margin: 0 auto; aspect-ratio: 9 / 18.5; border-radius: 44px; padding: 12px;
  background: #15151c; box-shadow: 0 40px 80px -20px rgba(40,30,120,.35), inset 0 0 0 2px #2a2a36;
  transform: rotate(-3deg);
}
.phone__screen { height: 100%; border-radius: 34px; background: var(--bg); padding: 26px 16px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.phone__title { font-weight: 750; font-size: 17px; }
.phone__ring { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
.phone__ring i { width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(var(--accent) 72%, var(--surface-2) 0); position: relative; flex: none; }
.phone__ring i::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.phone__ring b { display: block; font-size: 15px; }
.phone__ring small { color: var(--muted); font-size: 12px; }
.phone__row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 16px; padding: 10px; border-left: 4px solid var(--c); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; }
.phone__row span { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); }
.phone__row s { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--c); text-decoration: none; }
.phone__row.is-done s { background: var(--c); }
.phone__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: var(--surface); border-radius: 16px; padding: 10px; margin-top: auto; }
.phone__grid b { aspect-ratio: 1; border-radius: 5px; background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--surface-2)); }

.features { padding: 40px 0 72px; }
.features__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); margin-bottom: 14px; }
.feature h3 { margin: 0 0 6px; font-size: 19px; }
.feature p { margin: 0; color: var(--muted); font-size: 15.5px; }
.section-title { text-align: center; margin: 0 0 32px; }

.steps { padding: 20px 0 80px; }
.steps ol { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: s; padding: 22px; border: 1px dashed var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 12px; }
.steps b { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 15px; }

.cta-band { margin: 0 0 80px; }
.cta-band .wrap > div { background: var(--accent); color: #fff; border-radius: 28px; padding: 48px 32px; text-align: center; }
.cta-band h2 { margin: 0 0 10px; }
.cta-band p { margin: 0 0 24px; opacity: .85; }
.cta-band .btn { background: #fff; color: #1c1c28; }

/* ---------- Контент ---------- */
.site-main { padding: 48px 0 80px; min-height: 60vh; }
.entry-header { margin-bottom: 28px; }
.entry-title { margin: 0 0 8px; }
.entry-title a { color: inherit; text-decoration: none; }
.entry-meta { color: var(--muted); font-size: 14px; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); color: var(--muted); }
.entry-content pre, .entry-content code { background: var(--surface-2); border-radius: 8px; font-size: .9em; }
.entry-content code { padding: 2px 6px; }
.entry-content pre { padding: 16px; overflow-x: auto; }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content th, .entry-content td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; }
.post-thumb { border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; }
.post-list { display: grid; gap: 18px; }
.post-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.post-card h2 { margin: 0 0 6px; font-size: 24px; }
.post-card p { margin: 10px 0 0; color: var(--muted); }
.pagination, .nav-links { display: flex; gap: 8px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.page-numbers { padding: 8px 14px; border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); }
.page-numbers.current { background: var(--accent); color: #fff; }
.post-navigation .nav-links { justify-content: space-between; }
.app-page .site-main { padding: 24px 0 48px; }
.app-page .entry-content { max-width: 1000px; margin: 0 auto; padding: 0 12px; }

/* Комментарии и формы */
.comments-area { margin-top: 56px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { background: var(--surface); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.comment-meta { font-size: 14px; color: var(--muted); }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=submit], button[type=submit] { font: inherit; font-weight: 650; background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer; }
.search-form { display: flex; gap: 8px; }

/* ---------- Подвал ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.site-footer ul { list-style: none; display: flex; gap: 16px; margin: 0; padding: 0; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* WordPress */
.alignwide { max-width: 1000px; margin-left: auto; margin-right: auto; }
.alignfull { width: 100vw; margin-left: calc(50% - 50vw); }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { color: var(--muted); font-size: 14px; text-align: center; }
.sticky .post-card, .bypostauthor { outline: 0; }

/* Плагин «Ритм» внутри темы: вкладки приложения под липкой шапкой */
.ritm--embed .r-nav { top: 66px; }
.admin-bar .ritm--embed .r-nav { top: 98px; }
@media (max-width: 782px) { .admin-bar .ritm--embed .r-nav { top: 66px; } }
