/* tommynyquist.com — shared components for Jekyll pages (layout, indexes,
   prose). Requires tn-tokens.css. Lab projects may link this too, or keep
   their component CSS inline — tokens are the contract, components a bonus.
   Component inventory is demoed on /styleguide/. */

/* ---------- base ---------- */
*{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap{ max-width: 760px; margin: 0 auto; padding: 22px 18px 48px; }
a{ color: var(--accent); }
a:hover{ color: var(--btn); }

/* ---------- masthead + nav ---------- */
.site-header{
  display: flex; align-items: center; gap: 18px;
  padding: 8px 0 20px; flex-wrap: wrap;
}
.site-logo img{ width: 84px; height: auto; display: block; }
.site-id{ flex: 1; min-width: 200px; }
.site-title{
  font-family: var(--font-disp); font-weight: 700;
  font-size: 1.7rem; line-height: 1.2;
}
.site-title a{ color: var(--ink); text-decoration: none; }
.site-tagline{ color: var(--muted); font-style: italic; font-size: .95rem; margin-top: 2px; }
.site-nav{ display: flex; gap: 8px; flex-wrap: wrap; }
.site-nav a{
  display: inline-block; font-weight: 700; font-size: .85rem; letter-spacing: .4px;
  color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: 999px; padding: 4px 14px;
  background: var(--card); box-shadow: 2px 2px 0 var(--ink);
}
.site-nav a:hover{ background: var(--btn-hover); color: var(--ink); }
.site-nav a.current{ background: var(--ink); color: #fff; }

/* ---------- page banner (the coral title bar) ---------- */
.page-banner{
  font-family: var(--font-disp); font-weight: 700; font-size: 1.5rem;
  color: var(--btn-hover);
  background: var(--accent);
  border: 2px solid var(--ink); border-radius: 8px;
  box-shadow: var(--shadow-el);
  padding: 8px 16px; margin: 4px 0 22px;
}

/* ---------- prose (markdown content) ---------- */
.prose{ font-weight: 500; }
.prose p{ margin: 0 0 1em; }
.prose h1, .prose h2, .prose h3{
  font-family: var(--font-disp); font-weight: 700; line-height: 1.25;
  margin: 1.5em 0 .5em;
}
.prose h1{ font-size: 1.5rem; }
.prose h2{ font-size: 1.25rem; }
.prose h3{ font-size: 1.05rem; }
.prose img{ max-width: 100%; }
.prose li{ margin: .25em 0; }
.prose strong{ font-weight: 800; }
.prose code{
  background: var(--tile); border: 1px solid var(--line);
  border-radius: 6px; padding: .1em .35em; font-size: .9em;
}
.prose pre{
  background: var(--tile); border: 2px solid var(--line);
  border-radius: var(--r-tile); padding: 12px 14px; overflow-x: auto;
}
.prose pre code{ border: none; background: none; padding: 0; }
.prose hr{ border: none; border-top: 2px solid var(--line); margin: 1.6em 0; }
.prose blockquote{
  margin: 1em 0; padding: .1em 0 .1em 1rem;
  border-left: 4px solid var(--accent); color: var(--muted);
}

/* intro callout (the coral-bar paragraph on index pages) */
.intro{
  border-left: 4px solid var(--accent); padding-left: 1rem;
  margin: 0 0 1.6rem; font-size: 1.05rem; line-height: 1.6;
}

/* ---------- optional figure (About portrait) ----------
   Desktop: a column to the right of the text. Mobile: floats small beside
   the opening paragraphs instead of sinking to the bottom of the page.
   (The figure comes FIRST in the DOM so the float can wrap the text.) */
.page-cols{ display: flex; gap: 22px; align-items: flex-start; }
.page-cols::after{ content: ""; display: block; clear: both; }
.page-cols .prose{ flex: 3; min-width: 0; }
.page-figure{
  flex: 1; min-width: 180px; max-width: 256px; margin: 0; order: 2;
  border: 2px solid var(--ink); border-radius: var(--r-tile);
  box-shadow: var(--shadow-el); overflow: hidden; background: var(--card);
}
.page-figure img{ display: block; width: 100%; }
@media (max-width: 640px){
  .page-cols{ display: block; }
  .page-figure{
    float: right; width: 42%; max-width: 160px; min-width: 0;
    margin: .3rem 0 .7rem 1rem;
  }
}

/* ---------- buttons & chips ---------- */
.btn{
  display: inline-block; padding: .6rem 1.2rem; cursor: pointer;
  background: var(--btn); color: #ffffff !important; text-decoration: none;
  font-family: var(--font-ui); font-weight: 700;
  white-space: nowrap;
  border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: 2px 2px 0 var(--ink);
  transition: all .1s ease-in-out;
}
.btn:hover{ background: var(--btn-hover); color: var(--ink) !important; }
.chip{
  display: inline-block; font-weight: 800; font-size: .9rem;
  border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px;
  box-shadow: var(--shadow-el); white-space: nowrap;
}
.chip.up{ background: var(--up-bg); color: var(--up); }
.chip.down{ background: var(--down-bg); color: var(--down); }
.chip.flat{ background: #eef1f5; color: var(--flat); }

/* ---------- project cards (games + lab indexes, home hub) ---------- */
.proj-list{ display: flex; flex-direction: column; gap: 1.4rem; margin: 1.4rem 0; }
.proj-card{
  position: relative;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.15rem 1.4rem;
  background: var(--card);
  border: 2px solid var(--ink); border-radius: var(--r-tile);
  box-shadow: 4px 4px 0 var(--ink);
  transition: all .15s ease-in-out;
}
.proj-card:hover{
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--accent);
  border-color: var(--accent);
}
.proj-main{ display: flex; gap: 1.2rem; align-items: center; min-width: 0; }
.proj-thumb{
  width: 72px; height: 72px; flex-shrink: 0; object-fit: cover;
  border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: 2px 2px 0 var(--ink); background: var(--bg);
}
.proj-thumb.emoji{
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; background: var(--tile);
}
.proj-info{ display: flex; flex-direction: column; gap: .22rem; min-width: 0; }
.proj-title{ margin: 0; font-family: var(--font-disp); font-size: 1.35rem; color: var(--ink); }
.proj-desc{ line-height: 1.45; }
.proj-meta{ font-size: .88rem; color: var(--muted); font-style: italic; }
/* the whole card is the tap target; the button is just the affordance */
.proj-link{ flex-shrink: 0; }
.proj-link::after{ content: ""; position: absolute; inset: 0; border-radius: 8px; }
.proj-card:hover .proj-link{ background: var(--btn-hover); color: var(--ink) !important; }

@media (max-width: 576px){
  .proj-card{ flex-direction: column; align-items: flex-start; }
  .proj-link{ align-self: flex-end; }
  .proj-title{ font-size: 1.2rem; }
  .site-logo img{ width: 64px; }
}

/* ---------- footer ---------- */
.site-footer{
  margin-top: 44px; padding-top: 14px;
  border-top: 2px solid var(--line);
  color: var(--muted); font-size: .85rem; text-align: center;
}
.site-footer a{ color: var(--muted); }
.site-footer a:hover{ color: var(--accent); }
