/*
Theme Name: Commodore Retro
Description: Modern rebuild of the Commodore 64 responsive theme. Features CSS Grid layout, CRT scanlines, and authentic PETSCII aesthetics.
Author: Antigravity
Version:2 2.8.0.8.0
License: GNU General Public License v2.0 or later
Text Domain: commodore
*/

/* --- Commodore 64 Palette --- */
:root {
  --c64-black: #000000;
  --c64-white: #FFFFFF;
  --c64-border: #A6A1FF;
  --c64-bg: #4342E6;
  --c64-text: #A6A1FF;
}

@font-face {
  font-family: 'c64';
  src: url('petscii-commodore.ttf') format('truetype');
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: var(--c64-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--c64-border);
  border: 4px solid var(--c64-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c64-white);
}

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

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--c64-border);
  font-family: 'c64', 'Courier New', monospace;
  color: var(--c64-text);
  line-height: 1.5;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  /* Monitor view is fixed */
}

/* Customizer Fix: Restore scrolling and flow for the editor */
body.is-customizer-preview,
body.wp-customizer,
body.admin-bar {
  display: block;
  overflow: auto;
  height: auto;
}

/* --- CRT Effects --- */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 1000;
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
}

.crt-flicker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 1001;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% {
    opacity: 0.27861;
  }

  100% {
    opacity: 0.12349;
  }
}

/* --- Container (The Monitor) --- */
#container {
  background-color: var(--c64-bg);
  width: 90vw;
  height: 90vh;
  padding: 40px;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  position: relative;
  border: 10px solid var(--c64-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Customizer Fix: Adaptive container */
body.is-customizer-preview #container,
body.wp-customizer #container {
  width: 100%;
  height: auto;
  min-height: 100vh;
  margin: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

@media (max-width: 600px) {
  #container {
    width: 100vw;
    height: 100vh;
    padding: 20px;
    border-width: 5px;
  }
}

.header-home {
  text-align: center;
  margin-bottom: 40px;
  width: 100%;
}

.header-home h1 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  margin: 0;
  color: var(--c64-text);
  word-wrap: break-word;
}

.header-home h1 a {
  text-decoration: none;
  color: inherit;
}

.header-home h1 a:hover {
  background: var(--c64-white);
  color: var(--c64-black);
}

.header-home h2 {
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  margin-top: 10px;
  font-weight: normal;
}

/* --- Navigation --- */
nav {
  margin: 20px 0;
  text-align: center;
  width: 100%;
}

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
}

nav a {
  color: var(--c64-text);
  text-decoration: none;
  text-transform: uppercase;
}

nav a:hover {
  background: var(--c64-white);
  color: var(--c64-black);
}

/* --- Content Wrapper --- */
#wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 100%;
}

.content {
  width: 100%;
}

.content article {
  margin-bottom: 60px;
  text-align: center;
  width: 100%;
}

article h2 {
  font-size: clamp(1.2rem, 4vw, 2rem);
  margin-bottom: 15px;
}

article h2 a {
  text-decoration: none;
  color: inherit;
}

article h2 a:hover {
  background: var(--c64-white);
  color: var(--c64-black);
}

.index-date {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 0;
}

/* --- Terminal Search --- */
#terminal {
  background: var(--c64-bg);
  border: 4px solid var(--c64-border);
  padding: 15px;
  display: inline-block;
  margin: 20px auto;
  min-width: 300px;
  max-width: 100%;
}

#cursor {
  display: inline-block;
  width: 15px;
  height: 20px;
  background: var(--c64-text);
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

#s {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}

/* --- Footer --- */
.site-footer {
  margin-top: 60px;
  padding: 40px 20px;
  border-top: 4px dashed var(--c64-border);
  width: 100%;
  font-size: 0.8rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  text-align: left;
  max-width: 800px;
  margin: 0 auto;
}

.footer-col h4 {
  color: var(--c64-white);
  margin-bottom: 15px;
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col a {
  color: var(--c64-text);
  text-decoration: none;
  text-transform: uppercase;
}

.footer-col a:hover {
  background: var(--c64-white);
  color: var(--c64-black);
}

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

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

img {
  max-width: 100%;
  height: auto;
  border: 4px solid var(--c64-border);
}