/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #005a9c;
  --secondary-color: #0077cc;
  --text-color: #333;
  --light-gray: #f5f5f5;
  --border-color: #ddd;
  --code-bg: #f8f8f8;
  --link-color: #0066cc;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  font-size: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1 {
  line-height: 1.3;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  overflow: hidden;
}

/* Header */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex: 0 0 auto;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header strong {
  font-size: 1.5rem;
  font-weight: 600;
}

header strong a {
  color: white;
  text-decoration: none;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 2rem;
  font-weight: 500;
}

header nav a:hover {
  text-decoration: underline;
}

/* Main Content */
main {
  margin: 2rem auto;
  padding-bottom: 4rem;
  flex: 1 0 auto;
}

.hero {
  text-align: center;
  padding: 3rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
}

/* Sections */
section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
  position: relative;
  scroll-margin-top: 80px; /* Offset for fixed headers if any */
}

/* Anchor links for headings */
.anchor-link {
  opacity: 0;
  margin-left: 0.5rem;
  font-size: 0.8em;
  color: var(--link-color);
  text-decoration: none;
  font-weight: normal;
  transition: opacity 0.2s ease;
}

h3:hover .anchor-link {
  opacity: 1;
}

.anchor-link:hover {
  text-decoration: none;
  color: var(--secondary-color);
}

h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
  color: var(--text-color);
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Items Grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.item-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: block;
  text-decoration: none;
  color: inherit;
}

.item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
  text-decoration: none;
}

.item-card h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.item-card p {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Property Tables */
.property-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.property-table th,
.property-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.property-table th {
  background-color: var(--light-gray);
  font-weight: 600;
  color: var(--text-color);
}

.property-table tr:hover {
  background-color: #fafafa;
}

.property-name {
  font-family: "Courier New", Courier, monospace;
  color: var(--secondary-color);
  font-weight: 600;
}

.property-type {
  font-family: "Courier New", Courier, monospace;
  color: #666;
  font-size: 0.9rem;
}

/* Required column cells */
.required-col,
.optional-col,
.conditional-col {
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  width: 80px;
}

.required-col {
  color: #2e7d32;
}

.optional-col {
  color: #757575;
}

.conditional-col {
  color: #f57c00;
}

/* Property badges for h3 section headers only */
h3 .property-required {
  display: inline-block;
  padding: 2px 8px;
  background-color: #d32f2f;
  color: white;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
}

h3 .property-optional {
  display: inline-block;
  padding: 2px 8px;
  background-color: #757575;
  color: white;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
}

/* Code Blocks */
pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9rem;
}

/* Breadcrumb */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.9rem;
  color: #666;
}

.breadcrumb a {
  color: var(--link-color);
}

/* Constraints Section */
.constraints {
  background-color: var(--light-gray);
  border-left: 4px solid var(--secondary-color);
  padding: 1rem;
  margin: 1rem 0;
}

.constraints h4 {
  margin-top: 0;
}

.constraints ul {
  margin-left: 1.5rem;
}

/* Examples */
.example {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem 0;
}

.example h4 {
  margin-top: 0;
}

/* Footer */
footer {
  flex: 0 0 auto;
  background-color: var(--light-gray);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
}

footer p {
  margin-bottom: 0.5rem;
  color: #666;
}

/* Responsive */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    text-align: center;
  }

  header nav {
    margin-top: 1rem;
  }

  header nav a {
    margin: 0 1rem;
  }

  .items-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* Nested Objects */
.nested-property {
  margin-left: 2rem;
  border-left: 2px solid var(--border-color);
  padding-left: 1rem;
  margin-top: 1rem;
}

/* Reference Links */
.reference-link {
  font-family: "Courier New", Courier, monospace;
  background-color: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9rem;
}

/* Schema.org-style responsive tables for small screens */
@media only screen and (max-width: 900px) {
  h1 {
    font-size: 1.6em;
    margin-bottom: 0.5em;
  }

  .nested-property {
    margin-left: 0;
  }

  .constraints code {
    overflow-wrap: break-word;
  }

  /* Convert table to stacked layout like schema.org */
  .property-table {
    display: table;
    border: none;
  }

  .property-table thead {
    display: none; /* Hide table headers on mobile */
  }

  .property-table tbody {
    display: block;
  }

  .property-table tr {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    background: white;
  }

  .property-table th,
  .property-table td {
    display: block;
    text-align: left;
    border: none;
    padding: 0.5rem 0;
  }

  /* Add labels before each cell */
  .property-table td:before {
    content: attr(data-label);
    font-weight: 700;
    display: inline-block;
    margin-right: 0.5rem;
  }

  .property-table br {
    display: none;
  }

  .property-table td small {
    display: block;
  }

  /* Make the required column more visible */
  .required-col,
  .optional-col,
  .conditional-col {
    text-align: left;
    display: inline;
  }
}
