/* ========================================
   Root Variables
======================================== */
:root {
  --primary: #0d6efd;
  --primary-dark: #084298;
  --accent: #ffc107;
  --accent-dark: #e0a800;
  --gray: #6c757d;
  --mid-gray: #adb5bd;
  --light-gray: #dee2e6;
  --background: #f8f9fa;
  --white: #ffffff;
}

/* ========================================
   Global Reset & Defaults
======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  font-size: inherit;
}

html {
  font-family: Arial, sans-serif;
  font-size: clamp(14px, 1.5vw, 16px);
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background-color: var(--background);
  color: var(--gray);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Responsive font adjustments */
@media (max-width: 768px) {
  html { font-size: 93.75%; }
}
@media (max-width: 480px) {
  html { font-size: 87.5%; }
}

/* ========================================
   Headings
======================================== */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 10px;
  font-weight: bold;
  text-align: center;
  color: var(--primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; color: #212529; }
h3 { font-size: 1.75rem; color: #212529; }
h4 { font-size: 1.5rem; }
h5, h6 { font-size: 1.25rem; }

/* ========================================
   Lists
======================================== */
li {
  margin: 10px 0;
  text-align: left;
}

/* ========================================
   Links
======================================== */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Leaf links (special links) */
a.leaf {
  color: #333;
}
a.leaf:visited { color: var(--mid-gray); }
a.leaf:hover { color: var(--accent-dark); text-decoration: underline; }

/* ========================================
   Buttons
======================================== */
button,
input[type="submit"],
.godaddy-btn {
  display: inline-block;
  padding: 12px 24px;
  margin: 10px;
  border: none;
  border-radius: 4px;
  background-color: var(--accent);
  color: #212529;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s ease;
}

button:hover,
input[type="submit"]:hover,
.godaddy-btn:hover {
  background-color: var(--accent-dark);
}

button:focus,
input[type="submit"]:focus,
.godaddy-btn:focus {
  outline: 3px solid var(--accent-dark);
  outline-offset: 2px;
}

/* ========================================
   Forms
======================================== */
input[type="text"],
textarea,
select {
  width: 100%;
  max-width: 400px;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
}

/* ========================================
   Tables
======================================== */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 20px 0;
}

th, td {
  padding: 12px;
  border: 1px solid var(--light-gray);
  text-align: center;
  vertical-align: middle;
  word-wrap: break-word;
}

th {
  background-color: var(--primary);
  color: var(--white);
  font-weight: bold;
}

td {
  background-color: var(--white);
  transition: background-color 0.3s ease;
}

/* Clickable TDs */
td.rows a.leaf {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  color: #333;
  text-decoration: none;
}

td.rows a.leaf:hover {
  background-color: #f8f8f8;
  color: #000;
  cursor: pointer;
}

/* Table responsive padding */
@media (max-width: 768px) {
  th, td { padding: 8px; }
  td.rows a.leaf { padding: 8px; }
}
@media (max-width: 480px) {
  th, td { padding: 6px; }
  td.rows a.leaf { padding: 6px; }
}

/* ========================================
   Containers
======================================== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========================================
   Content Sections
======================================== */
.title {
  margin-bottom: 20px;
  font-size: 9vw;
  font-weight: bold;
  color: var(--primary);
  text-align: center;
}

.content {
  color: var(--gray);
  text-align: center;
  line-height: 1.5;
}

#bulstonpenny-subscribe,
.contenth2 {
  font-weight: 600;
  color: #333;
  text-align: center;
}

.donate {
  margin-top: 20px;
  text-align: center;
}

.node { text-align: left; }
.nodes { color: var(--primary); }

/* ========================================
   Social Bar
======================================== */
#bulstonpenny-social-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 18px;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  align-items: center;
}

#bulstonpenny-social-bar span { font-weight: 600; color: #333; }

#bulstonpenny-social-bar a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

#bulstonpenny-social-bar a:hover { 
  color: var(--primary-dark);
  transform: scale(1.2);
}

@media (max-width: 480px) {
  #bulstonpenny-social-bar a:hover { transform: scale(1.1); }
}

/* ========================================
   Navigation & Search Grids
======================================== */
.nav-list,
.search_grid {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  margin: 0;
  list-style: none;
  box-sizing: border-box;
  overflow: auto;
}

.nav-list { grid-template-columns: repeat(5, 1fr); }
.search_grid { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }

.nav-item,
.search_grid .cell {
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-item:hover,
.search_grid .cell .leaf:hover {
  background: #f0f0f0;
}

.leaf {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.4rem;
  text-align: center;
  color: #222;
  text-decoration: none;
}

/* ========================================
   Footer
======================================== */
.footer,
.footer-widgets {
  width: 100%;
  text-align: center;
  margin: 20px 0;
  font-family: sans-serif;
  color: #333;
}

.footer td {
  border: 1px solid #ddd;
  padding: 12px;
  background-color: #f8f8f8;
}

.footer td[colspan] {
  font-weight: bold;
  background-color: #f0f0f0;
}

.footer a {
  color: #333;
  font-weight: bold;
  text-decoration: none;
}
.footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-block { margin: 20px 0; }
.footer-legal,
.footer-copyright { font-size: 14px; margin: 10px 0; }

/* ========================================
   Donation Box & Ads
======================================== */
#donation-box,
.ad-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 18px;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  justify-content: center;
}

#donation-box span { font-weight: 600; color: #333; }

.ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16.2vw;
  box-sizing: border-box;
}

.ad img {
  max-width: 100%;
  max-height: 16.2vw;
  border-radius: 6px;
  cursor: pointer;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.ad img:hover { transform: scale(1.05); }

.ad-title {
  margin-top: 6px;
  font-size: 0.9em;
  color: #444;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Misc & Utility
======================================== */
.about { margin: 0 5vw; }
.search_nav { margin: 1rem 0; }