/* =========================================================
   Kenza Benajiba — Personal Academic Site
   Design system: "Research Ledger"
   A bound-notebook motif for a running weekly research log.
   ========================================================= */

:root {
  --cardinal:   #C41230; /* CMU primary */
  --iron:       #63666A; /* CMU secondary */
  --ink:        #22201E; /* body text */
  --paper:      #FAF8F4; /* page background */
  --paper-dim:  #F1EDE4; /* card background */
  --rule:       #D8D3C8; /* hairline dividers */
  --rule-dark:  #B9B2A2;

  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: Helvetica, Arial, sans-serif;

  --max-width: 760px;
}

html[data-theme="dark"] {
  --ink:        #EDEAE3;
  --paper:      #1B1918;
  --paper-dim:  #262321;
  --rule:       #3A3634;
  --rule-dark:  #4C4744;
  --iron:       #A6A29A;
  /* --cardinal stays the same in both themes on purpose: it's the constant */
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--cardinal);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 18, 48, 0.35);
  transition: border-color 0.15s ease, color 0.15s ease;
}

a:hover,
a:focus-visible {
  border-bottom-color: var(--cardinal);
}

a:focus-visible {
  outline: 2px solid var(--cardinal);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

/* ---------- Site header / nav ---------- */

.site-header {
  border-bottom: 3px solid var(--cardinal);
  background: var(--paper);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.site-header__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-header__name a {
  border-bottom: none;
  color: var(--ink);
}

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--iron);
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--cardinal);
  border-bottom-color: var(--cardinal);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--rule-dark);
  color: var(--iron);
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--cardinal);
  border-color: var(--cardinal);
}

.entry-meta .reading-time {
  color: var(--iron);
}

.entry-meta .dot-sep {
  margin: 0 6px;
  color: var(--rule-dark);
}

/* ---------- Page shell ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cardinal);
  font-weight: bold;
  margin: 0 0 8px;
}

/* ---------- Homepage ---------- */

.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 10px;
}

.hero p {
  color: var(--iron);
  max-width: 55ch;
}

.hero-cta {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  border: 1px solid var(--cardinal);
  color: var(--cardinal);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--cardinal);
}

.hero-cta:hover {
  background: var(--cardinal);
  color: var(--paper);
}

/* ---------- Research Ledger (index of entries) ---------- */

.ledger {
  position: relative;
  margin-top: 20px;
  padding-left: 28px;
  border-left: 3px solid var(--cardinal);
}

.ledger-entry {
  position: relative;
  padding: 4px 0 30px 20px;
}

.ledger-entry::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--cardinal);
}

.ledger-entry__week {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cardinal);
}

.ledger-entry__date {
  font-size: 0.78rem;
  color: var(--iron);
  margin-left: 8px;
}

.ledger-entry h2 {
  font-size: 1.25rem;
  margin: 4px 0 6px;
}

.ledger-entry h2 a {
  border-bottom: none;
  color: var(--ink);
}

.ledger-entry h2 a:hover {
  color: var(--cardinal);
}

.ledger-entry p {
  color: var(--iron);
  margin: 0;
  max-width: 60ch;
}

/* ---------- Research entry page ---------- */

.entry-header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 20px;
  margin-bottom: 32px;
}

.entry-header h1 {
  font-size: 1.75rem;
  margin: 0 0 6px;
}

.entry-meta {
  font-size: 0.85rem;
  color: var(--iron);
}

.qa-block {
  margin-bottom: 34px;
}

.qa-block__question {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cardinal);
  margin-bottom: 10px;
  line-height: 1.4;
}

.qa-block__answer p {
  margin: 0 0 14px;
}

.qa-block__answer pre {
  background: var(--paper-dim);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 0.88rem;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
}

.references {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 3px double var(--rule-dark);
}

.references h2 {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

.references ol {
  padding-left: 22px;
  color: var(--iron);
}

.references li {
  margin-bottom: 8px;
}

.references li a {
  color: var(--ink);
}

/* ---------- Numbered takeaways list (reusable across entries) ---------- */

ol.takeaways {
  padding-left: 0;
  list-style: none;
  counter-reset: item;
  margin: 1.5rem 0 2rem;
}

ol.takeaways li {
  counter-increment: item;
  position: relative;
  padding: 1rem 0 1rem 3rem;
  border-bottom: 1px solid var(--rule);
}

ol.takeaways li:last-child { border-bottom: none; }

ol.takeaways li::before {
  content: counter(item);
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--cardinal);
  position: absolute;
  left: 0;
  top: 1rem;
  font-size: 1.1rem;
}

/* ---------- Scotty mascot ---------- */

.mascot-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mascot-bubble {
  max-width: 220px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 10px 13px;
  border-radius: 10px 10px 2px 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mascot-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#scotty-mascot {
  width: 100px;
  height: 56px;
  cursor: pointer;
  background: var(--paper-dim);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 4px 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

#scotty-mascot:hover,
#scotty-mascot:focus-visible {
  border-color: var(--cardinal);
  transform: scale(1.06);
}

#scotty-mascot.is-bouncing {
  animation: scotty-bounce 0.5s ease;
}

#scotty-tail {
  transform-box: fill-box;
  transform-origin: 85% 65%;
  animation: tail-wag 1.8s ease-in-out infinite;
}

@keyframes tail-wag {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-14deg); }
}

.mascot-bubble.is-streak {
  background: var(--cardinal);
}

.confetti-piece {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  pointer-events: none;
  animation: confetti-pop 0.9s ease-out forwards;
}

@keyframes confetti-pop {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), -70px) rotate(240deg); opacity: 0; }
}

@keyframes scotty-bounce {
  0%   { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(-8deg) scale(1.08); }
  50%  { transform: rotate(6deg) scale(1.1); }
  75%  { transform: rotate(-4deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}

@media (max-width: 500px) {
  .mascot-wrap { right: 14px; bottom: 14px; }
  #scotty-mascot { width: 82px; height: 46px; }
  .mascot-bubble { max-width: 180px; font-size: 0.78rem; }
}

/* ---------- Ledger scroll marker ---------- */

#ledger-marker {
  position: absolute;
  left: -8.5px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cardinal);
  box-shadow: 0 0 0 4px var(--paper), 0 0 10px rgba(196,18,48,0.5);
  transition: top 0.12s linear;
  pointer-events: none;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--iron);
}

/* ---------- Responsive ---------- */

@media (max-width: 500px) {
  .site-header__inner { padding: 22px 18px 16px; }
  main { padding: 30px 18px 60px; }
  .hero h1 { font-size: 1.7rem; }
  .ledger { padding-left: 20px; }
  .ledger-entry { padding-left: 14px; }
  .ledger-entry::before { left: -26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a, .hero-cta { transition: none; }
  #scotty-mascot.is-bouncing { animation: none; }
  #scotty-tail { animation: none; }
  .confetti-piece { animation: none; display: none; }
  #ledger-marker { transition: none; }
  body { transition: none; }
}

/* ---------- About page: bio external links ---------- */ .bio-links { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; } .bio-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--iron); border-radius: 999px; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; } .bio-link:hover, .bio-link:focus-visible { color: var(--paper); background-color: var(--cardinal); border-color: var(--cardinal); } .bio-link.is-wagging svg { animation: bio-link-wag 0.5s ease; } @keyframes bio-link-wag { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(14deg); } 50% { transform: rotate(-14deg); } 75% { transform: rotate(8deg); } } @media (prefers-reduced-motion: reduce) { .bio-link.is-wagging svg { animation: none; } }

.bio-links {
  display: flex;
  gap: 20px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.bio-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border: 1px solid var(--iron);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.bio-link svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

