/* === CSS Variables === */
:root {
  --primary: #7e57c2;
  --primary-hover: #6a48b8;
  --color-on-primary: #fff;
  --text-main: #5a5a6d;
  --text-light: #999999;
  --text-muted: #555555;
  --bg-light: #ffffff;
  --bg-muted: #f0f0f0;
  --bg-muted-hover: #e0e0e0;
  --bg-code: #f9f9f9;
  --bg-code-inline: #eeeeee;
  --border: #ccc;
  --border-muted: #bbb;
  --border-table: #ddd;
  --table-hover-bg: #faf8ff;
  --blockquote-bar: #7e57c2;
  --background-soft: #f9f9f9;
  --background-lifted: #f0f0f0;
  --border-color: #ccc;
  --shadow-soft: 0 0 10px rgba(0, 0, 0, 0.1);
  --info-bg: #cce5ff;
  --info-text: #004085;
  --info-border: #b8daff;
  --success-bg: #d4edda;
  --success-text: #155724;
  --success-border: #c3e6cb;
  --warning-bg: #fff3cd;
  --warning-text: #856404;
  --warning-border: #ffeeba;
  --danger-bg: #f8d7da;
  --danger-text: #721c24;
  --danger-border: #f5c6cb;
}

/* Base Reset and Defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: sans-serif;
  background-color: var(--bg-light);
  color: var(--text-main);
  line-height: 1.6;
  /* padding: 1rem; removed to allow zero padding on header */
}

/* Container */
.container {
  width: 95%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* Section */
section {
  margin-bottom: 2rem;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin-bottom: 1rem;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* Lists */
ul,
ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Description Lists */
dl {
  margin-bottom: 1rem;
}

dt {
  font-weight: 600;
  margin-top: 0.5rem;
}

dd {
  margin-left: 1.5rem; /* Indent the description */
  margin-bottom: 0.5rem;
}


/* Form Base */
form {
  margin-top: 1rem;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  box-sizing: border-box;
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

/* Form - Focus Styles */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.3);
}

/* Form - Radio & Checkbox */
input[type="radio"],
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--primary);
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Form - Fieldsets & Legends */
fieldset {
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

legend {
  font-weight: bold;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--bg-muted);
  color: var(--text-light);
  cursor: not-allowed;
}

/* Buttons */
button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

button:hover,
button:focus {
  background-color: var(--primary-hover);
}

.cancel-button {
  background-color: var(--bg-muted);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.cancel-button:hover,
.cancel-button:focus {
  background-color: var(--bg-muted-hover);
  color: var(--primary-hover);
  border-color: var(--border-muted);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

thead {
  background-color: var(--primary);
  color: #fff;
}

th,
td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border: 1px solid var(--border-table);
}

tbody tr:nth-child(odd) {
  background-color: var(--bg-light);
}

tbody tr:nth-child(even) {
  background-color: var(--bg-code);
  /* background-color: var(--bg-muted); */
}

table tbody tr:hover {
  background-color: var(--table-hover-bg);
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 0.5rem;
}

/* Code Blocks */
pre {
  background-color: var(--bg-code);
  border: 1px solid var(--border-table);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1.5rem;
}

code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}

:not(pre) > code {
  background-color: var(--bg-code-inline);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
}

/* Accessibility Utility */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 2px solid var(--primary);
  margin: 2rem 0;
  width: 100%;
  opacity: 0.3;
}

/* Blockquote */
blockquote {
  font-style: italic;
  border-left: 4px solid var(--blockquote-bar);
  padding: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  background-color: var(--bg-code);
  border-radius: 0.25rem;
}

blockquote footer {
  margin-top: 0.5rem;
  font-style: normal;
  font-weight: 600;
  color: var(--primary);
}

blockquote footer cite {
  font-style: normal;
}

/* Text Decoration Utilities */
.text-center {
  text-align: center;
}

.underlined {
  text-decoration: underline;
}

.strikethrough {
  text-decoration: line-through;
}

/* Alert / Info Boxes */
.alert {
  padding: 1.1rem 1rem 1rem 1rem; /* top right bottom left */
  margin-bottom: 1.5rem;
  border: 1px solid;
  border-radius: 0.25rem;
  display: flex;
  align-items: center; /* vertical center */
}

/* Info */
.alert-info {
  background-color: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

/* Success */
.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

/* Warning */
.alert-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

/* Danger */
.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* Details & Summary */
.details-box {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 0.25rem;
  background-color: var(--bg-code);
  transition: background-color 0.3s ease;
  color: var(--text-main);
}

.details-box summary {
  
  font-weight: 500; /* or normal / 600 */
  cursor: pointer;
  list-style: none;
  outline: none;
  color: var(--primary);
}

.details-box summary::marker {
  display: none; /* removes default triangle if needed */
}

.details-box p {
  margin-top: 1rem;
  margin-bottom: 0;
}

/* Modal */
.modal {
  padding: 2rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-light);
  color: var(--text-main);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-soft);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* backdrop styling */
::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Optional: align modal text nicely */
.modal h3 {
  margin-top: 0;
}

.modal .form-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}