/* ===== Fonts ===== */
@font-face {
  font-family: "Apple Gothic";
  src: url("../fonts/applegothic.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Win95";
  src: url("../fonts/W95FA.woff2") format("woff2");
  font-display: swap;
}

/* ===== Theme variables ===== */
.theme-light {
  --bg: #ffffff;
  --text: #000000;
  --content-bg: #ffffff;
  --content-text: #000000;
  --border: #000000;
  --btn-bg: #000000;
  --btn-text: #ffffff;
  --hover-bg: #000000;
  --hover-text: #ffffff;
  --font: "Apple Gothic", sans-serif;
}
.theme-dark {
  --bg: #000000;
  --text: #ffffff;
  --content-bg: #000000;
  --content-text: #ffffff;
  --border: #ffffff;
  --btn-bg: #ffffff;
  --btn-text: #000000;
  --hover-bg: #ffffff;
  --hover-text: #000000;
  --font: "Apple Gothic", sans-serif;
}
.theme-win95 {
  --bg: #008080;
  --text: #c0c0c0;
  --content-bg: #c0c0c0;
  --content-text: #000000;
  --border: #000000;
  --btn-bg: #c0c0c0;
  --btn-text: #000000;
  --hover-bg: #000080;
  --hover-text: #ffffff;
  --font: "Win95", "Courier New", monospace;
}

/* ===== Base ===== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; }

/* ===== Header ===== */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 36px 6vw 24px;
}

.site-title {
  font-family: var(--font);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}
.site-title:hover { opacity: 1; }

.site-nav {
  width: 100%;
}

/* {{navigation}} outputs <ul class="nav"> — strip list styling */
.site-nav .nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.site-nav .nav li { margin: 0; }

.site-nav .nav a {
  font-family: var(--font);
  font-size: 1.45rem;
  text-decoration: none;
  padding: 5px 12px;
  border: 2px solid transparent;
  transition: color 0.4s ease, background-color 0.3s ease;
}
.site-nav .nav a:hover {
  background-color: var(--hover-bg);
  color: var(--hover-text);
}

/* ===== Layout ===== */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 6vw 60px;
}

/* Wider post-listing boxes (≈ double the original width) */
.home-template .site-main,
.tag-template .site-main,
.author-template .site-main,
.paged .site-main {
  max-width: 1400px;
}

/* Much wider reading area on single post / page views */
.post-template .site-main,
.page-template .site-main {
  max-width: 1300px;
}

.site-intro,
.archive-header {
  margin-bottom: 40px;
  font-size: 1.4rem;
}
.archive-title { font-size: 2.4rem; margin: 0 0 8px; font-weight: normal; }
.archive-desc { opacity: 0.8; margin: 0; }

.site-footer {
  padding: 24px 6vw 40px;
  font-size: 0.95rem;
  opacity: 0.7;
  text-align: right;
}

