/* Responsive improvements for rudiment template */

/* Pattern display improvements */
.pattern {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 18px;
  justify-content: flex-start;
  align-items: center;
}

.stroke {
  min-width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid #242424;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: 'Oxanium', sans-serif;
  font-weight: 800;
  font-size: 18px;
  transition: transform 0.15s, border-color 0.15s;
}

.stroke:hover {
  transform: scale(1.05);
}

.stroke.r {
  color: #DFFF4A;
  background: #12150A;
  border-color: #2E3A12;
}

.stroke.l {
  color: #9A988F;
  background: #0E0E0E;
}

.sep {
  width: 18px;
  height: 2px;
  background: #2A2A2A;
  border-radius: 1px;
  margin: 0 4px;
}

/* Tags responsive */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
  align-items: center;
}

.tags span {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9A988F;
  border: 1px solid #2A2A2A;
  border-radius: 20px;
  padding: 8px 15px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 400;
}

/* Details/Summary collapsible sections */
details {
  border-top: 1px solid #1A1A1A;
  padding: 64px 0;
}

details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary h2 {
  display: inline-block;
  transition: color 0.2s;
}

details summary:hover h2 {
  color: #DFFF4A;
}

details[open] summary {
  margin-bottom: 16px;
}

/* Cards grid responsive - vertical layout */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: #1E1E1E;
  border: 1px solid #1E1E1E;
  border-radius: 14px;
  overflow: hidden;
}

.cards article {
  background: #0E0E0E;
  padding: 28px 24px;
  transition: background 0.25s;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.cards article:hover {
  background: #131313;
}

.cards h3 {
  margin: 0 0 12px;
  color: #F2F1EC;
}

.cards p {
  margin: 0;
  flex-grow: 1;
  font-size: 15px;
  color: #C7C5BD;
  line-height: 1.7;
  font-weight: 300;
}

/* Table responsive improvements */
.table-wrapper {
  overflow-x: auto;
  margin: 0 -8px 16px;
  padding: 0 8px;
}

table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  background: #0E0E0E;
  border: 1px solid #242424;
  border-radius: 14px;
  overflow: hidden;
}

thead {
  background: #0A0A0A;
}

th, td {
  border-bottom: 1px solid #1A1A1A;
  padding: 15px 22px;
  text-align: left;
  vertical-align: top;
}

th {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9A988F;
  font-weight: 400;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(223, 255, 74, 0.02);
}

/* Related rudiments grid - vertical layout */
.linkgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: #1E1E1E;
  border: 1px solid #1E1E1E;
  border-radius: 14px;
  overflow: hidden;
}

.linkgrid a {
  background: #0E0E0E;
  padding: 24px 20px;
  transition: background 0.25s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 70px;
}

.linkgrid a:hover {
  background: #131313;
}

.linkgrid span {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9A988F;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 400;
}

