/*
Theme Name: Hamelton
Theme URI: https://hamelton.info
Author: James E. Hamelton Jr.
Author URI: https://hamelton.info
Description: Clean modern theme for Hamelton.info — blog, personal writing, and HTML games.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: hamelton
*/

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  --black:    #0d0d0d;
  --white:    #ffffff;
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --accent:   #1d4ed8;
  --accent-light: #eff6ff;
  --accent-hover: #1e40af;

  --radius:    12px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);

  --container: 1160px;
  --header-h:  62px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-200);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-branding { flex-shrink: 0; }
.site-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--black);
  line-height: 1;
}
.site-description {
  font-size: .7rem;
  color: var(--gray-400);
  letter-spacing: .03em;
  margin-top: .1rem;
}
.main-navigation { flex: 1; display: flex; gap: .25rem; }
.main-navigation a {
  font-size: .84rem;
  font-weight: 500;
  color: var(--gray-500);
  padding: .375rem .75rem;
  border-radius: 99px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.main-navigation a:hover,
.main-navigation a.current-menu-item,
.main-navigation a.current_page_item { color: var(--black); background: var(--gray-100); }
.main-navigation .games-link.active-games { color: var(--accent); background: var(--accent-light); }

.header-search { margin-left: auto; }
.header-search form {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--gray-100);
  border-radius: 99px;
  padding: .375rem .875rem .375rem 1rem;
}
.header-search input[type="search"] {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: .84rem;
  color: var(--black);
  width: 130px;
}
.header-search input[type="search"]::placeholder { color: var(--gray-400); }
.header-search button {
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  color: var(--gray-500);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: .375rem;
  color: var(--gray-600);
}

/* ============================================================
   Hero Post (front page featured)
   ============================================================ */
.hero-section { padding: 2rem 0 0; }
.hero-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: box-shadow .2s, transform .2s;
}
.hero-post:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.hero-thumbnail {
  background-size: cover;
  background-position: center;
  min-height: 300px;
}
.hero-thumbnail--placeholder {
  background: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
}
.hero-body {
  background: var(--black);
  color: var(--white);
  padding: 2.5rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: .75rem;
}
.hero-title {
  font-size: 1.875rem;
  color: var(--white);
  line-height: 1.2;
}
.hero-excerpt { color: rgba(255,255,255,.65); font-size: .9rem; line-height: 1.55; }
.hero-meta { color: rgba(255,255,255,.4); font-size: .8rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ============================================================
   Category Badge
   ============================================================ */
.cat-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .2rem .65rem;
  border-radius: 99px;
  color: var(--badge-color, #1d4ed8);
  background: color-mix(in srgb, var(--badge-color, #1d4ed8) 12%, white);
}

/* ============================================================
   Posts Grid
   ============================================================ */
.posts-section { padding: 2.5rem 0 4rem; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--black);
}
.section-link { font-size: .82rem; color: var(--accent); }
.section-link:hover { text-decoration: underline; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.post-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--gray-200);
}
.post-card-thumb {
  height: 190px;
  background-size: cover;
  background-position: center;
  background-color: var(--gray-100);
}
.post-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}
.post-card-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.3;
  color: var(--black);
}
.post-card-title a { color: inherit; }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt {
  color: var(--gray-500);
  font-size: .875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid var(--gray-100);
  font-size: .78rem;
  color: var(--gray-400);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.post-card-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag-pill {
  font-size: .7rem;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: .15rem .5rem;
  border-radius: 99px;
}
a.tag-pill:hover { background: var(--accent-light); color: var(--accent); }

/* ============================================================
   Games Grid
   ============================================================ */
.game-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.game-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.game-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.game-thumb {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--gray-100);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-thumb--placeholder {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
}
.game-thumb-icon { color: rgba(255,255,255,.5); }
.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.game-card:hover .play-overlay { background: rgba(0,0,0,.3); }
.play-btn {
  background: rgba(255,255,255,.9);
  color: var(--black);
  font-size: .78rem;
  font-weight: 600;
  padding: .4rem .9rem;
  border-radius: 99px;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .2s, transform .2s;
}
.game-card:hover .play-btn { opacity: 1; transform: scale(1); }
.game-card-body { padding: 1rem; flex: 1; }
.game-card-title { font-family: var(--font-display); font-size: 1rem; margin-bottom: .35rem; }
.game-card-title a { color: var(--black); }
.game-card-title a:hover { color: var(--accent); }
.game-card-desc { font-size: .82rem; color: var(--gray-500); line-height: 1.45; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 .75rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-100);
  transition: all .15s;
}
.pagination .page-numbers:hover { background: var(--accent-light); color: var(--accent); }
.pagination .page-numbers.current { background: var(--black); color: var(--white); }
.pagination .page-numbers.dots { background: none; }

