/*
==================================================================
 CUSTOM GUESTBOOK CSS FOR LOK.COMPUTER (v6.1)
 Inspired by are-na-blocks-canvas.pages.dev and leonw.ong styles
==================================================================
*/

/* ------------------- */
/* 1. Root Variables & Base Styles */
/* ------------------- */

/* Light Theme Variables */
:root {
  --bg-color: #f0f0f0;
  --text-color: #333;
  --block-bg: #fff;
  --block-border: #333;
  --header-bg: #f0f0f0;
  --header-border: #333;
  --button-bg: #ddd;
  --button-hover: #ccc;
  --link-color: #0077cc;
  --icon-color: #333;
}

/* Dark Theme Variables (auto-detects system preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #111;
    --text-color: #f0f0f0;
    --block-bg: #2a2a2a;
    --block-border: #555;
    --header-bg: #1a1a1a;
    --header-border: #444;
    --button-bg: #333;
    --button-hover: #444;
    --link-color: #66b3ff;
    --icon-color: #f0f0f0;
  }
}

/* Global Style Resets */
* {
  box-sizing: border-box;
}

/* Remove all rounded corners */
*, *::before, *::after {
  border-radius: 0 !important;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Consolas", "Courier New", monospace;
  /* Dotted background from reference */
  background-image: radial-gradient(circle, var(--block-border) 1px, transparent 1px);
  background-size: 20px 20px;
  margin: 0 !important;
  overflow: hidden; /* Prevent body scroll */
}

/* ------------------- */
/* 2. Layout & Fixed Elements */
/* ------------------- */

/* Main container - remove default max-width */
.container {
  max-width: 100%;
  padding: 0;
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  padding: 65px 30px; /* Top padding for header, bottom padding for new footer */
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* Make the main content area scrollable */
}

#guestbooks___guestbook-form-container, #guestbooks___guestbook-messages-container {
  max-width: 50em;
  width: 100%;
  margin: 0 auto;
}

/* Fixed Header (Title) */
h1#title {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  padding: 5px 10px;
  margin: 0;
  z-index: 100;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
  height: 35px;
}


/* Fixed Footer (Credit link) */
#guestbooks___guestbook-made-with {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--header-bg);
    border-top: 1px solid var(--header-border);
    padding: 5px 10px;
    text-align: right;
    font-size: 14px;
    height: 35px;
}

#guestbooks___guestbook-made-with small {
    color: var(--text-color);
}

hr {
  border: none;
  margin: 2em 0 1em 0 !important;
}

/* ------------------- */
/* 3. Form & Input Styling */
/* ------------------- */

/* Input fields and textarea styling */
input[type="text"],
input[type="url"],
textarea {
  background-color: var(--block-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--block-border) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  padding: 8px 10px !important;
  box-shadow: none !important;
  transition: all 0.2s ease;
  width: 100%;
}

/* input#website {
    margin-top: 1em;
} */

label {
    font-style: italic;
    opacity: 0.8;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
  border-color: var(--link-color) !important;
}

/* Placeholder text color */
::placeholder {
  color: var(--text-color) !important;
  opacity: 0.6 !important;
}

/* Submit button styling */
input[type="submit"] {
  cursor: pointer;
  padding: 0 15px;
  color: var(--text-color);
  background-color: var(--button-bg);
  border: 1px solid var(--block-border);
  font-family: inherit;
  font-size: 14px;
  user-select: none;
  transition: all 0.2s ease;
  height: 32px;
  line-height: 30px;
  text-transform: uppercase;
}

input[type="submit"]:hover {
  background-color: var(--button-hover);
}

/* ------------------- */
/* 4. Message Styling */
/* ------------------- */

#guestbooks___guestbook-messages-header {
  display: none;
}

/* Container for each message author/date */
#guestbooks___guestbook-messages-container > div > div > p {
  font-size: 1em;
  margin-bottom: 0.5em;
}

.guestbook-message.guestbook-message-reply {
    margin-left: 2em;
}

a, a:visited {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Styling for the main message block */
blockquote {
  border: 2px solid var(--block-border) !important;
  padding: 10px 15px !important;
  background-color: var(--block-bg) !important;
  color: var(--text-color) !important;
  box-shadow: 5px 5px 0px rgba(0,0,0,0.3) !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  word-wrap: break-word;
  hyphens: auto;
}

blockquote p {
  margin: 0.5rem 0;
}
blockquote p:first-child {
  margin-top: 0;
}
blockquote p:last-child {
  margin-bottom: 0;
}

/* Ensure nested blockquotes are not re-styled */
blockquote blockquote {
    border: none !important;
    border-left: 2px solid #3338 !important;
    padding: 0 0 0 0.5em !important;
    margin-left: 0.5em !important;
    box-shadow: none !important;
}

/* -------------------------- */
/* 5. Two-Column Form Layout  */
/* -------------------------- */

/* Turn the form into a grid container */
#guestbooks___guestbook-form {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Left column is 1/3, right is 2/3 */
    grid-template-rows: auto auto auto auto;
    gap: 1em;
    align-items: start;
}

/* Hide the <br> tags which interfere with grid layout */
#guestbooks___guestbook-form > br {
    display: none;
}

/* --- Place items on the grid --- */

/* Name input */
#guestbooks___guestbook-form > .guestbooks___input-container:first-of-type {
    grid-column: 1;
    grid-row: 1;
}

/* Website input */
#guestbooks___guestbook-form > .guestbooks___input-container:nth-of-type(2) {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
}

/* Security question container */
#guestbooks___guestbook-form #guestbooks___challenge-answer-container {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
}

#guestbooks___challenge-answer-container > br {
    display: none;
}
#guestbooks___challenge-answer-container .guestbooks___input-container {
    margin-top: 0;
}
#guestbooks___challenge-answer-container input {
    margin-top: 0.5em;
}

/* Message textarea container */
#guestbooks___guestbook-form > .guestbooks___input-container:has(textarea) {
    grid-column: 2;
    grid-row: 1 / span 3; /* Span all 3 rows to match height */
    height: 100%;
}

/* Make textarea fill its container */
textarea#text {
    height: 100% !important;
    min-height: 130px; /* Set a reasonable minimum height */
}

/* Submit button */
input[type="submit"] {
    grid-column: 1 / span 2; /* UPDATED: Span across both columns */
    grid-row: 4;
    width: 100%; /* UPDATED: Stretch to fill the width */
}