/* === LOCAL FONTS ===
   Fontsource 5.3.0 variable WOFF2 files live in /files/fonts/.
   Latin Extended is fetched only when required by characters such as č/ć/š/ž/đ.
*/
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('files/fonts/space-grotesk-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('files/fonts/space-grotesk-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('files/fonts/jetbrains-mono-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('files/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('files/fonts/fraunces-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('files/fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('files/fonts/fraunces-latin-ext-wght-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('files/fonts/fraunces-latin-wght-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('files/fonts/sora-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('files/fonts/sora-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* === SEOFIXLAB WORDMARK === */
.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1;
  color: var(--fg);
  text-decoration: none;
}
.brand-wordmark .brand-seo,
.brand-wordmark .brand-lab { color: var(--fg); }
.brand-wordmark .brand-fix { color: var(--accent); }

/* Blinking terminal cursor on the main-navigation wordmark. */
header .brand-wordmark::after {
  content: '';
  display: inline-block;
  width: 0.42em;
  height: 0.9em;
  margin-left: 0.22em;
  align-self: center;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

/* === THEME TOKENS === */
:root[data-theme="dark"] {
  --bg: #0c0b09;
  --bg-elev: #14120e;
  --bg-elev-2: #1c1a14;
  --fg: #f0ead6;
  --fg-dim: #c9c1ad;
  --muted: #8a8275;
  --accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  --accent-2: #06b6d4;
  --accent-2-rgb: 6, 182, 212;
  --border: rgba(240, 234, 214, 0.08);
  --border-strong: rgba(240, 234, 214, 0.18);
  --card: #15130e;
  --code-bg: #060503;
  --code-fg: #f0ead6;
  --glow: rgba(245, 158, 11, 0.15);
}
:root[data-theme="light"] {
  --bg: #f3ecdc;
  --bg-elev: #faf3e1;
  --bg-elev-2: #fffaee;
  --fg: #1a1610;
  --fg-dim: #3d362b;
  --muted: #6b6358;
  --accent: #c2410c;
  --accent-rgb: 194, 65, 12;
  --accent-2: #0e7490;
  --accent-2-rgb: 14, 116, 144;
  --border: rgba(26, 22, 16, 0.12);
  --border-strong: rgba(26, 22, 16, 0.24);
  --card: #fffaee;
  --code-bg: #1a1610;
  --code-fg: #f3ecdc;
  --glow: rgba(194, 65, 12, 0.12);
}
:root[data-theme="cyber"] {
  --bg: #02060a;
  --bg-elev: #050d10;
  --bg-elev-2: #071318;
  --fg: #4eff96;
  --fg-dim: #8affb8;
  --muted: #2a8a5e;
  --accent: #ffea00;
  --accent-rgb: 255, 234, 0;
  --accent-2: #ff10f0;
  --accent-2-rgb: 255, 16, 240;
  --border: rgba(78, 255, 150, 0.18);
  --border-strong: rgba(78, 255, 150, 0.4);
  --card: #050d10;
  --code-bg: #000;
  --code-fg: #4eff96;
  --glow: rgba(78, 255, 150, 0.2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', sans-serif;
  margin: 0;
  overflow-x: hidden;
  max-width: 100%;
  position: relative;
}

/* CRT scanlines for cyber theme */
[data-theme="cyber"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(78, 255, 150, 0.025) 2px, rgba(78, 255, 150, 0.025) 3px);
  z-index: 200;
  mix-blend-mode: overlay;
}

/* Theme transition animation */
body.theme-anim,
body.theme-anim *,
body.theme-anim *::before,
body.theme-anim *::after {
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              fill 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.font-display { font-family: 'Fraunces', serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* === PROGRESS BAR === */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 100;
  box-shadow: 0 0 12px var(--accent), 0 0 4px var(--accent);
}

/* === BACKGROUND GRID === */
.bg-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(rgba(12, 11, 9, 0.74), rgba(12, 11, 9, 0.80)),
    url('files/seofixlab-hero-small-business-digital-systems.avif');
  background-size: 56px 56px, 56px 56px, cover, cover;
  background-position: center center, center center, center center, center 30%;
  background-repeat: repeat, repeat, no-repeat, no-repeat;
}

/* Ista hero fotografija ostaje u svim temama; menja se samo overlay radi čitljivosti. */
[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(rgba(243, 236, 220, 0.80), rgba(243, 236, 220, 0.86)),
    url('files/seofixlab-hero-small-business-digital-systems.avif');
}
[data-theme="cyber"] .bg-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(rgba(2, 6, 10, 0.76), rgba(2, 6, 10, 0.84)),
    url('files/seofixlab-hero-small-business-digital-systems.avif');
}


/* === LEGAL HERO ===
   Legal pages intentionally keep the locked grid language but do not use the homepage hero photo.
*/
.legal-hero {
  min-height: clamp(420px, 50vh, 520px);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px, 56px 56px;
  background-position: center center, center center;
  background-repeat: repeat, repeat;
}

/* === FLOATING DOTS === */
.float-dot {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
  animation: drift 16s ease-in-out infinite;
  pointer-events: none;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.1); }
  66% { transform: translate(-30px, 50px) scale(0.95); }
}

/* === MOUSE GLOW === */
.mouse-glow {
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12) 0%, transparent 60%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: blur(30px);
  z-index: 1;
}

/* === TYPEWRITER CURSOR === */
.cursor::after {
  content: '▌';
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
  margin-left: 4px;
  font-weight: 400;
}
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

.logo-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--accent);
  margin-left: 3px;
  animation: blink 1.1s steps(1) infinite;
  vertical-align: text-bottom;
}

