/* ══════════════════════════════════════════════════════
   SHARED.CSS — Editorial design system
   Used by: index.html, tools.html, tools/kalkulator.html
   ══════════════════════════════════════════════════════ */

/* ══ CSS VARIABLES ══ */
:root {
  --bg:        #efe9dc;
  --paper:     #f7f3e9;
  --ink:       #1a1814;
  --ink-2:     #3b362d;
  --muted:     #7d7568;
  --rule:      #cdc4b2;
  --rule-2:    #e2dbc9;
  --accent:    #b8442a;
  --accent-ink:#fdfaf2;
  --accent-2:  #355b5b;
  --pos:       #2e6b3b;
  --warn:      #a3661e;

  --font-display: "Instrument Serif", "Newsreader", Georgia, serif;
  --font-body:    "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1240px;
}
[data-theme="dark"] {
  --bg:        #161516;
  --paper:     #1f1e1f;
  --ink:       #f1ede2;
  --ink-2:     #c9c3b3;
  --muted:     #8a8478;
  --rule:      #3a3735;
  --rule-2:    #2a2827;
  --accent:    #e0843d;
  --accent-ink:#161516;
  --accent-2:  #7a9d8e;
  --pos:       #6fa776;
  --warn:      #d6a155;
}

/* ══ RESET & BASE ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01","cv11";
  overflow-x: hidden; transition: background .3s, color .3s;
}
a     { color: inherit; }
img   { display: block; max-width: 100%; }
button{ font: inherit; color: inherit; }

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rule); border-radius: 0;
  border: 3px solid var(--bg); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  border: 3px solid var(--bg); background-clip: padding-box;
}

/* ══ PAPER TEXTURE ══ */
body::after {
  content: ""; position: fixed; inset: 0;
  pointer-events: none; z-index: 0; opacity: .3;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .08  0 0 0 0 .05  0 0 0 .06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] body::after { opacity: .5; }

/* ══ APP WRAPPER ══ */
#app { position: relative; z-index: 1; }

/* ══ TOPBAR ══ */
nav.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: background .3s;
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  width: 34px; height: 34px; border: 1px solid var(--ink);
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  background: var(--paper); transition: background .3s, border-color .3s;
}
.brand-text  { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name  { font-family: var(--font-display); font-size: 18px; letter-spacing: .005em; }
.brand-sub   { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; margin-top: 3px; }
.top-right   { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  appearance: none; background: none; border: 1px solid var(--rule);
  width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center; font-size: 13px;
  cursor: pointer; color: var(--ink-2);
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }

.hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: 1px solid var(--rule);
  width: 32px; height: 32px;
  align-items: center; justify-content: center; cursor: pointer;
}
.hamburger span { width: 14px; height: 1px; background: var(--ink); display: block; }

/* BACK LINK — secondary nav link, used by tool pages */
.back-link {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none; color: var(--muted);
  padding: 0 4px; transition: color .2s;
}
.back-link:hover { color: var(--accent); }

/* ══ MOBILE MENU ══ */
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: var(--bg); padding: 90px 32px 32px;
  flex-direction: column; gap: 0;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-family: var(--font-display); font-size: 32px; color: var(--ink);
  text-decoration: none; padding: 14px 0;
  border-bottom: 1px solid var(--rule-2); font-style: italic;
}
.mobile-menu a:hover { color: var(--accent); }

/* ══ KICKER ══ */
.kicker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.kicker .num { color: var(--accent); font-weight: 600; }

/* ══ TAG ══ */
.tag {
  background: none; border: 1px solid var(--rule-2);
  padding: 3px 8px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border-radius: 2px;
}

/* ══ FOOTER ══ */
footer {
  padding: 24px 32px 48px; border-top: 1px solid var(--rule);
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .04em;
  position: relative; z-index: 1;
}
.foot-link {
  color: var(--accent); text-decoration: none; letter-spacing: .08em;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding-bottom: 1px; transition: border-color .2s;
}
.foot-link:hover { border-color: var(--accent); }

/* ══ RESPONSIVE TOPBAR ══ */
@media (max-width: 960px) {
  .hamburger { display: flex; }
}
@media (max-width: 480px) {
  .topbar-inner { padding-left: 16px; padding-right: 16px; }
  footer        { padding-left: 16px; padding-right: 16px; }
}
