@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #ffffff;
  --bg-section: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #737373;
  --accent: #1e3a8a;
  --accent-hover: #14275c;
  --border: #e8e8e8;
  --tag-bg: #efefef;
  --tag-text: #555555;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 720px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; }

/* NAV */
nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 2rem; height: 56px; display: flex; align-items: center; justify-content: space-between; }
nav .logo { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
nav .nav-links { display: flex; gap: 1.5rem; list-style: none; }
nav .nav-links a { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
nav .nav-links a:hover, nav .nav-links a.active { color: var(--accent); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; color: var(--text); }
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  nav .nav-links { display: none; position: absolute; top: 56px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; padding: 1rem 2rem; gap: 0.75rem; }
  nav .nav-links.open { display: flex; }
}

/* LAYOUT */
main { margin-top: 56px; }
.section { border-top: 1px solid var(--border); padding: 3.5rem 2rem; }
.section:first-child { border-top: none; }
.section-inner { max-width: var(--max-width); margin: 0 auto; }
.section-number { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1rem; letter-spacing: 0.02em; }
.section-title { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; margin-bottom: 1.75rem; letter-spacing: -0.03em; }

/* TYPOGRAPHY */
p { margin-bottom: 1rem; font-size: 0.95rem; }
p:last-child { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color 0.2s, color 0.2s; }
a:hover { color: var(--accent-hover); text-decoration-color: var(--accent-hover); }

/* TAGS */
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.68rem; background: var(--tag-bg); color: var(--tag-text); padding: 0.2rem 0.55rem; border-radius: 3px; text-decoration: none; }
.tag:hover { background: var(--border); text-decoration: none; }

/* LINK LISTS */
.link-list { list-style: none; }
.link-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.link-list li:last-child { border-bottom: none; }
.link-list a { color: var(--text); font-size: 0.9rem; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s, color 0.2s; }
.link-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link-list .author, .link-list .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }

/* CATEGORY HEADERS */
.category-header { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--text); }
.category-header:first-child { margin-top: 0; }

/* CONTACT */
.contact-email { font-family: var(--font-mono); font-size: 0.9rem; }
.contact-links { display: flex; gap: 1rem; margin-top: 0.75rem; }
.contact-links a { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.contact-links a:hover { color: var(--accent); }

/* USER MANUAL */
.manual-intro { font-style: italic; color: var(--text-muted); margin-bottom: 2rem; font-size: 0.9rem; }
.manual-section { margin-top: 2rem; margin-bottom: 2.5rem; }
.manual-section.about-sub h2 { color: var(--text); font-size: 1.1rem; }
.home-intro > p { margin-bottom: 0.8rem; }

/* HOME GRID (bio + photo) */
.home-grid { display: grid; grid-template-columns: 1fr 200px; gap: 3rem; align-items: start; }
.home-photo img { width: 100%; border-radius: 6px; display: block; object-fit: cover; object-position: center top; }
@media (max-width: 640px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-photo { max-width: 160px; }
}
.manual-section h2 { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; color: var(--accent); }
.manual-section p { margin-bottom: 0.85rem; }
.manual-section ul { list-style: none; margin-bottom: 1rem; }
.manual-section ul li { padding: 0.3rem 0; padding-left: 1.2rem; position: relative; font-size: 0.95rem; }
.manual-section ul li::before { content: '\2192'; position: absolute; left: 0; color: var(--accent); font-size: 0.85rem; }
.framework-block { background: var(--bg-section); border-left: 3px solid var(--accent); padding: 1rem 1.25rem; margin: 1rem 0; border-radius: 0 4px 4px 0; }
.framework-block p { font-family: var(--font-mono); font-size: 0.85rem; margin-bottom: 0.5rem; line-height: 1.6; }
.framework-block p:last-child { margin-bottom: 0; }

/* PROJECTS */
.project-item { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
.project-item:last-child { border-bottom: none; }
.project-header { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.5rem; }
.project-title { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text); font-size: 1rem; font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s, color 0.2s; }
.project-title:hover { color: var(--accent); border-bottom-color: var(--accent); }
.project-title .arrow { display: inline-block; transition: transform 0.2s ease; }
.project-title:hover .arrow { transform: rotate(-45deg); }
.project-desc { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; }

/* TOOLBOX */
.tool-item { margin-bottom: 1rem; }
.tool-item a { font-weight: 600; font-size: 0.9rem; }
.tool-item .tool-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }

/* FOOTER */
footer { border-top: 1px solid var(--border); padding: 2rem; text-align: center; }
footer p { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); font-weight: 500; }

/* PAGE HEADER */
.page-header { padding: 3rem 2rem 1rem; }
.page-header-inner { max-width: var(--max-width); margin: 0 auto; }
.page-header h1 { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.03em; padding-bottom: 0.6rem; border-bottom: 2px solid var(--text); }
.page-header + .section { border-top: none; }
.page-header .page-desc { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }

/* RESPONSIVE */
@media (max-width: 640px) {
  .section { padding: 2.5rem 1.25rem; }
  .page-header { padding: 2rem 1.25rem 1rem; }
  nav { padding: 0 1.25rem; }
  .link-list li { flex-direction: column; gap: 0.25rem; }
}