/* === LINKS === */
.hover-link {
  position: relative;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.3s ease;
}
.hover-link:hover { color: var(--fg); }
.hover-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -5px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-link:hover::after { width: 100%; }

/* === THEME TOGGLE === */
.theme-toggle {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.theme-btn {
  width: 32px; height: 32px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 12px;
}
.theme-btn.active {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.5);
}
.theme-btn:hover:not(.active) { color: var(--fg); transform: scale(1.08); }

/* === STAT PILL === */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-decoration: none;
  color: var(--fg);
  transition: all 0.3s ease;
}
.stat-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
  transform: translateY(-1px);
}
.stat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.flash-up { animation: flashUp 0.7s ease; }
@keyframes flashUp {
  0% { transform: translateY(0); }
  40% { transform: translateY(-6px); color: var(--accent-2) !important; text-shadow: 0 0 12px var(--accent-2); }
  100% { transform: translateY(0); }
}

/* === TAG === */
.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.08);
  font-weight: 500;
}

/* === BUTTONS === */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  padding: 13px 22px;
  border: none;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -8px rgba(var(--accent-rgb), 0.6);
}
.btn-primary:hover::before { transform: translateX(100%); }

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 13px 22px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* === ARTICLE CARDS === */
.article-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s ease;
}
.article-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.article-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at bottom right, var(--glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.article-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-strong);
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .article-card:hover {
  box-shadow: 0 24px 48px -20px rgba(26, 22, 16, 0.2);
}
.article-card:hover::before { transform: scaleX(1); }
.article-card:hover::after { opacity: 1; }
.article-card .arrow {
  display: inline-block;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.article-card:hover .arrow { transform: translateX(8px); }
.article-card .card-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 56px;
  color: var(--accent);
  opacity: 0.18;
  line-height: 0.9;
  letter-spacing: -0.04em;
  transition: opacity 0.4s ease;
}
.article-card:hover .card-num { opacity: 0.45; }
.article-card h3 { transition: color 0.3s ease; }
.article-card:hover h3 { color: var(--accent); }


/* === CARD CLICK BEHAVIOUR ===
   Text-link cards have one dominant internal destination: the real
   contextual anchor remains in the HTML, while its hit area covers the card.
   Portfolio/image cards are deliberately excluded because image clicks belong
   to the lightbox and their text link remains a separate external link. */
a.article-card,
.text-link-card { cursor: pointer; }

.text-link-card {
  position: relative;
  isolation: isolate;
}
.text-link-card .text-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
}
.text-link-card .text-card-link:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: inherit;
}

.portfolio-card { cursor: default; }
.lightbox-trigger { cursor: zoom-in; }
.portfolio-external-link {
  position: relative;
  z-index: 6;
  cursor: pointer;
}

