/*
Theme Name: NerdWriter
Theme URI: https://github.com/yourname/nerdwriter
Author: Your Name
Author URI: https://yourblog.com
Description: A masculine, nerdy personal essay theme. Warm cream parchment scroll on a dark background. Medieval gravitas meets science-fiction precision.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, personal, dark, essays, parchment, medieval
Text Domain: nerdwriter
*/

/* ============================================================
   GOOGLE FONTS IMPORT
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=IM+Fell+English:ital@0;1&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --page-bg:          #0a0a0a;
  --parchment:        #f5e6c8;
  --parchment-dark:   #e8d5a8;
  --parchment-edge:   #c8a96e;
  --parchment-crack:  #b8955a;
  --ink:              #1a1008;
  --ink-muted:        #4a3728;
  --section-break:    #6b4423;
  --pennant:          #ffffff;
  --pennant-text:     #0a0a0a;
  --glow-blue:        #4fc3f7;
  --glow-blue-dim:    rgba(79, 195, 247, 0.3);
  --glow-blue-outer:  rgba(79, 195, 247, 0.1);
  --wood-bg:          #6b4c2a;
  --wood-dark:        #4a3218;
  --wood-light:       #8b6540;
  --wood-text:        #f0d49a;
  --footer-bg:        #000000;
  --footer-text:      #ffffff;
  --font-display:     'Cinzel', 'Times New Roman', serif;
  --font-body:        'IM Fell English', Georgia, serif;
  --scroll-width:     760px;
  --scroll-padding:   48px;
  --sidebar-width:    120px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--page-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

.content-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 20px 60px;
  position: relative;
  flex: 1;
}

.scroll-with-sidebar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  gap: 0;
}

/* ============================================================
   DESKTOP HEADER
   ============================================================ */
.site-header {
  position: relative;
  padding: 24px 32px 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
}

.site-logo-anchor {
  display: block;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  text-decoration: none;
}

.site-logo-anchor img {
  height: 80px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
}

.logo-placeholder-text {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--pennant);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  line-height: 1;
  padding: 16px 0;
}

/* Pennant */
.pennant-nav {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: -2px;
  margin-top: 16px;
}

.pennant-shape {
  display: flex;
  align-items: center;
  position: relative;
  height: 48px;
  background: var(--pennant);
  padding: 0 52px 0 20px;
  clip-path: polygon(
    0% 0%,
    calc(100% - 28px) 0%,
    100% 50%,
    calc(100% - 28px) 100%,
    0% 100%
  );
  box-shadow: 2px 2px 12px rgba(0,0,0,0.5);
}

.pennant-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
}

.pennant-nav-list li a {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--pennant-text);
  letter-spacing: 0.06em;
  padding: 6px 10px;
  display: block;
  transition: text-shadow 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.pennant-nav-list li a:hover,
.pennant-nav-list li a.current {
  color: #0066cc;
  text-shadow:
    0 0 6px var(--glow-blue),
    0 0 14px var(--glow-blue),
    0 0 30px var(--glow-blue-dim),
    0 0 60px var(--glow-blue-outer);
}

/* ============================================================
   BLOG SIDEBAR — HANGING PLACARDS
   ============================================================ */
.blog-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 24px;
}

.placard-chain { display: flex; flex-direction: column; align-items: center; width: 100%; }

.placard-string {
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, #888 0%, #555 100%);
  margin: 0 auto;
}

.year-placard {
  display: block;
  background: linear-gradient(135deg, var(--wood-light) 0%, var(--wood-bg) 40%, var(--wood-dark) 100%);
  color: var(--wood-text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 8px 16px;
  border-radius: 3px;
  border: 2px solid var(--wood-dark);
  width: 90px;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 2px 4px 8px rgba(0,0,0,0.6);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.05em;
}

.year-placard:hover {
  transform: translateX(3px) rotate(1deg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 4px 6px 12px rgba(0,0,0,0.7);
  color: #fff;
}

/* ============================================================
   GAME TOC SIDEBAR
   ============================================================ */
.toc-sidebar {
  width: 200px;
  flex-shrink: 0;
  margin-right: 24px;
  padding-top: 20px;
}

.toc-sidebar h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--parchment-dark);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(245,230,200,0.2);
}

.toc-sidebar ul { list-style: none; padding: 0; }