/* ARTICLE PAGES */
.article-header { padding: 3rem 2rem 1rem; }
.article-header-inner { max-width: var(--max-width); margin: 0 auto; padding-bottom: 0.75rem; border-bottom: 2px solid var(--text); }
.article-header + .section { border-top: none; }
.article-header h1 { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.article-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.article-subtitle { font-style: italic; color: var(--text-muted); margin-top: 0.5rem; font-size: 0.95rem; }
.article-body { max-width: var(--max-width); margin: 0 auto; }
.article-body p { margin-bottom: 1rem; font-size: 0.95rem; line-height: 1.75; }
.article-body h2 { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 1rem; color: var(--accent); }
.article-body h3 { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; }
.article-body blockquote { background: var(--bg-section); border-left: 3px solid var(--accent); padding: 1.25rem 1.5rem; margin: 1.5rem 0; border-radius: 0 4px 4px 0; font-style: italic; }
.article-body blockquote p { margin-bottom: 0; }
.article-body .callout { background: var(--bg-section); border-left: 3px solid var(--accent); padding: 1.25rem 1.5rem; margin: 1.5rem 0; border-radius: 0 4px 4px 0; }
.article-body .callout p { font-style: italic; margin-bottom: 0; }
.article-body blockquote .quote-attr { font-style: normal; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin-top: 0.85rem; }
.article-body figure { margin: 1.75rem 0; }
.article-body figure img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--border); }
.article-body figure.hero img { border: none; }
.article-body figcaption { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; text-align: center; }

/* Numbered reminder list */
.reminder-list { list-style: none; counter-reset: reminder; }
.reminder-list > li { counter-increment: reminder; margin-bottom: 2rem; padding-left: 0; }
.reminder-list > li .quote { font-size: 1.05rem; font-weight: 500; margin-bottom: 0.5rem; }
.reminder-list > li .quote::before { content: counter(reminder) ". "; font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.reminder-list > li .commentary { font-size: 0.9rem; color: var(--text-muted); padding-left: 1.5rem; border-left: 2px solid var(--border); margin-top: 0.5rem; }
.reminder-list > li .attribution { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; padding-left: 1.5rem; }

/* Walk-on poem sections */
.poem-section { margin-bottom: 2rem; }
.poem-section .refrain { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-bottom: 0.75rem; }
.poem-section p { margin-bottom: 0.5rem; }

/* WINS table */
.wins-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
.wins-table th { font-family: var(--font-mono); font-size: 0.78rem; text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--text); background: var(--bg-section); }
.wins-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.wins-table td:first-child { font-family: var(--font-mono); font-weight: 600; color: var(--accent); width: 60px; }

/* Back link */
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); text-decoration: none; margin-bottom: 1.5rem; transition: color 0.2s; }
.back-link:hover { color: var(--text); text-decoration: none; }

/* FORTUNE COOKIE LAYOUT */
.fortune-section { border-top: none; min-height: calc(100vh - 56px - 73px); }
.fortune-container { max-width: 960px; margin: 0 auto; }
.fortune-header { text-align: center; margin-bottom: 2.5rem; }
.fortune-header .section-title { margin-bottom: 0.5rem; }
.fortune-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem 0.75rem; padding: 0 1rem; }

/* FORTUNE COOKIE SHAPE & ENTRANCE */
@keyframes cookieEnter {
  0% { opacity: 0; transform: translateY(-30px) scale(0.7); }
  70% { opacity: 1; transform: translateY(4px) scale(1.03); }
  100% { opacity: 1; transform: var(--scatter-transform, none); }
}
.fortune-cookie {
  flex: 0 0 auto;
  width: 140px;
  cursor: pointer;
  text-align: center;
  animation: cookieEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: var(--enter-delay, 0ms);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.4s ease;
}
.fortune-cookie:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 8px; }

/* SVG cookie */
.cookie-visual { position: relative; width: 110px; height: 75px; margin: 0 auto; }
.cookie-svg { width: 100%; height: 100%; overflow: visible; transition: transform 0.4s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.3s 0.1s ease; }

/* FORTUNE COOKIE CRACK */
.fortune-cookie.cracked {
  cursor: default;
  width: 280px;
  animation: none;
}
.fortune-cookie.cracked .cookie-svg {
  transform: scale(0.3);
  opacity: 0;
  height: 0;
  margin-top: -10px;
}

/* PAPER SLIP UNFURL */
.cookie-slip {
  background: #faf6ef;
  border-radius: 4px;
  padding: 0;
  max-height: 0;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top center;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), inset 0 0 20px rgba(0,0,0,0.02);
  border: 1px solid transparent;
  margin-top: 0;
  transition:
    max-height 0.6s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.4s 0.35s ease,
    transform 0.5s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    padding 0.4s 0.3s ease,
    margin-top 0.4s 0.3s ease;
}
.fortune-cookie.cracked .cookie-slip {
  max-height: 500px;
  opacity: 1;
  transform: scaleY(1);
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
  border-color: #e8e2d6;
}
/* Paper curl */
.cookie-slip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 5%;
  right: 5%;
  height: 6px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.03));
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

