/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Page Header Styles */
.page-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 1rem 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.page-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #666;
  margin: 0;
  max-width: 800px;
  margin: 0 auto;
}

/* Tab Group Styles */
.tab-container {
  max-width: 1200px;
  margin: 0 auto 2rem auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tab-header {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  background-color: #f8f9fa;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
}

.tab-button:hover {
  background-color: #e9ecef;
  color: #333;
}

.tab-button.active {
  color: #007bff;
  border-bottom-color: #007bff;
  background-color: #fff;
}

.tab-content {
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-top: none;
}

.tab-panel {
  display: none;
  padding: 2rem;
  min-height: 300px;
}

.tab-panel.active {
  display: block;
}

.tab-panel h2 {
  margin-top: 0;
  color: #333;
  font-size: 1.5rem;
}

.tab-panel p {
  color: #666;
  line-height: 1.6;
}

/* DX Code Grid Styles */
.dx-code-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0;
  width: 480px;
  margin: 2rem auto;
  border: 1px solid #999;
  opacity: 0;
}

.dx-code-grid.loaded {
  opacity: 1;
}

/* Canister Slot Message Styles */
.canister-slot-message {
  position: relative;
  text-align: center;
  margin: 1.5rem auto;
  width: 480px;
}

.slot-line {
  border: none;
  height: 2px;
  background-color: #999;
  margin: 0;
}

.slot-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 0 1rem;
  color: #666;
  font-size: 14px;
  font-style: italic;
}

.grid-element {
  width: 80px;
  height: 80px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.grid-element:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.grid-element[data-state="white"] {
  background-color: silver;
  color: black;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.grid-element[data-state="black"] {
  background-color: black;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Disable hover effects for G elements (non-clickable) */
.grid-element:nth-child(1),
.grid-element:nth-child(7) {
  cursor: default;
  opacity: 0.7;
}

.grid-element:nth-child(1):hover,
.grid-element:nth-child(7):hover {
  transform: none;
  box-shadow: none;
}

/* Focus styles for accessibility */
.grid-element:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
  transform: scale(1.05);
}

.grid-element:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .grid-element[data-state="white"] {
    background-color: #ffffff;
    border: 2px solid #000000;
  }
  
  .grid-element[data-state="black"] {
    background-color: #000000;
    border: 2px solid #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .grid-element {
    transition: none;
  }
  
  .grid-element:hover {
    transform: none;
  }
  
  .tab-button {
    transition: none;
  }
}

/* DX Info Table Styles */
.dx-info-table {
  width: 480px;
  margin: 2rem auto 0;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fff;
  border: 1px solid #e0e0e0;
}

.dx-info-table th,
.dx-info-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.dx-info-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.dx-info-table td {
  color: #666;
}

.dx-info-table tbody tr:last-child td {
  border-bottom: none;
}

/* DX Number Input Styles */
.dx-number-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 2rem 0;
}

.dx-digit-input {
  width: 60px;
  height: 60px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fff;
  transition: border-color 0.2s ease;
}

.dx-digit-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.dx-digit-input:hover {
  border-color: #999;
}

/* DX Number Results Table Styles */
.dx-number-results {
  width: 480px;
  margin: 2rem auto 0;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fff;
  border: 1px solid #e0e0e0;
}

.dx-number-results th,
.dx-number-results td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.dx-number-results th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.dx-number-results td {
  color: #666;
  font-weight: bold;
}

.dx-number-results tbody tr:last-child td {
  border-bottom: none;
}

/* DX Warning Styles */
.dx-warning {
  width: 480px;
  margin: 1rem auto;
  padding: 16px;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.warning-content {
  color: #856404;
  font-size: 14px;
  line-height: 1.5;
}

.warning-content strong {
  color: #664d03;
  font-weight: 600;
}

.warning-content small {
  color: #6c757d;
  font-size: 12px;
  display: block;
  margin-top: 8px;
}

/* Barcode Container Styles */
.barcode-container {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  padding: 1rem;
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

#dx-number-barcode {
  border: 1px solid #ccc;
  background-color: white;
}

/* DX Film Grid Styles */
.dx-film-grid {
  display: grid;
  grid-template-columns: repeat(31, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  max-width: 1000px;
  margin: 2rem auto;
  border: 1px solid #999;
  padding: 10px;
}

.bit-element {
  width: 25px;
  height: 40px;
  border: 1px solid #666;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  font-family: monospace;
  transition: all 0.2s ease;
}

.bit-element[data-bit="0"] {
  background-color: white;
  color: black;
}

.bit-element[data-bit="1"] {
  background-color: black;
  color: white;
}

.bit-element:not(.clickable-bit) {
  opacity: 0.6;
}

.clickable-bit {
  cursor: pointer;
}

.clickable-bit:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Focus styles for clickable bits */
.clickable-bit:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
  transform: scale(1.1);
}

.clickable-bit:focus:not(:focus-visible) {
  outline: none;
}

/* DX Film Results Table Styles */
.dx-film-results {
  width: 1000px;
  margin: 2rem auto 0;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fff;
  border: 1px solid #e0e0e0;
}

.dx-film-results th,
.dx-film-results td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.dx-film-results th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.dx-film-results td {
  color: #666;
  font-weight: bold;
}

.dx-film-results tbody tr:last-child td {
  border-bottom: none;
}

/* DX Film Controls Styles */
.dx-film-controls {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.clear-bits-button {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clear-bits-button:hover {
  background-color: #c82333;
}

.clear-bits-button:active {
  transform: translateY(1px);
}

/* Site Footer Styles */
.site-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  margin-top: 3rem;
  padding: 2rem 0;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-disclaimer {
  text-align: center;
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.footer-disclaimer strong {
  color: #333;
}

.footer-disclaimer a {
  color: #007bff;
  text-decoration: none;
}

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

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {

  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}