/* === CODE WINDOW === */
.code-window {
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5);
}
/* === PHOTO WINDOW: isti "prozor" vizuelni jezik kao code-window, za fotografije === */
.photo-window {
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5);
}
.photo-window img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}
.portfolio-caption {
  padding: 13px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.45;
}
.portfolio-caption a {
  color: var(--fg-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.25s ease;
}
.portfolio-caption a:hover,
.portfolio-caption a:focus-visible {
  color: var(--accent);
  outline: none;
}
.portfolio-caption .external-mark {
  color: var(--accent);
}
.code-header {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
[data-theme="light"] .code-header { background: rgba(255, 255, 255, 0.04); }
[data-theme="cyber"] .code-header { background: rgba(78, 255, 150, 0.04); }

.copy-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  padding: 5px 11px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.copy-btn.copied {
  color: var(--bg) !important;
  background: var(--accent);
  border-color: var(--accent);
}
.copy-flash {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.copy-btn.copied .copy-flash { animation: flash 0.7s ease; }
@keyframes flash {
  0% { opacity: 0.5; }
  100% { opacity: 0; }
}

/* === SYNTAX HIGHLIGHTING === */
.tk-key { color: #ff7b72; }
.tk-str { color: #a5d6ff; }
.tk-fn { color: #d2a8ff; }
.tk-com { color: #6e7681; font-style: italic; }
.tk-num { color: #79c0ff; }
.tk-op { color: #ffa657; }
.tk-var { color: var(--code-fg); }

[data-theme="cyber"] .tk-key { color: #ff10f0; }
[data-theme="cyber"] .tk-str { color: #ffea00; }
[data-theme="cyber"] .tk-fn { color: #8affb8; }
[data-theme="cyber"] .tk-com { color: #2a8a5e; }
[data-theme="cyber"] .tk-num { color: #ffea00; }
[data-theme="cyber"] .tk-op { color: #ffea00; }

[data-theme="light"] .tk-key { color: #c2410c; }
[data-theme="light"] .tk-str { color: #0e7490; }
[data-theme="light"] .tk-fn { color: #7c2d12; }
[data-theme="light"] .tk-com { color: #6b6358; }
[data-theme="light"] .tk-num { color: #0e7490; }
[data-theme="light"] .tk-op { color: #c2410c; }

/* === ARCHIVE LIST === */
.archive-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}
.archive-item::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateY(-50%) scale(0);
  transition: transform 0.3s ease;
}
.archive-item:hover {
  padding-left: 16px;
  border-bottom-color: var(--accent);
}
.archive-item:hover::before { transform: translateY(-50%) scale(1); }
.archive-item:hover .archive-title { color: var(--accent); }
.archive-title { transition: color 0.3s ease; }

/* === MARQUEE === */
.marquee-wrap {
  overflow: hidden;
  white-space: nowrap;
  max-width: 100vw;
}
.marquee {
  display: inline-flex;
  animation: scroll 40s linear infinite;
  gap: 60px;
  padding-right: 60px;
}
@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* === NAVIGATION / PILLAR-CLUSTER ROUTING === */
.nav-links-desktop { display: none; }
.nav-group { position: relative; padding: 10px 0; }
.nav-group-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.nav-group-trigger i {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.25s ease, color 0.25s ease;
}
.nav-group:hover .nav-group-trigger i,
.nav-group:focus-within .nav-group-trigger i {
  transform: rotate(180deg);
  color: var(--accent);
}
.nav-dropdown {
  position: absolute;
  top: calc(100% - 2px);
  left: -18px;
  width: 285px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 24px 60px -28px rgba(0,0,0,0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 120;
}
.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.nav-dropdown a {
  display: block;
  padding: 10px 11px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.nav-dropdown a:hover,
.nav-dropdown a:focus-visible {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  transform: translateX(2px);
  outline: none;
}
.nav-dropdown a.pillar-link {
  color: var(--fg);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  font-family: 'JetBrains Mono', monospace;
}
.language-switch-desktop { display: none; }
.language-link {
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.language-link:hover,
.language-link:focus-visible { color: var(--fg); outline: none; }
.language-link.active,
.language-link[aria-current="page"] {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.35);
}

.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger-btn:hover { border-color: var(--border-strong); color: var(--accent); }
@media (min-width: 1100px) {
  .nav-links-desktop { display: flex; }
  .language-switch-desktop { display: inline-flex; }
  .hamburger-btn { display: none; }
}
@media (max-width: 1279px) and (min-width: 1100px) {
  .header-email { display: none !important; }
  .nav-links-desktop { gap: 20px !important; }
}


.email-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 54px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.035);
  color: var(--fg);
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.email-icon-btn:hover,
.email-icon-btn:focus-visible {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  outline: none;
  transform: translateY(-1px);
}
.email-icon-btn .stat-dot { flex: 0 0 auto; }
.email-icon-btn i {
  color: var(--accent);
  font-size: 12px;
}
.drawer-email {
  align-self: flex-start;
  margin: 0 0 18px 4px;
}
.footer-email {
  margin-top: 2px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 90;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 82vw);
  max-width: 100vw;
  background: rgba(var(--accent-rgb), 0.02);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  z-index: 95;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.mobile-drawer-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.mobile-drawer-links {
  display: flex;
  flex-direction: column;
}
.mobile-drawer-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  padding: 16px 4px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-link:active, .mobile-drawer-link:focus-visible { color: var(--accent); }

.mobile-drawer-group { margin-bottom: 8px; }
.mobile-drawer-pillar {
  font-weight: 700;
  color: var(--fg);
  padding-bottom: 10px;
}
.mobile-drawer-child {
  padding: 10px 4px 10px 18px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 0;
  position: relative;
}
.mobile-drawer-child::before {
  content: '└';
  position: absolute;
  left: 2px;
  color: var(--accent);
  opacity: 0.65;
}
.mobile-drawer-utility {
  margin-top: 8px;
  border-top: 1px solid var(--border-strong);
}
.mobile-drawer-bottom {
  margin-top: auto;
  padding-top: 22px;
}
.drawer-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 4px 8px;
}
.mobile-legal-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.mobile-legal-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 0;
}
.mobile-legal-links a:hover,
.mobile-legal-links a:focus-visible { color: var(--accent); outline: none; }
.drawer-language { margin: 4px 0 14px; }

.footer-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  width: 100%;
}
.footer-link-group h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.footer-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}
.footer-link-list a { font-size: 11px; }
@media (min-width: 768px) {
  .footer-links-grid { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

/* === REVEAL === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === INPUT === */
.input-field {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  padding: 13px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border-radius: 4px;
  outline: none;
  transition: all 0.3s ease;
  width: 100%;
}
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}
.input-field::placeholder { color: var(--muted); }



/* === FULLSCREEN LIGHTBOX / GALLERY === */
body.lightbox-open {
  overflow: hidden !important;
}
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  overscroll-behavior: contain;
}
.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 76px 72px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox-image {
  display: block;
  max-width: min(94vw, 1700px);
  max-height: calc(100vh - 128px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  transform: scale(0.985);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  cursor: default;
  -webkit-user-drag: none;
}
.lightbox-overlay.open .lightbox-image.ready {
  opacity: 1;
  transform: scale(1);
}
.lightbox-control {
  position: absolute;
  z-index: 3;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.48);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.lightbox-control:hover,
.lightbox-control:focus-visible {
  transform: scale(1.07);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.22);
  outline: none;
}
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-prev:hover,
.lightbox-prev:focus-visible,
.lightbox-next:hover,
.lightbox-next:focus-visible { transform: translateY(-50%) scale(1.07); }
.lightbox-close {
  top: 18px;
  right: 18px;
  font-size: 22px;
}
.lightbox-meta {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 3;
  transform: translateX(-50%);
  max-width: min(760px, calc(100vw - 140px));
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.46);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.82);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-counter { color: var(--accent); }
@media (max-width: 640px) {
  .lightbox-stage { padding: 58px 10px 72px; }
  .lightbox-image {
    max-width: 96vw;
    max-height: calc(100vh - 130px);
  }
  .lightbox-control {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 10px; right: 10px; }
  .lightbox-meta {
    bottom: 12px;
    max-width: calc(100vw - 24px);
    font-size: 10px;
  }
}

/* === SCROLL TO TOP === */
.to-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease,
              border-color 0.25s ease, color 0.25s ease, background-color 0.25s ease;
  z-index: 80;
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.55);
}
.to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.to-top-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
}
.to-top-btn i {
  font-size: 15px;
}
@media (max-width: 640px) {
  .to-top-btn {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .article-card { padding: 22px; }
  .card-num { font-size: 42px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* === COOKIE CONSENT BANNER ===
   Uses the existing code-window + button design language.
   It appears only until a global choice is stored in sfl_cookie_consent_v1.
*/
.cookie-consent-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 85;
  max-width: 920px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.cookie-consent-banner.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cookie-consent-window {
  box-shadow: 0 26px 70px -24px rgba(0, 0, 0, 0.72);
}
.cookie-consent-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 22px;
  background: var(--code-bg);
}
.cookie-consent-copy {
  max-width: 620px;
  color: var(--fg-dim);
  line-height: 1.65;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
}
.cookie-consent-copy a,
.cookie-consent-settings-link {
  color: var(--accent);
  text-decoration: none;
}
.cookie-consent-copy a:hover,
.cookie-consent-settings-link:hover,
.cookie-consent-copy a:focus-visible,
.cookie-consent-settings-link:focus-visible {
  text-decoration: underline;
  outline: none;
}
.cookie-consent-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cookie-consent-actions .btn-primary,
.cookie-consent-actions .btn-secondary {
  white-space: nowrap;
}
@media (max-width: 720px) {
  .cookie-consent-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .cookie-consent-body {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
  }
  .cookie-consent-actions {
    width: 100%;
  }
  .cookie-consent-actions .btn-primary,
  .cookie-consent-actions .btn-secondary {
    flex: 1 1 0;
    justify-content: center;
    padding-left: 14px;
    padding-right: 14px;
  }
}