/* SLIP CONTENT — staggered text cascade */
.slip-quote, .slip-attribution, .slip-commentary {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.fortune-cookie.cracked .slip-quote {
  opacity: 1; transform: translateY(0); transition-delay: 0.55s;
}
.fortune-cookie.cracked .slip-attribution {
  opacity: 1; transform: translateY(0); transition-delay: 0.65s;
}
.fortune-cookie.cracked .slip-commentary {
  opacity: 1; transform: translateY(0); transition-delay: 0.75s;
}
.slip-quote { font-size: 0.95rem; font-weight: 500; line-height: 1.6; color: var(--text); margin-bottom: 0.5rem; }
.slip-attribution { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); margin-bottom: 0.5rem; }
.slip-commentary { font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; border-left: 2px solid var(--accent); padding-left: 0.75rem; margin-top: 0.5rem; }

/* FORTUNE COOKIE RESPONSIVE */
@media (max-width: 960px) {
  .fortune-container { max-width: var(--max-width); }
  .fortune-cookie { width: 120px; }
  .fortune-cookie.cracked { width: 240px; }
  .cookie-visual { width: 95px; height: 64px; }
}
@media (max-width: 640px) {
  .fortune-section { padding: 2rem 1rem; }
  .fortune-grid { gap: 0.75rem 0.25rem; padding: 0 0.5rem; }
  .fortune-cookie { width: 100px; }
  .fortune-cookie.cracked { width: 100%; max-width: 300px; }
  .cookie-visual { width: 80px; height: 54px; }
  .slip-quote { font-size: 0.85rem; }
  .slip-commentary { font-size: 0.78rem; }
}
@media (max-width: 380px) {
  .fortune-cookie { width: 90px; }
  .cookie-visual { width: 70px; height: 47px; }
  .fortune-grid { gap: 0.5rem 0; }
}

/* ── SOLARI BOARD ──────────────────────────────────────────────────── */
.solari-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 1.1rem;
  transition: color 0.15s;
}
.solari-toggle:hover { color: var(--text); }

.solari-toggle .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.solari-toggle:hover .arrow {
  transform: rotate(-45deg);
}

.solari-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.solari-board {
  display: block;
  --tw: 22px;
  --th: 32px;
  --half: 16px;
  --fs: 16px;
}

.solari-row {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}
.solari-row:last-child { margin-bottom: 0; }

.tile {
  position: relative;
  width: var(--tw);
  height: var(--th);
  perspective: calc(var(--th) * 5);
  flex-shrink: 0;
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.08);
  pointer-events: none;
  z-index: 5;
}

.tile-upper,
.tile-lower,
.tile-flap {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--half);
  overflow: hidden;
}

.tile-upper {
  top: 0;
  border-radius: 3px 3px 0 0;
  background: #2f3033;
  border-bottom: 0.5px solid #1a1b1d;
}

.tile-lower {
  top: var(--half);
  border-radius: 0 0 3px 3px;
  background: #2f3033;
}

.tile-flap {
  top: var(--half);
  border-radius: 0 0 3px 3px;
  background: #2f3033;
  transform-origin: top center;
  transform: rotateX(0deg);
  z-index: 4;
  will-change: transform;
  backface-visibility: hidden;
}

.tile-upper span,
.tile-lower span,
.tile-flap  span {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--th);
  line-height: var(--th);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs);
  font-weight: 800;
  color: #f5f0e8;
  letter-spacing: 0.02em;
  user-select: none;
  pointer-events: none;
}

.tile-upper span { top: 0; }
.tile-lower span,
.tile-flap  span { top: calc(-1 * var(--half)); }

.solari-meta {
  display: flex;
  align-items: center;
  margin-top: 0.85rem;
  gap: 1rem;
  width: var(--board-w, 100%);
}

.solari-attribution {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex: 1;
  min-height: 1em;
}

.solari-refresh {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  transition: color 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.solari-refresh:hover    { color: var(--text); }
.solari-refresh:disabled { opacity: 0.3; cursor: default; }

/* ── SOLARI MODAL ──────────────────────────────────────────────────── */
.solari-modal {
  position: fixed;
  inset: 0;
  background: #1e1d1b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.solari-modal.open {
  opacity: 1;
  pointer-events: all;
}
.solari-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
}
.solari-modal-close:hover { color: rgba(255,255,255,0.75); }
.solari-modal-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  width: 90vw;
  max-width: 1000px;
  padding: 1.5rem;
}
.solari-modal .solari-attribution { color: rgba(245,240,232,0.45); }

.quote-nav-pill {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.quote-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(245,240,232,0.45);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.quote-nav-btn:hover {
  color: rgba(245,240,232,0.9);
  background: rgba(255,255,255,0.1);
}
.quote-nav-btn.active {
  background: rgba(255,255,255,0.85);
  color: #1e1d1b;
}
.quote-nav-btn:disabled { opacity: 0.25; cursor: default; }