/* ===== Post feed / cards ===== */
.post-feed {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.post-card-link {
  display: block;
  text-decoration: none;
  border: 2px solid var(--border);
  padding: 24px;
  background-color: var(--content-bg);
  color: var(--content-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card-link:hover {
  box-shadow: 6px 6px 0 var(--border);
  transform: translate(-2px, -2px);
}
.post-card-title { font-size: 1.9rem; margin: 8px 0 10px; font-weight: normal; }
.post-card-excerpt { margin: 0 0 14px; opacity: 0.85; }

/* ===== Meta / tags ===== */
.post-meta {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-tag {
  display: inline-block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 2px solid currentColor;
  padding: 2px 8px;
  text-decoration: none;
  margin-right: 6px;
}

/* ===== Single post ===== */
.post-header { margin-bottom: 28px; }
.post-title { font-size: clamp(2rem, 5vw, 3.2rem); margin: 10px 0 14px; font-weight: normal; line-height: 1.1; }
.post-image { margin: 0 0 32px; }
.post-image img { width: 100%; height: auto; display: block; border: 2px solid var(--border); }

.post-content {
  --post-pad: 36px;
  background-color: var(--content-bg);
  color: var(--content-text);
  border: 2px solid var(--border);
  padding: var(--post-pad);
  font-size: 1.05rem;
}
.post-content h2, .post-content h3, .post-content h4 { font-weight: normal; line-height: 1.2; }
.post-content h2 { font-size: 1.8rem; margin-top: 1.6em; }
.post-content h3 { font-size: 1.4rem; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
.post-content img { max-width: 100%; height: auto; border: 2px solid var(--content-text); }
.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1.2em;
  border-left: 4px solid var(--content-text);
  font-style: italic;
  opacity: 0.9;
}
.post-content pre {
  background-color: var(--text);
  color: var(--bg);
  padding: 18px;
  overflow-x: auto;
  border: 2px solid var(--border);
  font-family: "Win95", "Courier New", monospace;
}
.post-content code {
  font-family: "Win95", "Courier New", monospace;
  font-size: 0.95em;
}
.post-content :not(pre) > code {
  border: 1px solid var(--content-text);
  padding: 1px 5px;
}
.post-content hr { border: none; border-top: 2px solid var(--content-text); margin: 2em 0; }
.post-content figure { margin: 1.5em 0; }
.post-content figcaption { font-size: 0.85rem; opacity: 0.7; text-align: center; margin-top: 8px; }

/* Koenig editor cards */
.post-content .kg-card { margin-top: 1.5em; margin-bottom: 1.5em; }

.post-content .kg-width-wide,
.post-content .kg-width-full {
  margin-left: calc(var(--post-pad) * -1);
  margin-right: calc(var(--post-pad) * -1);
}
.post-content .kg-width-wide img,
.post-content .kg-width-full img {
  width: 100%;
  border: none;
}
.post-content .kg-width-full {
  margin-left: calc(var(--post-pad) * -1 - 2px);
  margin-right: calc(var(--post-pad) * -1 - 2px);
}

.post-footer { margin-top: 28px; }
.post-footer .post-tag { margin-bottom: 6px; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  font-size: 1.1rem;
}
.page-number { opacity: 0.7; }
.pagination-links {
  display: flex;
  gap: 10px;
}
.pagination a {
  text-decoration: none;
  border: 2px solid var(--border);
  padding: 8px 16px;
  transition: background-color 0.3s ease, color 0.4s ease;
}
.pagination a:hover { background-color: var(--hover-bg); color: var(--hover-text); }

/* ===== Theme toggle button (fixed bottom-left, fades in on hover) ===== */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 50;
  font-family: var(--font);
  font-size: 1.1rem;
  padding: 8px 16px;
  text-decoration: none;
  background-color: var(--btn-bg);
  color: var(--btn-text) !important;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.3s ease, color 0.4s ease;
}
.theme-toggle:hover {
  opacity: 1;
  background-color: var(--hover-bg);
  color: var(--hover-text) !important;
}

/* Touch devices have no hover — keep the toggle visible there */
@media (hover: none) {
  .theme-toggle { opacity: 1; }
}

/* ===== Win 95 specifics: beveled chrome ===== */
.theme-win95 .theme-toggle,
.theme-win95 .pagination a {
  border-top: 2px solid #dfdfdf;
  border-left: 2px solid #dfdfdf;
  border-right: 2px solid #7f7f7f;
  border-bottom: 2px solid #7f7f7f;
}
.theme-win95 .theme-toggle:active,
.theme-win95 .pagination a:active {
  border-top: 2px solid #7f7f7f;
  border-left: 2px solid #7f7f7f;
  border-right: 2px solid #dfdfdf;
  border-bottom: 2px solid #dfdfdf;
}
.theme-win95 .post-card-link,
.theme-win95 .post-content {
  border-top: 2px solid #dfdfdf;
  border-left: 2px solid #dfdfdf;
  border-right: 2px solid #7f7f7f;
  border-bottom: 2px solid #7f7f7f;
}
.theme-win95 .post-card-link:hover {
  box-shadow: none;
  transform: none;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .site-header { padding-top: 28px; }
  .post-content { --post-pad: 22px; }
  .site-nav a { font-size: 1.2rem; }
}