/* ============================================================
   Single Post
   ============================================================ */
.single-wrap { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }
.post-header { margin-bottom: 2rem; }
.post-breadcrumb {
  font-size: .8rem;
  color: var(--gray-400);
  margin-bottom: 1.25rem;
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}
.post-breadcrumb a { color: var(--gray-500); }
.post-breadcrumb a:hover { color: var(--accent); }
.post-title-single {
  font-size: 2.5rem;
  line-height: 1.15;
  margin-bottom: .875rem;
}
.post-lead {
  font-size: 1.125rem;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.post-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .875rem 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  font-size: .84rem;
  color: var(--gray-400);
  margin-bottom: 2rem;
}
.post-author { font-weight: 500; color: var(--gray-600); }
.post-featured-image { border-radius: var(--radius); overflow: hidden; margin-bottom: 2.5rem; }
.post-featured-image img { width: 100%; max-height: 500px; object-fit: cover; }

/* Post Content */
.entry-content { font-size: 1.0625rem; line-height: 1.8; color: #1a1a1a; }
.entry-content > * + * { margin-top: 1.25rem; }
.entry-content h2 { font-size: 1.625rem; margin-top: 2.25rem; margin-bottom: .625rem; }
.entry-content h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: .5rem; }
.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.entry-content ul, .entry-content ol { padding-left: 1.5rem; }
.entry-content li + li { margin-top: .35rem; }
.entry-content blockquote {
  border-left: 3px solid var(--accent);
  padding: .75rem 1.25rem;
  background: var(--accent-light);
  border-radius: 0 8px 8px 0;
  color: var(--gray-800);
  margin: 1.5rem 0;
}
.entry-content code {
  background: var(--gray-100);
  padding: .15em .4em;
  border-radius: 4px;
  font-size: .875em;
}
.entry-content pre {
  background: var(--gray-800);
  color: #f3f4f6;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: .875rem;
}
.entry-content pre code { background: none; padding: 0; }
.entry-content img { border-radius: 8px; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.entry-content th, .entry-content td {
  padding: .6rem .875rem;
  border: 1px solid var(--gray-200);
  text-align: left;
}
.entry-content th { background: var(--gray-50); font-weight: 600; }
.entry-content hr { border: none; border-top: 1px solid var(--gray-200); }

/* ============================================================
   Game Embed (single game post)
   ============================================================ */
.game-embed-wrapper {
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}
.game-embed-bar {
  background: var(--gray-800);
  color: var(--white);
  padding: .625rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .84rem;
  font-weight: 500;
}
.game-embed-bar .fullscreen-btn {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  padding: .25rem .65rem;
  border-radius: 6px;
  font-size: .75rem;
  transition: background .15s;
}
.game-embed-bar .fullscreen-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.game-frame {
  width: 100%;
  height: 560px;
  border: none;
  display: block;
  background: #000;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: 1.75rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  font-size: .82rem;
  color: var(--gray-400);
}
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a { color: var(--gray-500); transition: color .15s; }
.footer-nav a:hover { color: var(--accent); }

/* ============================================================
   Widgets / Sidebar
   ============================================================ */
.widget + .widget { margin-top: 2rem; }
.widget-title {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: .875rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gray-200);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
  .hero-post { grid-template-columns: 1fr; }
  .hero-thumbnail { min-height: 220px; }
  .hero-title { font-size: 1.5rem; }
}
@media (max-width: 720px) {
  .post-title-single { font-size: 1.875rem; }
  .main-navigation { display: none; }
  .main-navigation.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: .75rem 1rem;
    box-shadow: var(--shadow-md);
    z-index: 100;
  }
  .menu-toggle { display: flex; }
  .header-search input { width: 80px; }
}
@media (max-width: 520px) {
  .post-grid { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); }
  .hero-body { padding: 1.5rem; }
}
