/* ============================================================
   RACHONAUT ACCESSIBLE GUESTBOOK (AUTO-THEME)
   ============================================================ */

/* ---------------- 1. Dark Mode (Default) ---------------- */
:root {
  --background-color: #1D1F20;
  --text-color:       #C8C9C8;
  --heading-color:    #A9A8B2;
  --link-color:       #2BBD88;
  --link-hover:       #6ED4AA;
  --card-bg:          rgba(255, 255, 255, 0.03);
  --card-border:      rgba(255, 255, 255, 0.12);
  --muted-color:      #9a9a9a;
  --focus-ring:       #E0BC8A;
}

/* ---------------- 2. Automatic Light Mode (OS Preference) ---------------- */
@media (prefers-color-scheme: light) {
  :root {
    --background-color: #F0F0EE;
    --text-color:       #1E1D18;
    --heading-color:    #A67C2E;
    --link-color:       #1A6B4A;
    --link-hover:       #1A7A5A;
    --card-bg:          rgba(0, 0, 0, 0.04);
    --card-border:      rgba(0, 0, 0, 0.15);
    --muted-color:      #666666;
    --focus-ring:       #8B5E1A;
  }
}

/* ---------------- 3. Global Styles & Typography ---------------- */
body {
  background-color: var(--background-color) !important;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-size: 0.955rem;
  font-weight: 300;
  color: var(--text-color);
  line-height: 1.8;
  margin: 0;
  padding: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container, 
main {
  background-color: var(--background-color) !important;
  max-width: 68ch;
  margin: 0 auto;
}

h1, h2, h3, h4 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 200;
  letter-spacing: 0.3rem;
  color: var(--heading-color) !important;
}

h1 {
  font-size: 1.8em;
  margin-bottom: 0.8em;
}

/* ---------------- 4. Accessible Links & Focus States ---------------- */
a {
  color: var(--link-color) !important;
  text-decoration-line: underline;
  text-underline-offset: 0.18em;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover) !important;
}

/* Enhanced Focus Rings for Keyboard Navigation (Accessibility) */
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 3px !important;
}

/* ---------------- 5. Input Fields ---------------- */
input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.955rem;
  color: var(--text-color) !important;
  background-color: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
  border-color: var(--link-color) !important;
  outline: none;
}

::placeholder {
  color: var(--muted-color);
  opacity: 0.85;
}

/* ---------------- 6. Submit Button ---------------- */
input[type="submit"],
button[type="submit"] {
  background: var(--link-color) !important;
  color: var(--background-color) !important;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.05rem;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

input[type="submit"]:hover,
button[type="submit"]:hover {
  opacity: 0.9;
}

/* ---------------- 7. Messages Section & Cards ---------------- */
#guestbooks___guestbook-made-with {
  text-align: right;
  color: var(--muted-color);
  font-size: 0.85em;
  margin-top: 10px;
}

#guestbooks___guestbook-messages-container > div {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  color: var(--text-color);
}

hr {
  border: 0;
  border-top: 1px solid var(--muted-color);
  opacity: 0.3;
  margin: 2em 0;
}

/* ============================================================
   RETURN TO BLOG BACK-LINK
   ============================================================ */

/* Creates space above the main heading for the back-link */
h1 {
  margin-top: 1.5em !important;
  position: relative;
}

/* Injects the "← Back to Blog" link right above the main title */
h1::before {
  content: "↙ Back to rachonaut.com";
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: lowercase;
  color: var(--link-color);
  margin-bottom: 0.8em;
  cursor: pointer;
}

/* Makes the injected pseudo-element act like a real clickable link */
h1::before {
  /* Using a subtle underline to match your blog's main link aesthetic */
  text-decoration: underline;
  text-underline-offset: 0.18em;
  transition: color 0.2s ease;
}

h1::before:hover {
  color: var(--link-hover);
}

h1 {
  cursor: pointer;
}