* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--body-text-color);
  background-color: var(--body-background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 2.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.25rem;
  opacity: 0.85;
}

h4 {
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color, inherit);
  text-decoration: none;
  transition: var(--transition, all 0.3s ease);
}

a:hover {
  color: var(--primary-hover);
}

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

/* Cards / Articles */
article {
  padding: 1.25rem 1.5rem;
  position: relative;
  border-radius: var(--radius-md, 0.5rem);
  border: 1px solid var(--card-border-color);
  background: var(--card-background-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition, all 0.3s ease);
  overflow: hidden;
}

article:hover {
  box-shadow: var(--shadow-md);
}

article.link a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

article + article {
  margin-top: 0.75rem;
}

article + h3 {
  margin-top: 1.5rem;
}

/* Status Indicators */
article.down {
  border-left: 4px solid var(--down-border-left-color) !important;
}

article.down-active {
  background: var(--down-background-color);
  border-color: var(--down-border-left-color);
}

article.degraded {
  border-left: 4px solid var(--degraded-border-left-color) !important;
}

article.up {
  border-left: 4px solid var(--up-border-left-color) !important;
}

/* Flexbox Utilities */
.f {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

section + h2 {
  margin-top: 2.5rem;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md, 0.5rem);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--tag-color);
  margin-left: 0.75rem;
}

.tag.closed,
.tag.up {
  background: var(--tag-up-background-color) !important;
}

.tag.open,
.tag.down {
  background: var(--tag-down-background-color) !important;
}

.tag.degraded {
  background: var(--tag-degraded-background-color) !important;
}

/* Definition Lists */
dl {
  margin-bottom: 1.5rem;
}

dl dt {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

dl dd {
  margin: 0 0 1rem 0;
  color: var(--text-light);
}

/* Navigation */
nav {
  border-bottom: 1px solid var(--nav-border-bottom-color);
  background: var(--nav-background-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

nav .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

nav a {
  padding: 0.5rem 0;
  font-weight: 500;
  color: var(--text-light);
  transition: var(--transition, all 0.3s ease);
}

nav a:hover {
  color: var(--body-text-color);
}

[aria-current] {
  border-bottom: 2px solid var(--nav-current-border-bottom-color);
  color: var(--body-text-color) !important;
}

/* Buttons */
.btn,
a.error-button,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md, 0.5rem);
  transition: var(--transition, all 0.3s ease);
  cursor: pointer;
  font-size: 0.95rem;
  border: none;
  outline: none;
}

a.error-button {
  background: var(--error-button-background-color);
  color: var(--error-button-color);
  border: 1px solid var(--error-button-border-color);
}

a.error-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.submit-button {
  background: var(--submit-button-background-color);
  color: var(--submit-button-color);
  border: 1px solid var(--submit-button-border-color);
}

.submit-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Change Indicator */
.changed + section .data {
  background: var(--change-background-color);
  border-radius: var(--radius-sm, 0.25rem);
  padding: 0.25rem 0.5rem;
}

/* Graphs */
article .graph {
  opacity: var(--graph-opacity);
  filter: var(--graph-filter);
  border-radius: var(--radius-sm, 0.25rem);
  overflow: hidden;
}

/* Code */
code {
  color: var(--primary-color);
  background: var(--secondary-background);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm, 0.25rem);
  font-size: 0.875em;
}

/* Responsive */
@media (max-width: 640px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  article {
    padding: 1rem 1.25rem;
  }
  
  nav .container {
    gap: 1rem;
  }
}

/* Intro Section */
.intro {
  padding: 2rem 0;
  text-align: center;
}

.intro h1 {
  margin-bottom: 0.5rem;
}

.intro p {
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 1rem;
}

/* Live Status */
.live-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius-lg, 0.75rem);
  margin-bottom: 2rem;
  font-weight: 600;
}

.live-status.up {
  background: var(--up-background-color);
  color: var(--up-border-left-color);
}

.live-status.down {
  background: var(--down-background-color);
  color: var(--down-border-left-color);
}

.live-status.degraded {
  background: var(--degraded-background-color);
  color: var(--degraded-border-left-color);
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Button Variants */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-outline {
  background-color: transparent;
  color: var(--body-text-color);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background-color: var(--secondary-background);
}

.btn-text {
  background-color: transparent;
  color: var(--body-text-color);
  padding: 0.625rem;
}

.btn-text:hover {
  color: var(--primary-color);
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
}

.btn-full {
  width: 100%;
}

/* =============================================
   STATUS CARDS - Clean Vertical Layout
   ============================================= */

/* Center the Live Status heading container */
main > .f:has(h2) {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 500px !important;
  margin: 0 auto 1rem auto !important;
}

/* Center the Live Status heading */
main h2 {
  text-align: center !important;
  width: 100% !important;
}

/* Center the time period selector */
main > .f > .f {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
  gap: 1.5rem !important;
}

/* Force the live-status section to vertical layout and center */
section.live-status,
.live-status {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  gap: 0.4rem !important;
  width: 100% !important;
  max-width: 500px !important;
  margin: 0 auto !important;
  align-items: center !important;
}

/* Target only the Live Status cards (articles with graph class) */
/* Show graph in middle with endpoint name on left and status on right */
article.graph,
article[class*="graph"] {
  background-image: none !important;
  background-color: var(--card-background-color) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.5rem 0.75rem !important;
  width: 100% !important;
  max-width: 500px !important;
  min-height: auto !important;
  height: auto !important;
  flex: 0 0 auto !important;
  gap: 0.5rem !important;
}

/* Endpoint name styling - fixed width on left, ORDER 1 */
article.graph h4,
article[class*="graph"] h4 {
  margin: 0 !important;
  font-size: 0.8rem;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: visible !important;
  text-overflow: clip !important;
  width: 120px !important;
  min-width: 120px !important;
  order: 1 !important;
}

/* Show graph in middle using ::before pseudo-element - ORDER 2 */
article.graph::before,
article[class*="graph"]::before {
  content: "";
  flex: 1 !important;
  height: 28px !important;
  background-image: var(--background) !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  opacity: 0.85;
  border-radius: 3px;
  order: 2 !important;
}

/* Hide the icon image in h4 */
article.graph h4 img.icon,
article.graph h4 img,
article[class*="graph"] h4 img {
  display: none !important;
}

/* Ensure link text is fully visible */
article.graph h4 a,
article[class*="graph"] h4 a {
  white-space: nowrap;
  overflow: visible !important;
  color: inherit !important;
}

/* Hide both divs (Overall uptime and Average response time) - high specificity */
article.graph > div,
article[class*="graph"] > div,
section.live-status article > div,
.live-status article > div {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Add status tag based on article class - ORDER 3 */
article.graph.up::after,
article[class*="graph"].up::after {
  content: "Operational";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-md, 0.3rem);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: var(--tag-up-background-color);
  color: var(--tag-color);
  flex-shrink: 0;
  order: 3 !important;
}

article.graph.down::after,
article[class*="graph"].down::after {
  content: "Down";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-md, 0.3rem);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: var(--tag-down-background-color);
  color: var(--tag-color);
  flex-shrink: 0;
  order: 3 !important;
}

article.graph.degraded::after,
article[class*="graph"].degraded::after {
  content: "Degraded";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-md, 0.3rem);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: var(--tag-degraded-background-color);
  color: var(--tag-color);
  flex-shrink: 0;
  order: 3 !important;
}

/* Hide graphs/images in status cards */
article.graph img,
article.graph canvas,
article.graph svg,
article[class*="graph"] img,
article[class*="graph"] canvas,
article[class*="graph"] svg {
  display: none !important;
}
