html {
  box-sizing: border-box;
  font-size: 16px;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

ol,
ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

address,
table {
  margin-bottom: 1em;
  margin-left: 1em;
}

td {
  padding: 0.2em 0.5em 0.2em 0;
}

/* Shared Styles */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-family, Roboto, Helvetica, sans-serif);
  font-weight: var(--font-weight, 500);
  background-color: var(--body-bg);
}

.header-wrapper,
.container-wrapper,
.footer-wrapper {
  width: 100%;
}

.header-wrapper,
.footer-wrapper {
  background-color: var(--wrapper-bg);
}

.container-wrapper {
  background-color: var(--wrapper-bg);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.container,
header,
footer {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 1em;
}

/* Content */

.container {
  color: var(--container-text);
  background-color: var(--container-bg);
  flex-grow: 1;
  position: relative;
}

.content {
  width: 100%;
}

body.page-layout-full-width .container,
body.page-layout-full-width header,
body.page-layout-full-width footer {
  max-width: 1400px;
}

body.page-layout-full-width .content {
  max-width: none;
}

body.page-layout-full-width .container {
  padding: 1.5em 2.5em;
}

body.has-no-sidebar header button.sidebar-toggle {
  display: none;
}

.content-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

html.sidebar-is-open .content-overlay,
.content-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.content h1 {
  text-align: center;
}

.content h1,
.content h2,
.content h3,
.content p {
  margin-bottom: 0.75em;
}

.content ul {
  margin-left: 1em;
  margin-bottom: 1.5em;
}

.content li {
  margin-bottom: 0.5em;
}

.content a {
  text-decoration: none;
  color: var(--container-text);
}

.content a:hover {
  text-decoration: underline;
  cursor: pointer;
}

.content > :last-child {
  margin-bottom: 3em;
}

/* Header & Footer */

header,
footer {
  background-color: var(--header-footer-bg);
  color: var(--header-footer-text);
}

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

header .sidebar-toggle {
  grid-column: 1;
  justify-self: start;
}

.header-link a {
  color: var(--header-footer-text);
  text-decoration: none;
  cursor: pointer;
}

header .header-link {
  grid-column: 2;
  justify-self: center;
}

header .search-toggle {
  grid-column: 3;
  justify-self: end;
}

header button {
  background-color: transparent;
  border: none;
  padding: 0.3em;
  cursor: pointer;
  transition: opacity 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
}

header button:hover {
  background-color: var(--button-hover-bg);
}

header button svg {
  stroke: var(--header-footer-text);
  stroke-width: 1;
  stroke-linecap: round;
}

header button.search-toggle svg {
  stroke-width: 2.2; /* Adjusted line thickness for 24x24 viewBox */
}

/* Footer */

footer {
  text-align: center;
}

footer ul {
  margin-bottom: 1em;
}

footer .nav li {
  display: inline;
}

footer .nav li + li {
  margin-left: 1em;
}

footer .nav a {
  color: var(--header-footer-text);
  text-decoration: none;
  cursor: pointer;
}

footer .nav a:hover {
  text-decoration: underline;
}

.content-panel {
  padding: 1em 2em;
  border-radius: var(--border-radius-panel, 5px);
  margin-bottom: 1.5em;
}

.code {
  background-color: black;
  color: white;
  letter-spacing: 1px;
}

.comment {
  color: limegreen;
}

.output {
  background-color: white;
  color: blue;
}

.output h1 {
  margin-bottom: 0;
}

/* Side Bar */
:root {
  --sidebar-width: 16.25rem;
}

.side-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-width, 260px);
  max-width: 85%;
  z-index: 100;
  background-color: var(--sidebar-bg);
  padding: 1em 1.5em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

html.sidebar-is-open .side-bar,
.side-bar.is-open {
  opacity: 1;
  visibility: visible;
}

.side-nav {
  background-color: var(--sidebar-bg);
}

.side-bar button {
  background-color: var(--container-bg);
  border: none;
  border-radius: var(--border-radius-button, 0.25em);
  padding: 0.25em 0.5em;
  margin-bottom: 0.75em;
}

.side-bar button:hover {
  background-color: var(--header-footer-bg);
  color: var(--header-footer-text);
}

.side-bar li {
  margin-bottom: 0.125em;
}

.side-bar a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 1.2rem;
}

.side-bar a:hover {
  text-decoration: underline;
  cursor: pointer;
}

.copyright-notice {
  margin-top: 1em;
}

/* Card & Grid Utilities */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5em;
  margin: 1.5em 0;
}

.card-item {
  background-color: var(--container-bg);
  border: var(--card-border, 1px solid rgba(28, 34, 46, 0.15));
  border-radius: var(--border-radius-card, 6px);
  padding: 1.5em;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-item > *:last-child {
  margin-top: auto; /* Push any action elements/links to the bottom of the card */
}

.card-item h3 {
  margin-bottom: 0.5em;
  color: var(--container-text);
}

.card-item p {
  margin-bottom: 1em;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--container-text);
}

.card-item .card-btn {
  display: inline-block;
  margin-top: 1em;
  padding: 0.6em 1.2em;
  background-color: var(--header-footer-bg);
  color: var(--header-footer-text) !important;
  border-radius: var(--border-radius-button, 4px);
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
}

.card-item .card-btn:hover {
  background-color: var(--button-hover-bg);
  text-decoration: none;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .container,
  header,
  footer {
    padding: 1em 0.5em;
  }

  .content {
    padding: 0.5em;
  }

  .content h1 {
    font-size: 1.5rem;
  }
}
