/*
Theme Name: Occult
Theme URI: https://example.com/
Author: ZK Team
Description: Zettelkasten platform — D3 graph + reader/editor + comments. Headless WP + React frontend.
Version: 0.2.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: occult
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;1,14..32,400&display=swap');

/* ── Светлая тема (default) ─────────────────────────────────────────────── */
[data-theme="light"],
html:not([data-theme]) {
  /* Parchment — тёплый кремовый */
  --bg-base:        #f0ebe0;
  --bg-surface:     #f0ebe0;
  --bg-elevated:    #faf6ee;
  --bg-panel:       #faf6ee;
  --bg-topbar:      #242130;
  --bg-input:       #faf6ee;
  --bg-tag:         #e8e2d6;
  --bg-tag-active:  #242130;
  --bg-overlay:     rgba(0, 0, 0, 0.4);

  --border:         #c4b89a;
  --border-sub:     #ddd5c2;
  --border-input:   #c4b89a;

  --text-pri:       #242130;
  --text-sec:       #7a7060;
  --text-muted:     #b0a090;
  --text-invert:    #faf6ee;
  --text-topbar:    #f0ebe0;
  --text-tag:       #7a7060;
  --text-tag-active:#faf6ee;

  --accent:         #8a5a28;
  --accent-hover:   #6e4818;
  --accent-warm:    #f5e0c0;
  --accent-grn:     #4a7a48;
  --accent-pur:     #7a5a9a;
  --accent-danger:  #b83a2a;
  --accent-danger-hover: #9a2e20;

  --badge-bg:       rgba(36, 33, 48, 0.06);
  --badge-bg-hover: rgba(36, 33, 48, 0.12);

  --node-def:       #c4a878;
  --node-hov:       #8a5a28;
  --node-act:       #c07a10;
  --link-ln:        rgba(196, 168, 120, 0.4);
  --link-act:       rgba(138, 90, 40, 0.6);

  --shadow-sm:      0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow:         0 0 0 1px var(--border-sub), 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-md:      0 4px 24px rgba(0, 0, 0, 0.10);
  --shadow-topbar:  0 1px 0 rgba(255, 255, 255, 0.06);

  --scrollbar-thumb: #c4b89a;
}

/* ── Глобальные токены (не зависят от темы) ────────────────────────────── */
:root {
  --keeper-gold: #c8a040;

  /* Размеры иконок и компактных контролов */
  --size-icon-sm: 20px;
  --size-icon-md: 28px;
  --size-icon-lg: 32px;
}

/* ── Тёмная тема ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  /* Obsidian Ritual — угольный, пыльно-лиловый */
  --bg-base:        #1a1820;
  --bg-surface:     #1a1820;
  --bg-elevated:    #242130;
  --bg-panel:       #242130;
  --bg-topbar:      #110f1a;
  --bg-input:       #1e1c2a;
  --bg-tag:         #2a2638;
  --bg-tag-active:  #d4cfe8;
  --bg-overlay:     rgba(0, 0, 0, 0.6);

  --border:         #3d3750;
  --border-sub:     #302c42;
  --border-input:   #3d3750;

  --text-pri:       #f2f0f8;
  --text-sec:       #8a7fa0;
  --text-muted:     #5a5268;
  --text-invert:    #1a1820;
  --text-topbar:    #f2f0f8;
  --text-tag:       #8a7fa0;
  --text-tag-active:#1a1820;

  --accent:         #9b7fd4;
  --accent-hover:   #8a6ec0;
  --accent-warm:    #f5e0c0;
  --accent-grn:     #5aaa7a;
  --accent-pur:     #b89ae0;
  --accent-danger:  #e05878;
  --accent-danger-hover: #cc4060;

  --badge-bg:       rgba(212, 207, 232, 0.08);
  --badge-bg-hover: rgba(212, 207, 232, 0.14);

  --node-def:       #6a5a8a;
  --node-hov:       #9b7fd4;
  --node-act:       #c8963a;
  --link-ln:        rgba(106, 90, 138, 0.4);
  --link-act:       rgba(155, 127, 212, 0.6);

  --shadow-sm:      0 1px 4px rgba(0, 0, 0, 0.25);
  --shadow:         0 0 0 1px var(--border-sub), 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-md:      0 4px 24px rgba(0, 0, 0, 0.50);
  --shadow-topbar:  0 1px 0 rgba(255, 255, 255, 0.04);

  --scrollbar-thumb: #3d3750;
}

/* ── Типографика и прочие токены (не зависят от темы) ───────────────────── */
:root {
  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      ui-monospace, 'SF Mono', 'Fira Code', monospace;

  --text-2xs:       10px;
  --text-xs:        12px;
  --text-sm:        14px;
  --text-base:      16px;
  --text-lg:        18px;
  --text-xl:        20px;
  --text-2xl:       24px;

  --leading-tight:  1.3;
  --leading-base:   1.5;
  --leading-loose:  1.7;

  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-16:  64px;

  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   16px;
  --r-xl:   32px;
  --r-full: 9999px;

  --r-card:   var(--r-md);
  --r-btn:    var(--r-md);
  --r-input:  var(--r-md);
  --r-tag:    var(--r-md);
  --r-avatar: var(--r-full);

  --h-topbar:       40px;
  --h-btn:          40px;
  --h-btn-sm:       32px;
  --h-input:        40px;
  --w-sidebar-tags: 150px;
  --w-center-col: 500px;
  --w-container:  746px;
  --w-feed:       500px;
  --w-tags:       150px;
  --w-gap:        32px;

  --tr:   0.15s cubic-bezier(.4, 0, .2, 1);
  --trD:  0.22s cubic-bezier(.4, 0, .2, 1);
  --trS:  0.10s cubic-bezier(.4, 0, .2, 1);

  --drawer-strip: 40px;
  --drawer-full:  150px;
}

/* ── Глобальный сброс ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg-base);
  color: var(--text-pri);
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: var(--leading-base);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.admin-bar #zk-app { height: calc(100vh - 32px); }
@media (max-width: 782px) {
  .admin-bar #zk-app { height: calc(100vh - 46px); }
}

a { color: var(--accent); text-decoration: none; }
/* Underline only for plain prose links — component-specific rules handle the rest */

::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--r-full); }
::selection               { background: rgba(26, 110, 232, 0.18); }

#zk-app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

@keyframes zk-rainbow-sweep {
  0%   { background-position: 150% center; }
  100% { background-position: -50% center; }
}

.zk-bootstrap-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  background: linear-gradient(90deg,
    #ff3333,
    #ff8800,
    #ffdd00,
    #33ff88,
    #33aaff,
    #aa33ff,
    #ff33cc,
    #ff3333
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: zk-rainbow-sweep 3s linear infinite;
}
