/* ==========================================================================
   NapOnline — red/terminal design system
   Mobile-first. Custom properties are the single source of truth for the
   palette — see AGENTS.md before changing these.
   ========================================================================== */

:root {
  --bg-void: #121013;
  --bg-panel: #1c1417;
  --bg-panel-raised: #241a1d;
  --crimson-deep: #6e0f1a;
  --red-accent: #ff2d3a;
  --red-accent-dim: #b3131f;
  --text-primary: #f3ecec;
  --text-muted: #b8a9ab;
  --focus-ring: #ff6b74;
  --goal-green: #35d07f;
  --gold-accent: #ffd166;

  --font-mono: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
  --container-max: 960px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  padding: 0;
  background:
    linear-gradient(rgba(110, 15, 26, 0.08) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, rgba(110, 15, 26, 0.08) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--bg-void);
  color: var(--text-primary);
  font: 16px/1.5 var(--font-mono);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 92%;
  max-width: var(--container-max);
  margin: 0 auto;
}

a {
  color: var(--focus-ring);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: normal;
  font-family: var(--font-mono);
  color: var(--red-accent);
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p {
  margin: 0 0 1em;
}

ul, ol {
  padding-left: 1.4em;
}

/* Header / Footer
   ========================================================================== */

header {
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px dashed var(--crimson-deep);
  padding: 16px 0;
}

header .container {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
}

.site-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--red-accent);
  text-shadow: 0 0 8px rgba(255, 45, 58, 0.35);
}

.site-title::before {
  content: "./ ";
}

header .crumb {
  color: var(--text-muted);
}

footer {
  margin: 40px 0 20px;
  padding: 16px 0;
  border-top: 1px dashed var(--crimson-deep);
}

footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--text-muted);
}

footer a:hover {
  color: var(--focus-ring);
}

.icon-github {
  flex: none;
}

main.container {
  padding: 32px 0;
}

/* Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  background: var(--red-accent);
  color: #1a0507;
  font-family: var(--font-mono);
  font-weight: bold;
  padding: 10px 22px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--focus-ring);
  text-decoration: none;
}

.btn-primary {
  box-shadow: 0 0 16px rgba(255, 45, 58, 0.4);
}

/* Lighter-weight secondary action, same outline treatment as
   .game-mute-btn/.game-achievements-btn but sized for text labels rather
   than a single icon glyph. */
.btn-outline {
  display: inline-block;
  background: none;
  border: 1px solid var(--red-accent-dim);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  padding: 8px 18px;
  cursor: pointer;
  text-decoration: none;
}

.btn-outline:hover {
  border-color: var(--red-accent);
  color: var(--red-accent);
  text-decoration: none;
}

/* Portfolio
   ========================================================================== */

.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.portfolio-card {
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--crimson-deep);
  border-radius: 6px;
  padding: 18px;
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.portfolio-card:hover {
  border-color: var(--red-accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.portfolio-card h3 {
  margin-bottom: 0.3em;
}

.portfolio-card p {
  color: var(--text-muted);
  margin-bottom: 0.6em;
}

.portfolio-card--featured {
  border-color: var(--red-accent);
  box-shadow: 0 0 20px rgba(255, 45, 58, 0.15);
}

.portfolio-card__github {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.85rem;
  color: var(--focus-ring);
}

/* CSS-only modal. The trigger is an <a href="#id"> and :target reveals the
   panel — no JavaScript anywhere on the site outside the two games.
   Trade-off vs <dialog>.showModal(): no focus trap and no inert background,
   which is exactly why the markup uses role="dialog" WITHOUT aria-modal —
   claiming modality we don't enforce would be worse than not claiming it.
   .modal-scrim is an anchor, so it doubles as click-outside-to-close. */
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

/* Keep the page behind the modal from scrolling under it. */
html:has(.recipe-dialog:target),
html:has(.story-dialog:target) {
  overflow: hidden;
}

/* Recipes
   ========================================================================== */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.recipe-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--bg-panel);
  border: 1px solid var(--crimson-deep);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.recipe-card:hover {
  border-color: var(--red-accent);
}

.recipe-card__img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.recipe-card__img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel-raised);
  color: var(--red-accent);
  font-size: 2.5rem;
  text-transform: uppercase;
}

.recipe-card__body {
  padding: 12px 14px 16px;
}

.recipe-card__name {
  display: block;
  font-weight: bold;
  color: var(--red-accent);
  margin-bottom: 0.3em;
}

.recipe-card__desc {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.recipe-dialog {
  display: none;
}

.recipe-dialog:target {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.recipe-dialog__panel {
  position: relative;
  width: min(90vw, 640px);
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--red-accent);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-primary);
  padding: 24px;
  text-align: left;
}

.recipe-dialog__close {
  display: block;
  text-align: right;
  margin: -8px -8px 0 0;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
}

.recipe-dialog__close:hover {
  color: var(--red-accent);
}

.recipe-dialog__desc {
  color: var(--text-muted);
}

.recipe-dialog__img {
  max-width: 100%;
  border-radius: 6px;
  margin-bottom: 1em;
}

.recipe-dialog__refs a {
  font-size: 0.85rem;
}

/* Responsive breakpoints
   ========================================================================== */

@media (min-width: 600px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
