/* ═══════════════════════════════════════════════
   CLOVER OOC — SHARED STYLES
   aceenvw
   ═══════════════════════════════════════════════ */

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

/* ═══ THEME TOKENS ═══ */
:root {
  --bg:            #faf9f6;
  --bg-surface:    #f0efeb;
  --bg-elevated:   #fff;
  --text:          #1a1a1a;
  --text-secondary:#555;
  --text-dim:      #767676;
  --border:        #e0ddd6;
  --border-hover:  #ccc8be;
  --accent:        #2d7a4f;
  --accent-hover:  #236b40;
  --accent-faint:  rgba(45, 122, 79, 0.06);
  --accent-text:   #2d7a4f;
  --code-bg:       #f5f4f0;
  --code-text:     #2a2a2a;
  --tag-bg:        rgba(45, 122, 79, 0.06);
  --tag-border:    rgba(45, 122, 79, 0.18);
  --modal-overlay: rgba(0, 0, 0, 0.4);

  --font-display:  'EB Garamond', Georgia, serif;
  --font-body:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'DM Mono', 'JetBrains Mono', Consolas, monospace;

  --nav-height:    56px;
  --max-content:   720px;
  --max-wide:      1120px;
  --clover-pattern: rgba(45, 122, 79, 0.08);
  --radius-sm:     6px;
  --radius-md:     8px;
  --radius-lg:     12px;
  --radius-pill:   20px;
}

[data-theme="dark"] {
  --bg:            #111211;
  --bg-surface:    #1a1b1a;
  --bg-elevated:   #222322;
  --text:          #e8e6e1;
  --text-secondary:#aaa;
  --text-dim:      #aaa;
  --border:        #2a2b2a;
  --border-hover:  #3a3b3a;
  --accent:        #4aba6f;
  --accent-hover:  #5cd485;
  --accent-faint:  rgba(74, 186, 111, 0.08);
  --accent-text:   #4aba6f;
  --code-bg:       #161716;
  --code-text:     #c8c8c0;
  --tag-bg:        rgba(74, 186, 111, 0.07);
  --tag-border:    rgba(74, 186, 111, 0.2);
  --modal-overlay: rgba(0, 0, 0, 0.6);
  --clover-pattern: rgba(74, 186, 111, 0.06);
}

/* ═══ BASE ═══ */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
html::-webkit-scrollbar { width: 5px; }
html::-webkit-scrollbar-track { background: var(--bg); }
html::-webkit-scrollbar-thumb { background: var(--border); }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] ::selection {
  color: #111;
}

/* ═══ NOISE TEXTURE ═══ */
body::after {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

@media (max-width: 768px), (prefers-reduced-motion: reduce) {
  body::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ═══ CLOVER PATTERN (optional, add .clover-bg to sections) ═══ */
.clover-bg {
  position: relative;
}
.clover-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' fill='%232d7a4f'%3E%3Cg transform='rotate(0 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(90 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(180 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(270 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 48px 48px;
}

[data-theme="dark"] .clover-bg::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' fill='%234aba6f'%3E%3Cg transform='rotate(0 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(90 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(180 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3Cg transform='rotate(270 100 100)'%3E%3Cpath d='M100 100C100 72 80 40 68 40C52 40 50 60 58 76C64 88 84 98 100 100Z'/%3E%3Cpath d='M100 100C100 72 120 40 132 40C148 40 150 60 142 76C136 88 116 98 100 100Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ═══ TYPOGRAPHY ═══ */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
}

.t-display {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 130px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.t-heading {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.05;
}

.t-subheading {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 32px);
}

.t-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.t-body {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 560px;
}

.t-mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.t-dim {
  color: var(--text-dim);
}

/* ═══ LAYOUT ═══ */
.container {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 32px;
}

.container--narrow {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 32px;
}

/* ═══ NAVIGATION ═══ */
.nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 100;
  height: var(--nav-height);
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.nav-logo-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.nav-link {
  min-height: 44px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: color 0.2s;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
}

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

.nav-author {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.nav-author:hover {
  color: var(--accent);
}

/* ─── theme toggle ─── */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 16px; height: 16px; }

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

/* ─── mobile nav ─── */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
}

.nav-burger span {
  width: 20px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.3s;
  display: block;
}

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  z-index: 99;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100dvh - var(--nav-height));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav-mobile.open { display: flex; }

.nav-mobile a {
  font-size: 15px;
  color: var(--text-secondary);
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}

.nav-mobile a:hover { color: var(--text); }

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

@media (min-width: 701px) and (max-width: 1100px) {
  :root { --nav-height: 100px; }

  .nav {
    height: var(--nav-height);
    padding: 0 24px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 56px 44px;
  }

  .nav-logo { grid-column: 1; grid-row: 1; }
  .nav-right { grid-column: 3; grid-row: 1; }

  .nav-center {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: 44px;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-top: 1px solid var(--border);
  }

  .nav-center::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; padding: 0 8px; }
}

@media (max-width: 700px) {
  .nav-center, .nav-author { display: none; }
  .nav-burger { display: flex; }
}

/* ═══ FOOTER ═══ */
.footer {
  padding: 80px 32px 40px;
  text-align: center;
  border-top: 1px solid var(--border);
  position: relative;
}

.footer-clover {
  width: 48px;
  height: 48px;
  color: var(--accent);
  opacity: 0.1;
  margin: 0 auto 20px;
}

.footer-text {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.footer-text a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.footer-text a:hover {
  color: var(--accent);
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  border-color: var(--text);
}

.btn--accent {
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn--accent:hover {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .btn--accent:hover {
  color: #111;
}

.btn--small {
  padding: 6px 14px;
  font-size: 12px;
}

/* ═══ TAGS ═══ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

[data-theme="dark"] .tag:hover {
  color: #111;
}

/* ═══ SECTIONS ═══ */
.section {
  padding: 80px 0;
}

.section--tight {
  padding: 48px 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

/* ═══ DIVIDER ═══ */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

/* ═══ FADE IN ═══ */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ UTILITY ═══ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.sr-only:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  margin: 0;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 9999;
}

.text-center { text-align: center; }
.text-accent { color: var(--accent-text); }

/* ═══ FOCUS-VISIBLE ═══ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
.prompt-card:focus-visible,
.effect-tag:focus-visible,
.tag-pill:focus-visible,
.aspect-btn:focus-visible,
.tab-button:focus-visible,
.view-toggle:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
  font-family: var(--font-body);
}

/* ═══ PAGE TOP OFFSET ═══ */
.page-content {
  padding-top: var(--nav-height);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
  .container,
  .container--narrow {
    padding: 0 20px;
  }

  .nav {
    padding: 0 20px;
  }

  .section {
    padding: 56px 0;
  }

  .t-display {
    font-size: clamp(36px, 12vw, 80px);
  }
}

/* ═══ LANGUAGE SYSTEM ═══ */
[data-lang="en"] .lang-ru { display: none !important; }
[data-lang="ru"] .lang-en { display: none !important; }

.lang-toggle {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.lang-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
