/* ============================================================
   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; }

/* ---- COLOR STRIP SEPARATOR ---- */
.color-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 72px 0 0;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.16,1,0.3,1) 0.48s both;
}

.cs-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.65;
  animation: stripPulse 4s ease-in-out infinite;
}

/* Stagger the pulse across dots */
.cs-dot:nth-child(1)  { animation-delay: 0s; }
.cs-dot:nth-child(2)  { animation-delay: 0.3s; }
.cs-dot:nth-child(3)  { animation-delay: 0.6s; }
.cs-dot:nth-child(4)  { animation-delay: 0.9s; }
.cs-dot:nth-child(5)  { animation-delay: 1.2s; }
.cs-dot:nth-child(6)  { animation-delay: 1.5s; }
.cs-dot:nth-child(7)  { animation-delay: 1.8s; }
.cs-dot:nth-child(8)  { animation-delay: 2.1s; }
.cs-dot:nth-child(9)  { animation-delay: 2.4s; }

@keyframes stripPulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.9;  transform: scale(1.25); }
}

/* ---- DIRECTORY ---- */
.directory {
  margin-top: 72px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.85s cubic-bezier(0.16,1,0.3,1) 0.55s both;
}

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

/* Pill grid — wrapping row of capsules */
.dir-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Individual pill */
.dir-pill {
  border: 1.5px solid currentColor;
  border-radius: 999px;
  overflow: hidden;
  transition: border-radius 0.3s cubic-bezier(0.16,1,0.3,1),
              background-color 0.25s ease;
}
.dir-pill.open {
  border-radius: 20px;
}

/* Pill button (the visible capsule) */
.dir-pill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 400;
  color: currentColor;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}
.dir-pill-btn:hover {
  opacity: 0.75;
}

.dir-pill-label {
  flex: 1;
}

.dir-pill-plus {
  font-family: var(--mono);
  font-style: normal;
  font-size: 18px;
  opacity: 0.5;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1),
              opacity 0.2s ease;
  flex-shrink: 0;
}
.dir-pill.open .dir-pill-plus {
  transform: rotate(45deg);
  opacity: 0.8;
}

/* Expanded body */
.dir-pill-body {
  display: none;
  padding: 0 24px 16px;
}
.dir-pill.open .dir-pill-body {
  display: block;
  animation: fadeIn 0.25s ease both;
}

.dir-pill-body p {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.5;
  color: var(--fg);
  opacity: 0.7;
  margin-bottom: 10px;
}

.dir-pill-link {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: currentColor;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.dir-pill-link:hover {
  opacity: 1;
}

/* Hover fill — subtle background tint */
body.scheme-dark .dir-pill:hover {
  background-color: rgba(255,255,255,0.04);
}
body.scheme-dark .dir-pill.open {
  background-color: rgba(255,255,255,0.06);
}
body.scheme-light .dir-pill:hover {
  background-color: rgba(0,0,0,0.03);
}
body.scheme-light .dir-pill.open {
  background-color: rgba(0,0,0,0.05);
}

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

/* ---- CLICK COUNTER ---- */
.counter-row {
  display: flex;
  align-items: center;
  justify-content: 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-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 0.5s ease 1.3s both;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.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);
  text-align: center;
}

/* ---- 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; }
}
