/* Base CSS Reset and Standardized Foundation */
/* =========================================== */

/* CSS Variables for colors, fonts, sizes */
:root {
  --bs-body-font-family: "EB Garamond", serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --bs-font-monospace: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.6;
  --bs-body-color: #222;
  --bs-body-bg: #fff;
  
  --bs-primary-rgb: 26, 93, 163;
  --bs-primary: rgb(var(--bs-primary-rgb));
  --bs-primary-bg: #1a5da3;
  --bs-secondary: #6c757d;
  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: #145293;
  --bs-highlight-bg: #f0e6dc;

  --bs-border-width: 1px;
  --bs-border-style: solid;
  --bs-border-color: #ccc;

  --bs-heading-font-weight: 700;
  --bs-heading-color: #272b37;
}

/* Box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Body and base typography */
body {
  margin: 0;
  font-family: var(--bs-body-font-family);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  letter-spacing: 0.02em;
}

/* Clear default margins, improve readability */
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure {
  margin: 0 0 1rem 0;
  padding: 0;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--bs-heading-font-weight);
  color: var(--bs-heading-color);
  line-height: 1.2;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2.25rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1rem;
}

h6 {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Responsive font sizing */
@media (min-width: 768px) {
  h1 { font-size: 4rem; }
  h2 { font-size: 3rem; }
  h3 { font-size: 2rem; }
  h4 { font-size: 1.5rem; }
}

/* Paragraphs */
p {
  margin-bottom: 1rem;
}

/* Links */
a {
  color: var(--bs-link-color);
  text-decoration: underline;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--bs-link-hover-color);
  outline: none;
  text-decoration: none;
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li + li {
  margin-top: 0.25rem;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
}

th, td {
  border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
  padding: 0.5rem 1rem;
  text-align: left;
}

/* Blockquotes */
blockquote {
  margin: 0 0 1rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--bs-primary-bg);
  color: #555;
  font-style: italic;
  background-color: #f9f9f9;
}

/* Code & pre */
code, pre {
  font-family: var(--bs-font-monospace);
}

pre {
  background-color: #f8f8f8;
  padding: 1rem;
  overflow-x: auto;
}

/* Form Elements */
input,
button,
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
  padding: 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background-clip: padding-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input:focus,
button:focus,
textarea:focus,
select:focus {
  border-color: var(--bs-primary-bg);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

button {
  cursor: pointer;
  background-color: var(--bs-primary-bg);
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
}

button:hover,
button:focus {
  background-color: #145293;
}

/* Remove search clear button on IE/Safari */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* Utility classes for spacing */
/* These mirror your base.css spacing utilities for convenience */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

/* Flex utilities */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.justify-content-center { justify-content: center !important; }
.align-items-center { align-items: center !important; }

/* Text utilities */
.text-center { text-align: center !important; }
.text-primary { color: var(--bs-primary) !important; }
.text-muted { color: #6c757d !important; }
.fw-bold { font-weight: 700 !important; }
.fst-italic { font-style: italic !important; }

/* Font sizes */
.fs-1 { font-size: 2.5rem !important; }
.fs-2 { font-size: 2rem !important; }
.fs-3 { font-size: 1.75rem !important; }
.fs-4 { font-size: 1.5rem !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }

/* Helpers for visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Shadow Utilities */
.shadow { box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1) !important; }
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; }
.shadow-none { box-shadow: none !important; }

/* Responsive utilities */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  /* Other responsive rules as needed */
}

/* Accessibility utilities */
.focus-outline:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* Remove unwanted browser appearance */
input,
button,
select,
textarea {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* Special override or base style for textfields */
input[type="text"], input[type="search"], input[type="url"], input[type="tel"], input[type="email"], input[type="password"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  color: var(--bs-body-color);
}

/* Scrollbar customization for WebKit */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 6px;
}

/* Forms */
fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

/* Buttons */
button:focus:not(:focus-visible) {
  outline: none;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Reset autofill style for better visual consistency */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bs-body-bg) inset !important;
  -webkit-text-fill-color: var(--bs-body-color) !important;
}

/* End of base.css */