/*
Theme Name: The Memory Card
Theme URI: https://thememorycard.uk
Author: Dan
Description: Dark, lightweight blog theme for The Memory Card — PS1-era retro gaming.
Version: 1.0.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: memorycard
*/

:root {
  --bg: #17171a;
  --surface: #1f1f24;
  --surface-2: #26262c;
  --border: #34343c;
  --text: #e9e7ec;
  --muted: #a29fa9;
  --link: #7db2e0;
  --link-hover: #a3cbee;
  --ps-green: #3fa66f;
  --ps-red: #d65a5a;
  --ps-blue: #5a9fd4;
  --ps-pink: #c477a9;
  --radius: 6px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: 0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.site-logo:hover { color: var(--text); text-decoration: none; }
.site-logo svg { display: block; }

.nav-toggle {
  display: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.site-nav ul {
  display: flex;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--muted);
  font-weight: 600;
}
.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a {
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 0.5rem 0; }
  .site-nav li { border-top: 1px solid var(--border); }
  .site-nav a { display: block; padding: 0.7rem 0.25rem; }
}

/* ---------- Hero (front page) ---------- */
.hero {
  padding: 3.5rem 0 3rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.hero h1 { font-size: 2.4rem; margin-bottom: 0.4em; }
.hero p {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 640px;
  margin: 0;
}

/* ---------- Sections ---------- */
.section { padding: 2.75rem 0; }
.section-title {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- Post cards ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.post-card-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.post-card-body {
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.post-card-category {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ps-green);
}
.post-card h2, .post-card h3 { font-size: 1.15rem; margin: 0; }
.post-card h2 a, .post-card h3 a { color: var(--text); }
.post-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.post-card-meta {
  margin-top: auto;
  padding-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Blog listing ---------- */
.page-title { margin: 2.25rem 0 1.5rem; }
.archive-description { color: var(--muted); margin-top: -0.75rem; margin-bottom: 1.5rem; }

.pagination { margin: 2.5rem 0; }
.pagination .nav-links { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pagination .page-numbers {
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.pagination .page-numbers.current { color: var(--text); border-color: var(--muted); }

/* ---------- Single post ---------- */
.single-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2.5rem;
  padding: 2.5rem 0;
}
@media (max-width: 860px) {
  .single-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

.entry-header h1 { font-size: 2.1rem; }
.entry-thumb img { border-radius: var(--radius); margin-bottom: 1.5rem; }

.entry-content { font-size: 1.0625rem; }
.entry-content h2 { margin-top: 2em; }
.entry-content h3 { margin-top: 1.6em; }
.entry-content img { border-radius: var(--radius); }
.entry-content blockquote {
  margin: 1.5em 0;
  padding: 0.25em 1.25em;
  border-left: 3px solid var(--ps-blue);
  color: var(--muted);
}
.entry-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em;
  overflow-x: auto;
}
.entry-content .wp-block-table table,
.entry-content table {
  border-collapse: collapse;
  width: 100%;
}
.entry-content th, .entry-content td {
  border: 1px solid var(--border);
  padding: 0.5em 0.75em;
}

.entry-tags { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.entry-tags a {
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  color: var(--muted);
}
.entry-tags a:hover { color: var(--text); text-decoration: none; }

/* ---------- Post meta sidebar ---------- */
.post-sidebar { align-self: start; }
.meta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 1.25rem;
}
.meta-author {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.meta-author img {
  border-radius: 50%;
  display: block;
}
.meta-author-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
}
.meta-author-name { font-weight: 700; color: var(--text); }
.meta-rows { display: grid; gap: 0.65rem; margin: 0; }
.meta-row { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.92rem; }
.meta-row dt { color: var(--muted); margin: 0; }
.meta-row dd { margin: 0; text-align: right; }
.meta-cats { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.meta-cats-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
  margin-bottom: 0.4rem;
}

/* ---------- About / pages ---------- */
.page-layout { padding: 2.5rem 0; max-width: 760px; }
.about-intro { font-size: 1.2rem; color: var(--muted); margin-bottom: 2rem; }
.about-image img { border-radius: var(--radius); margin-bottom: 1.5rem; }

/* ---------- Comments ---------- */
.comments-area { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comment-list { list-style: none; padding: 0; display: grid; gap: 1.25rem; }
.comment-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.comment-meta { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.5rem; }
.comment-list .children { list-style: none; margin-top: 1.25rem; padding-left: 1.5rem; display: grid; gap: 1.25rem; }
.comment-form label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font: inherit;
  margin-bottom: 1rem;
}
.comment-form input:focus, .comment-form textarea:focus { outline: 1px solid var(--ps-blue); }

/* ---------- Buttons & forms ---------- */
.button, button[type="submit"], input[type="submit"] {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 0.55rem 1.3rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button:hover, button[type="submit"]:hover, input[type="submit"]:hover {
  border-color: var(--text);
  text-decoration: none;
  color: var(--text);
}

.search-form { display: flex; gap: 0.5rem; max-width: 420px; }
.search-form input[type="search"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font: inherit;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 3rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-shapes {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.footer-shapes svg { display: block; opacity: 0.75; }
.site-footer p { margin: 0; }

/* ---------- Misc ---------- */
.error-404 { padding: 4rem 0; max-width: 560px; }
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
}
.alignwide { max-width: 1080px; }
.aligncenter { margin-left: auto; margin-right: auto; display: block; }
