/* ============================================================
   now.nickdecker.net — stylesheet
   Instrument Serif body · Electric palette · Dark/Light schemes
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  /* Electric keyword colors — tuned for both dark and ivory */
  --teal:   #00c8aa;
  --orange: #e03d00;
  --gold:   #c49a00;
  --green:  #00a844;
  --blue:   #0070cc;
  --red:    #cc1020;
  --pink:   #cc0077;
  --purple: #7700cc;
  --lime:   #7a9900;

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --mono:  Menlo, Monaco, Consolas, monospace;
}

/* ---- SCHEME: DARK (default) ---- */
body.scheme-dark {
  --bg:     #0a0a0a;
  --fg:     #ffffff;
  --muted:  rgba(255,255,255,0.32);
  --faint:  rgba(255,255,255,0.12);
  --border: rgba(255,255,255,0.10);
}

/* ---- SCHEME: LIGHT ---- */
body.scheme-light {
  --bg:     #f5f0e8;
  --fg:     #1a1410;
  --muted:  rgba(26,20,16,0.38);
  --faint:  rgba(26,20,16,0.14);
  --border: rgba(26,20,16,0.10);
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.22s ease, color 0.22s ease;
}

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  position: fixed;
  top: 27px; right: 27px; z-index: 1000;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; background: none; border: none; padding: 0;
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg); opacity: 0.35;
  transition: opacity 0.15s ease;
}
.theme-toggle:hover { opacity: 0.8; }

.theme-toggle-icon {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--fg);
  position: relative; overflow: hidden; flex-shrink: 0;
}
body.scheme-light .theme-toggle-icon::after {
  content: ''; position: absolute;
  top: 0; right: 0; width: 50%; height: 100%;
  background: var(--fg);
}
body.scheme-dark .theme-toggle-icon::after {
  content: ''; position: absolute;
  top: 0; left: 0; width: 50%; height: 100%;
  background: var(--fg);
}

/* ---- LAYOUT ---- */
.page {
  max-width: 800px;
  margin: 0 auto;
  padding: 80px 48px 120px;
}

/* ---- LOGO ---- */
.logo-wrap {
  margin-bottom: 68px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.85s cubic-bezier(0.16,1,0.3,1) 0.08s both;
}

.wordmark {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

/* ---- BIO PROSE ---- */
.bio {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2.5vw, 24px);
  line-height: 1.60;
  color: var(--fg);
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.85s cubic-bezier(0.16,1,0.3,1) 0.32s both;
}

/* ---- KEYWORD LINKS ---- */
.k {
  font-style: normal;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.14s ease;
}
.k:hover  { opacity: 0.72; }
.k:active { opacity: 0.42; }

/* Solid highlight variant — uses -webkit-text-fill-color so
   currentColor (the background) stays the color-class value
   while the visible text is independently controlled. */
.k.hi {
  display: inline;
  background-color: currentColor;
  padding: 0 4px 1px;
  border-radius: 2px;
}

/* Dark mode: white text on colored bg, gray on hover */
body.scheme-dark .k.hi {
  -webkit-text-fill-color: #ffffff;
}
body.scheme-dark .k.hi:hover {
  -webkit-text-fill-color: #aaaaaa;
}
/* c-fg highlights: bg is white (fg), so invert text to dark */
body.scheme-dark .k.c-fg.hi {
  -webkit-text-fill-color: #0a0a0a;
}
body.scheme-dark .k.c-fg.hi:hover {
  -webkit-text-fill-color: #444444;
}

/* Light mode: black text on colored bg, charcoal on hover */
body.scheme-light .k.hi {
  -webkit-text-fill-color: #1a1410;
}
body.scheme-light .k.hi:hover {
  -webkit-text-fill-color: #444444;
}
/* c-fg highlights: bg is dark (fg), so invert text to light */
body.scheme-light .k.c-fg.hi {
  -webkit-text-fill-color: #f5f0e8;
}
body.scheme-light .k.c-fg.hi:hover {
  -webkit-text-fill-color: #c8c4bc;
}

.k.hi:hover  { opacity: 1; }
.k.hi:active { opacity: 0.80; }

/* Color classes */
.c-teal   { color: var(--teal); }
.c-orange { color: var(--orange); }
.c-gold   { color: var(--gold); }
.c-green  { color: var(--green); }
.c-blue   { color: var(--blue); }
.c-red    { color: var(--red); }
.c-pink   { color: var(--pink); }
.c-purple { color: var(--purple); }
.c-lime   { color: var(--lime); }
.c-fg     { color: var(--fg); }

/* ---- EXPAND MECHANIC ---- */
.expand-trigger {
  font-style: normal;
  cursor: pointer;
  border-bottom: 1.5px solid currentColor;
  transition: opacity 0.13s;
}
.expand-trigger::after      { content: ' +'; font-size: 0.72em; opacity: 0.5; }
.expand-trigger.open::after { content: ' –'; }
.expand-trigger:hover       { opacity: 0.7; }

.expand-wrap .expand-content { display: none; }
.expand-wrap.open .expand-content {
  display: inline;
  animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- HOVER IMAGE POPUP ---- */
.hover-popup {
  position: fixed;
  pointer-events: none;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.18s ease;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  max-width: 260px;
  max-height: 260px;
}
.hover-popup img {
  display: block; width: 100%; height: auto; object-fit: cover;
}
.hover-popup.visible { opacity: 1; }

/* ---- DIVIDER ---- */
.hr {
  width: 40px;
  height: 1px;
  background: var(--faint);
  margin: 56px 0;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.9s both;
}

/* ---- CLICK COUNTER ---- */
.counter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 0.7s ease 1.05s both;
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  animation: pulse 2.6s ease-in-out infinite;
}

.counter-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

#click-count {
  color: var(--fg);
  opacity: 0.55;
}

/* ---- FOOTER LINKS ---- */
.footer-links {
  margin-top: 72px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  opacity: 0;
  animation: fadeUp 0.5s ease 1.3s both;
}
.footer-links a {
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.footer-links a:hover { color: var(--fg); }
.sep {
  font-family: Menlo, monospace;
  font-size: 10px;
  color: var(--faint);
  padding: 0 9px;
  user-select: none;
}

/* ---- COPYRIGHT ---- */
.copyright {
  margin-top: 24px;
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ---- ANIMATIONS ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.9; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .page { padding: 48px 24px 80px; }
  .bio  { font-size: 18px; }
  .wordmark { max-width: 360px; }
  .theme-toggle { top: 16px; right: 16px; }
}

@media (max-width: 400px) {
  .bio { font-size: 17px; line-height: 1.5; }
}