.toc-sidebar ul li a {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--parchment-dark);
  display: block;
  padding: 4px 8px;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s;
  opacity: 0.8;
}

.toc-sidebar ul li a:hover { background: rgba(245,230,200,0.1); color: var(--parchment); opacity: 1; }

/* ============================================================
   THE SCROLL
   ============================================================ */
.scroll-container { width: var(--scroll-width); flex-shrink: 0; position: relative; }

.scroll-curl-top,
.scroll-curl-bottom {
  width: 100%;
  height: 60px;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.scroll-curl-top {
  background: radial-gradient(ellipse 50% 100% at 50% 0%, var(--parchment-dark) 0%, var(--parchment) 60%, transparent 100%);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3), inset 0 -6px 12px rgba(100,70,30,0.2);
  border-left: 2px solid var(--parchment-crack);
  border-right: 2px solid var(--parchment-crack);
  border-top: 2px solid var(--parchment-crack);
}

.scroll-curl-bottom {
  background: radial-gradient(ellipse 50% 100% at 50% 100%, var(--parchment-dark) 0%, var(--parchment) 60%, transparent 100%);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 -4px 8px rgba(0,0,0,0.3), inset 0 6px 12px rgba(100,70,30,0.2);
  border-left: 2px solid var(--parchment-crack);
  border-right: 2px solid var(--parchment-crack);
  border-bottom: 2px solid var(--parchment-crack);
}

.scroll-body {
  background-color: var(--parchment);
  padding: var(--scroll-padding);
  padding-left: calc(var(--scroll-padding) + 8px);
  padding-right: calc(var(--scroll-padding) + 8px);
  position: relative;
  border-left: 2px solid var(--parchment-crack);
  border-right: 2px solid var(--parchment-crack);
  box-shadow: 6px 0 20px rgba(0,0,0,0.4), -6px 0 20px rgba(0,0,0,0.4);
}

/* Cracked parchment left edge */
.scroll-body::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 18px;
  background:
    linear-gradient(to right, var(--parchment-crack) 0px, transparent 2px);
  box-shadow: inset 6px 0 12px rgba(100,70,30,0.25);
  pointer-events: none;
}

/* Cracked parchment right edge */
.scroll-body::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 18px;
  background:
    linear-gradient(to left, var(--parchment-crack) 0px, transparent 2px);
  box-shadow: inset -6px 0 12px rgba(100,70,30,0.25);
  pointer-events: none;
}

/* ============================================================
   PAGE TITLE
   ============================================================ */
.page-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--parchment-crack);
}

/* ============================================================
   POST ENTRY
   ============================================================ */
.post-entry { margin-bottom: 0; }

.post-entry-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.post-thumbnail-wrap {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
}

.post-thumbnail-wrap img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border: 2px solid var(--parchment-crack);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
}

/* Illuminated Initial */
.illuminated-initial {
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--parchment-crack) 100%);
  border: 3px solid var(--section-break);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(100,70,30,0.3), 3px 3px 10px rgba(0,0,0,0.2);
}

.illuminated-initial::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--section-break);
  opacity: 0.5;
}

.illuminated-initial::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid var(--section-break);
  opacity: 0.3;
}

.illuminated-initial span {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 900;
  color: var(--section-break);
  line-height: 1;
  text-shadow: 2px 2px 0 var(--parchment-crack), -1px -1px 0 rgba(0,0,0,0.1);
  position: relative;
  z-index: 1;
}

.post-meta-header { flex: 1; }

.entry-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.entry-title a { color: inherit; transition: color 0.2s; }
.entry-title a:hover { color: var(--section-break); }

.post-date {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 16px;
}

.entry-content {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink);
  margin-top: 16px;
  clear: both;
}

.entry-content p { margin-bottom: 1.2em; }

.entry-content h2,
.entry-content h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin: 1.5em 0 0.5em;
  letter-spacing: 0.04em;
}

.entry-content h2 { font-size: 22px; }
.entry-content h3 { font-size: 18px; }

/* ============================================================
   SECTION BREAKS
   ============================================================ */
.section-break {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 16px;
}

.section-break-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--parchment-crack), transparent);
}

.section-break svg {
  width: 80px;
  height: 28px;
  color: var(--section-break);
  fill: var(--section-break);
  flex-shrink: 0;
}

/* ============================================================
   ABOUT ME
   ============================================================ */