/* CTA card responsive */
.cta-card {
  border: 1px solid #2E3A12;
  background: linear-gradient(135deg, #0E0E0E 0%, #0A0A0A 100%);
  border-radius: 14px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.cta-card > div {
  flex: 1;
}

.cta-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #DFFF4A;
  margin: 0 0 12px !important;
  font-weight: 400;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Oxanium', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  background: #DFFF4A;
  color: #0A0A0A;
  padding: 15px 26px;
  border-radius: 9px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(223, 255, 74, 0.3);
}

/* Summary box */
.es-summary {
  background: linear-gradient(135deg, #0C0C0C 0%, #0A0A0A 100%);
  padding: 34px 30px;
  border-radius: 14px;
  border: 1px solid #1E1E1E;
  margin-top: 0;
}

.es-summary h2 {
  font-size: clamp(24px, 3vw, 36px);
  margin: 0 0 16px;
}

.es-summary p {
  margin: 0;
  line-height: 1.7;
  font-size: 16px;
  color: #C7C5BD;
  font-weight: 300;
}

/* Loading states */
[data-loading-text]:empty::after {
  content: attr(data-loading-text);
  color: #5A5852;
  font-style: italic;
}

/* Mobile optimizations - Tablet and small desktop */
@media (max-width: 980px) {
  .hero {
    padding: 54px 0 48px !important;
  }

  section {
    padding: 54px 0 !important;
  }

  .pattern {
    gap: 6px;
    margin: 24px 0 12px;
  }

  .stroke {
    min-width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .sep {
    width: 14px;
    margin: 0 2px;
  }

  .cards article {
    padding: 24px 20px;
    min-height: auto;
  }

  .linkgrid a {
    padding: 20px 18px;
  }

  table {
    min-width: 450px;
  }

  th, td {
    padding: 12px 16px;
    font-size: 14px;
  }

  .cta-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 26px;
    gap: 18px;
  }

  .btn {
    width: 100%;
    padding: 16px 24px;
  }

  .es-summary {
    padding: 28px 24px;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 44px 0 40px !important;
  }

  section {
    padding: 44px 0 !important;
  }

  .breadcrumb {
    padding-top: 30px !important;
  }

  .pattern {
    gap: 5px;
    margin: 20px 0 8px;
    justify-content: center;
  }

  .stroke {
    min-width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .sep {
    width: 12px;
  }

  .tags {
    gap: 8px;
    margin: 0 0 24px;
    justify-content: center;
  }

  .tags span {
    font-size: 9px;
    padding: 6px 12px;
  }

  .cards article {
    padding: 20px;
  }

  .linkgrid a {
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  table {
    min-width: 100%;
    font-size: 13px;
  }

  th, td {
    padding: 10px 12px;
    font-size: 13px;
  }

  th {
    font-size: 10px;
  }

  .cta-card {
    padding: 22px;
  }

  .cta-label {
    font-size: 10px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 13px;
  }

  .es-summary {
    padding: 24px 20px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .hero {
    padding: 36px 0 32px !important;
  }

  section {
    padding: 36px 0 !important;
  }

  .breadcrumb {
    padding-top: 24px !important;
  }

  .pattern {
    gap: 4px;
  }

  .stroke {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .sep {
    width: 10px;
  }

  .tags {
    justify-content: flex-start;
  }

  .cards article {
    padding: 18px;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 10px;
  }

  .cta-card {
    padding: 20px;
  }

  .es-summary {
    padding: 20px 18px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .stroke {
    border-width: 2px;
  }

  .stroke.r {
    border-color: #DFFF4A;
  }

  .stroke.l {
    border-color: #9A988F;
  }

  .btn {
    border: 2px solid #0A0A0A;
  }
}

/* Extra small devices and short screens */
@media (max-width: 420px) {
  .hero {
    padding: 32px 0 28px !important;
  }

  section {
    padding: 32px 0 !important;
  }

  .breadcrumb {
    padding-top: 20px !important;
    gap: 6px;
    font-size: 9px;
  }

  .eyebrow {
    font-size: 10px;
    margin: 0 0 12px;
  }

  h1 {
    font-size: clamp(32px, 9vw, 38px) !important;
    margin: 0 0 20px !important;
  }

  h2 {
    font-size: clamp(26px, 8vw, 36px) !important;
    margin: 0 0 14px !important;
  }

  h3 {
    font-size: clamp(20px, 7vw, 28px) !important;
    margin: 0 0 10px !important;
  }

  .lead {
    font-size: 15px;
    margin: 0 0 20px;
  }

  .pattern {
    gap: 3px;
    margin: 16px 0 6px;
  }

  .stroke {
    min-width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .sep {
    width: 8px;
  }

  .tags {
    gap: 6px;
    margin: 0 0 20px;
  }

  .tags span {
    font-size: 8px;
    padding: 5px 10px;
  }

  .cards article {
    padding: 16px;
  }

  .cards h3 {
    font-size: 18px;
    margin: 0 0 8px;
  }

  .cards p {
    font-size: 13px;
  }

  table {
    font-size: 11px;
  }

  th, td {
    padding: 6px 8px;
    font-size: 11px;
  }

  th {
    font-size: 9px;
  }

  .cta-card {
    padding: 18px;
    gap: 14px;
  }

  .btn {
    padding: 12px 18px;
    font-size: 12px;
  }

  .es-summary {
    padding: 18px 16px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .stroke,
  .btn,
  .cards article,
  .linkgrid a {
    transition: none;
  }

  .stroke:hover,
  .btn:hover {
    transform: none;
  }
}

/* Combined responsiveness - Small devices with short screens */
@media (max-width: 720px) and (max-height: 800px) {
  .hero {
    padding: 40px 0 34px !important;
  }

  section {
    padding: 40px 0 !important;
  }

  .breadcrumb {
    padding-top: 26px !important;
  }

  h1 {
    margin: 0 0 18px !important;
  }

  h2 {
    margin: 0 0 12px !important;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .hero {
    padding: 34px 0 28px !important;
  }

  section {
    padding: 34px 0 !important;
  }

  .breadcrumb {
    padding-top: 22px !important;
    font-size: 9px;
  }

  h1 {
    font-size: clamp(30px, 8.5vw, 36px) !important;
    margin: 0 0 16px !important;
  }

  h2 {
    font-size: clamp(24px, 7.5vw, 32px) !important;
    margin: 0 0 10px !important;
  }

  .pattern {
    margin: 16px 0 6px;
  }
}

@media (max-width: 720px) and (max-height: 600px) {
  .hero {
    padding: 28px 0 22px !important;
  }

  section {
    padding: 28px 0 !important;
  }

  .breadcrumb {
    padding-top: 18px !important;
  }

  h1 {
    font-size: clamp(28px, 8vw, 32px) !important;
    margin: 0 0 14px !important;
  }

  h2 {
    font-size: clamp(22px, 7vw, 28px) !important;
    margin: 0 0 8px !important;
  }

  h3 {
    font-size: clamp(18px, 6vw, 24px) !important;
    margin: 0 0 6px !important;
  }

  .pattern {
    margin: 14px 0 4px;
  }

  .cards article {
    padding: 16px;
  }

  .cta-card {
    padding: 18px;
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  .hero {
    padding: 24px 0 20px !important;
  }

  section {
    padding: 24px 0 !important;
  }

  .breadcrumb {
    padding-top: 16px !important;
  }

  h1 {
    font-size: clamp(26px, 7.5vw, 30px) !important;
    margin: 0 0 12px !important;
  }

  h2 {
    font-size: clamp(20px, 6.5vw, 26px) !important;
    margin: 0 0 8px !important;
  }

  h3 {
    font-size: clamp(16px, 5.5vw, 20px) !important;
    margin: 0 0 6px !important;
  }

  .eyebrow {
    font-size: 9px;
    margin: 0 0 10px;
  }

  .lead {
    font-size: 13px;
    margin: 0 0 14px;
  }

  .pattern {
    margin: 12px 0 4px;
    gap: 3px;
  }

  .stroke {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .tags {
    margin: 0 0 16px;
  }

  .cards article {
    padding: 14px;
  }

  .cta-card {
    padding: 16px;
  }

  .es-summary {
    padding: 16px 14px;
  }
}

/* Vertical responsiveness - Short screens */
@media (max-height: 800px) {
  .hero {
    padding: 48px 0 42px !important;
  }

  section {
    padding: 48px 0 !important;
  }

  .breadcrumb {
    padding-top: 32px !important;
  }

  h1 {
    margin: 0 0 20px !important;
  }

  h2 {
    margin: 0 0 14px !important;
  }

  .pattern {
    margin: 22px 0 10px;
  }
}

@media (max-height: 700px) {
  .hero {
    padding: 42px 0 36px !important;
  }

  section {
    padding: 42px 0 !important;
  }

  .breadcrumb {
    padding-top: 28px !important;
  }

  h1 {
    font-size: clamp(38px, 6vw, 68px) !important;
    margin: 0 0 18px !important;
  }

  h2 {
    font-size: clamp(26px, 4vw, 46px) !important;
    margin: 0 0 12px !important;
  }

  h3 {
    margin: 0 0 10px !important;
  }

  .pattern {
    margin: 20px 0 8px;
  }

  .cards article {
    padding: 22px 20px;
  }
}

@media (max-height: 600px) {
  .hero {
    padding: 36px 0 30px !important;
  }

  section {
    padding: 36px 0 !important;
  }

  .breadcrumb {
    padding-top: 24px !important;
  }

  h1 {
    font-size: clamp(34px, 5.5vw, 58px) !important;
    margin: 0 0 16px !important;
  }

  h2 {
    font-size: clamp(24px, 3.8vw, 42px) !important;
    margin: 0 0 10px !important;
  }

  h3 {
    font-size: clamp(20px, 3vw, 28px) !important;
    margin: 0 0 8px !important;
  }

  .lead {
    margin: 0 0 18px;
  }

  .pattern {
    margin: 18px 0 6px;
  }

  .cards article {
    padding: 20px 18px;
  }

  .cta-card {
    padding: 22px 20px;
  }

  .es-summary {
    padding: 26px 22px;
  }
}

@media (max-height: 500px) {
  .hero {
    padding: 28px 0 24px !important;
  }

  section {
    padding: 28px 0 !important;
  }

  .breadcrumb {
    padding-top: 18px !important;
  }

  h1 {
    font-size: clamp(30px, 5vw, 48px) !important;
    margin: 0 0 14px !important;
  }

  h2 {
    font-size: clamp(22px, 3.5vw, 36px) !important;
    margin: 0 0 8px !important;
  }

  h3 {
    font-size: clamp(18px, 2.8vw, 24px) !important;
    margin: 0 0 6px !important;
  }

  .eyebrow {
    margin: 0 0 10px;
  }

  .lead {
    font-size: 14px;
    margin: 0 0 16px;
  }

  .pattern {
    margin: 14px 0 4px;
  }

  .tags {
    margin: 0 0 18px;
  }

  .cards article {
    padding: 18px 16px;
  }

  .cta-card {
    padding: 20px 18px;
  }

  .es-summary {
    padding: 22px 18px;
  }
}

/* Print styles */
@media print {
  .topnav,
  .lang-switch,
  .cta-card,
  footer {
    display: none;
  }

  .pattern,
  .cards,
  .linkgrid {
    break-inside: avoid;
  }

  body {
    padding-top: 0;
    background: white;
    color: black;
  }
}
