/* Rosé Pine Moon palette */
:root {
  --base:           #232136;
  --surface:        #2a273f;
  --overlay:        #393552;
  --muted:          #6e6a86;
  --subtle:         #908caa;
  --text:           #e0def4;
  --love:           #eb6f92;
  --gold:           #f6c177;
  --rose:           #ea9a97;
  --pine:           #3e8fb0;
  --foam:           #9ccfd8;
  --iris:           #c4a7e7;
  --hl-low:         #2a283e;
  --hl-med:         #44415a;
  --hl-high:        #56526e;
}

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

body {
  background-color: var(--base);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--foam);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--iris);
}

/* ── Header ─────────────────────────────────────────── */

.site-header {
  padding: 1.25rem 2rem;
  background-color: var(--surface);
  border-bottom: 1px solid var(--overlay);
}

.site-title {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.site-title:hover {
  color: var(--iris);
}

/* ── Main ────────────────────────────────────────────── */

.site-main {
  flex: 1;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Tiles ───────────────────────────────────────────── */

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tile {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border-radius: 10px;
  border-top: 3px solid var(--tile-accent, var(--iris));
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.tile-image {
  flex: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--overlay);
  background-size: cover;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 100%);
}

.tile-footer {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  background-color: var(--surface);
  border-top: 1px solid var(--overlay);
}

.tile-title {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.tile-desc {
  font-size: 0.8rem;
  color: var(--subtle);
}

/* ── Deck tile grid ──────────────────────────────────── */

.deck-tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.deck-tiles-grid .tile {
  aspect-ratio: unset;
}

.deck-tiles-grid .tile-image {
  flex: none;
  width: 100%;
  aspect-ratio: 626 / 457;
}

@media (max-width: 640px) {
  .deck-tiles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Post list ───────────────────────────────────────── */

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--text);
  margin-top: 0.5rem;
}

.back-link {
  font-size: 0.85rem;
  color: var(--muted);
}

.back-link:hover {
  color: var(--foam);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  display: block;
  background-color: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.post-card:hover {
  border-color: var(--iris);
  transform: translateX(3px);
}

.post-card h2 {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.post-card time {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-card p {
  font-size: 0.9rem;
  color: var(--subtle);
}

/* ── Single post ─────────────────────────────────────── */

.post {
  max-width: 868px;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 2rem;
  color: var(--text);
  margin: 0.5rem 0 0.4rem;
  line-height: 1.25;
}

.post-header time {
  font-size: 0.85rem;
  color: var(--muted);
}

.post-content {
  color: var(--text);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--text);
  margin: 1.75rem 0 0.6rem;
  line-height: 1.3;
}

.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.15rem; }

.post-content p {
  margin-bottom: 1rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content img {
  max-width: 100%;
  border-radius: 6px;
  margin: 0.5rem 0;
}

.post-content a {
  color: var(--foam);
  text-decoration: underline;
  text-decoration-color: var(--hl-high);
}

.post-content a:hover {
  color: var(--iris);
  text-decoration-color: var(--iris);
}

.post-content blockquote {
  border-left: 3px solid var(--iris);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--subtle);
  background-color: var(--hl-low);
  border-radius: 0 4px 4px 0;
}

.post-content code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88em;
  background-color: var(--overlay);
  color: var(--foam);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post-content pre {
  background-color: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--overlay);
  margin: 2rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--overlay);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content th {
  background-color: var(--surface);
  color: var(--subtle);
}

/* ── Card references ─────────────────────────────────── */

.card-ref {
  color: var(--foam);
  border-bottom: 1px dotted var(--foam);
  cursor: default;
}

#card-tooltip {
  display: none;
  position: fixed;
  z-index: 999;
  pointer-events: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

#card-tooltip img {
  display: block;
  height: 300px;
  width: auto;
}

/* ── Matchup collapsibles ────────────────────────────── */

.matchup {
  border: 1px solid var(--overlay);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background-color: var(--surface);
}

.matchup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.matchup-header::-webkit-details-marker { display: none; }

.matchup-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.matchup-rating {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.matchup-rating.favored           { color: var(--pine); }
.matchup-rating.slightly-favored  { color: var(--foam); }
.matchup-rating.even              { color: var(--gold); }
.matchup-rating.slightly-unfavored { color: var(--rose); }
.matchup-rating.unfavored         { color: var(--love); }

.matchup-body {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--overlay);
  font-size: 0.9rem;
  color: var(--subtle);
}

.matchup-body p:last-child { margin-bottom: 0; }

/* ── Deck cards ──────────────────────────────────────── */

.deck-cards {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.deck-col {
  flex: 1;
  min-width: 0;
}

.deck-card {
  width: 100%;
  margin: 0;
}

.deck-card .stack-img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  margin: 0;
  transition: height 0.25s ease;
}

.deck-card:hover .stack-img {
  height: 300px;
}

.deck-card.full-art .stack-img {
  height: auto;
  transition: none;
}

/* ── Footer ──────────────────────────────────────────── */

.site-footer {
  padding: 1.25rem 2rem;
  background-color: var(--surface);
  border-top: 1px solid var(--overlay);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 640px) {
  .site-main {
    padding: 1.5rem 1rem;
  }

  .tiles-grid {
    grid-template-columns: 1fr;
  }

  .post-header h1,
  .page-header h1 {
    font-size: 1.5rem;
  }
}