.about-photo-wrap {
  width: 220px;
  height: 220px;
  float: left;
  margin: 0 28px 20px 0;
}

.about-photo-wrap img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border: 3px solid var(--parchment-crack);
  box-shadow: 4px 4px 14px rgba(0,0,0,0.25);
}

.about-photo-placeholder {
  width: 220px;
  height: 220px;
  background: var(--parchment-dark);
  border: 3px dashed var(--parchment-crack);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--ink-muted);
  text-align: center;
  padding: 12px;
  letter-spacing: 0.05em;
}

.about-content { font-family: var(--font-body); font-size: 18px; line-height: 1.85; color: var(--ink); }
.about-content p { margin-bottom: 1.2em; }
.about-content::after { content: ''; display: table; clear: both; }

/* ============================================================
   LINKS PAGE
   ============================================================ */
.links-list { list-style: none; padding: 0; }

.links-list li {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--parchment-crack);
}

.links-list li:last-child { border-bottom: none; }

.links-list a.link-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--section-break);
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.links-list a.link-title:hover { color: var(--ink); }

.link-description {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ============================================================
   GAME WALKTHROUGHS
   ============================================================ */
.game-list { list-style: none; padding: 0; }

.game-list li {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--parchment-crack);
}

.game-list li:last-child { border-bottom: none; }

.game-list a.game-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.game-list a.game-title:hover { color: var(--section-break); }
.game-description { font-family: var(--font-body); font-size: 16px; color: var(--ink-muted); margin-top: 6px; font-style: italic; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 24px 32px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.03em;
  border-top: 1px solid #222;
}

/* ============================================================
   INFINITE SCROLL LOADER
   ============================================================ */
#infinite-scroll-loader {
  text-align: center;
  padding: 30px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

#infinite-scroll-loader.hidden { display: none; }

/* ============================================================
   MOBILE HEADER
   ============================================================ */
.mobile-header {
  display: none;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
  padding-top: 20px;
  transition: padding 0.3s ease, background 0.3s ease;
}

.mobile-logo-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: block;
}

.mobile-logo-btn img {
  height: 90px;
  width: auto;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.9));
  transition: height 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.mobile-logo-text {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: var(--pennant);
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
  transition: font-size 0.4s ease;
  line-height: 1;
}

.mobile-header.scrolled {
  padding: 8px 0;
  background: rgba(10,10,10,0.96);
  backdrop-filter: blur(8px);
  width: 100%;
}

.mobile-header.scrolled .mobile-logo-btn img { height: 46px; }
.mobile-header.scrolled .mobile-logo-text { font-size: 20px; }

.mobile-nav-dropdown {
  display: none;
  flex-direction: column;
  background: rgba(10,10,10,0.97);
  border: 1px solid #333;
  width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.8);
  animation: dropDown 0.25s ease forwards;
}

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mobile-nav-dropdown.open { display: flex; }

.mobile-nav-dropdown a {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--pennant);
  padding: 14px 20px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #222;
  transition: color 0.2s, background 0.2s;
}

.mobile-nav-dropdown a:last-child { border-bottom: none; }

.mobile-nav-dropdown a:hover {
  background: #111;
  color: var(--glow-blue);
  text-shadow: 0 0 10px var(--glow-blue);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --scroll-width: 100%;
    --scroll-padding: 24px;
  }

  .site-header { display: none; }
  .mobile-header { display: flex; }

  .content-area { padding: 0 12px 40px; margin-top: 20px; }
  .scroll-with-sidebar { flex-direction: column; align-items: center; }
  .blog-sidebar, .toc-sidebar { display: none; }
  .scroll-container { width: 100%; }
  .scroll-curl-top, .scroll-curl-bottom { height: 36px; }

  .post-entry-inner { flex-direction: column; }

  .post-thumbnail-wrap,
  .illuminated-initial {
    width: 110px !important;
    height: 110px !important;
    float: left;
    margin: 0 14px 8px 0;
  }

  .post-thumbnail-wrap img { width: 110px !important; height: 110px !important; }
  .illuminated-initial span { font-size: 56px; }
  .entry-title { font-size: 20px; }
  .entry-content { font-size: 16px; }

  .about-photo-wrap { width: 150px; height: 150px; }
  .about-photo-wrap img, .about-photo-placeholder { width: 150px; height: 150px; }
}
