/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */
/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */

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

html, body {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
  background-color: #cccccc; /* dark gray */
  scroll-behavior: smooth;
  overscroll-behavior: auto;
}

/*
 * A better looking default horizontal rule
 */

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

:root {
  --content-bg: #3a3d6c;   /* light neutral */
}

/* ==========================================================================
   Custom Layout for Plectra Test Page
   ========================================================================== */

.banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 11vh;
  z-index: 1000;
  background-image:
          linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,.5) 90%, rgba(0,0,0,1) 100%),
          url('../img/polsterworks-banner.png?v=pw6');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
}

.banner-title { /* Positioning and styling for the H1 title */
  position: absolute;
  top: 5px; /* Your desired offset from the bottom */
  right: 95px; /* Your desired offset from the right */

  display: inline-block;
  background-color: rgba(0, 0, 0, 0.0); /* Semi-transparent black */
  color: white;
  padding: 0.3em 0.5em;
  font-size: 1.7rem; /* Default font size for larger screens */
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  border-radius: 2px;
}

.banner-style-div { /* For H1, H2, etc titles. Not related to page banner. */
  max-width: 96%;
  margin: 12px auto 12px;        /* top + bottom margin restored */
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.90);
}

body.dev .footer-prod {
  display: none;
}

body.prod .footer-dev {
  display: none;
}

.body-wrapper {
  display: flex;
  justify-content: center;
}

/* Custom styles for Bootstrap's btn-primary */
.btn-primary {
  background-color: #27253f; /* Your desired base color */
  border-color: #064775;     /* Match base color */
}

.btn-primary:hover {
  background-color: #0c2739; /* A slightly darker shade of your color on hover */
  border-color: #0c2739;     /* Match darker shade for border */
}

.btn-primary:focus,
.btn-primary.focus {
  box-shadow: 0 0 0 0.25rem rgba(6, 71, 117, 0.5); /* Use your primary color's rgba for the glow */
}

.btn-primary:active,
.btn-primary.active {
  background-color: #064775; /* Revert to base color on active if you like, or slightly darker */
  border-color: #064775;
}

/* ========== DEV GUIDE LAYOUT ========== */
/* 0) No page-wide horizontal scroll */
html, body { overflow-x: hidden; }

/* 1) The center column is a flex column; it doesn't scroll itself */
.content-area {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
  max-width: 640px;
  margin: 0 auto;
  background-color: black;
  padding: 1px 12px 16px;
  min-height: 630px;
  overflow: hidden; /* key: inner sections own scrolling */
}

/* 2) Dev Guide section participates in flex sizing */
#devguide-section {
  display: flex;
  flex: 1 1 auto;   /* take available height */
  min-height: 0;    /* allow inner scroll */
  position: relative;
  z-index: 2;
}

/* 3) Wrapper keeps the panel centered and flexible */
.devguide-wrapper {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

/* 4) Panel owns the scrolling; single consolidated block */
.devguide-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto; /* the only scroller */
  scrollbar-gutter: stable both-edges;

  /* width + side padding tuned to use more track */
  width: min(980px, calc(100% - 16px));
  margin: 0 auto;
  padding: 8px; /* tighter */

  /* visuals */
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  box-sizing: border-box;
  contain: layout paint;
}

/* Title chip above the panel */
.devguide-title {
  max-width: 96%;
  margin: 0 auto 8px;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: rgba(255,255,255,0.9);
}

/* 5) Markdown inside the panel — tighter and smaller type */
.devguide-panel .markdown-body {
  margin: 0;
  padding: 0;             /* use panel padding instead */
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;

  font-size: 0.9rem;
  line-height: 1.5;
}

.devguide-panel .markdown-body h1 { font-size: 1.7rem; }
.devguide-panel .markdown-body h2 { font-size: 1.35rem; }
.devguide-panel .markdown-body h3 { font-size: 1.15rem; }

.devguide-panel .markdown-body pre,
.devguide-panel .markdown-body code,
.devguide-panel .markdown-body pre code {
  font-size: 0.9em;
  line-height: 1.35;
}

.devguide-panel .markdown-body ul,
.devguide-panel .markdown-body ol { margin-left: 1.15rem; }

.devguide-panel .markdown-body pre {
  white-space: pre-wrap;
  overflow: auto;
  max-width: 100%;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0,0,0,.025);
}

.devguide-panel .markdown-body table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
}

.devguide-panel .markdown-body img,
.devguide-panel .markdown-body svg,
.devguide-panel .markdown-body .mermaid {
  max-width: 100%;
  height: auto;
}

.devguide-panel .markdown-body > :last-child { margin-bottom: 0; }

/* Right column should never overlay the panel */
.right-column { position: relative; z-index: 1; }

/* Make the panel fill the content column */
.devguide-panel {
  width: 100% !important;      /* fill the .content-area column */
  margin: 0 !important;
  padding: 0 !important;       /* let inner content own the padding */
  border-radius: 12px;
  overflow: auto;              /* keep inner scrolling */
}

/* Remove GitHub-style width cap + center padding */
#devguide-section .devguide-panel .markdown-body {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 12px !important;  /* small, even side padding */
  box-sizing: border-box;
}

/* Keep code blocks/tables from pushing wider than the panel */
#devguide-section .devguide-panel .markdown-body pre,
#devguide-section .devguide-panel .markdown-body table {
  max-width: 100%;
  overflow: auto;
  margin-left: 0;
  margin-right: 0;
}

.devguide-title {
  max-width: 96%;                  /* don’t let it span the full column */
  margin: 0 auto 7px;              /* center it horizontally, add bottom space */
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 14px;
  padding-right: 5px;
  border: 1px solid #ccc;          /* keep */
  border-radius: 8px;              /* keep */
  background-color: rgba(255, 255, 255, 0.90);
}

/* Make the downloads wrapper a flex column that can shrink within content-area */
.downloads-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;   /* take available height, but don’t force page to grow */
  min-height: 0;    /* allow inner scrolling if needed */
  background-color: var(--content-bg, #3a3d6c);

  /* fade from white to transparent; the bg-color shows through below */
  background-image: linear-gradient(
          to top,
          rgba(255, 255, 255, 1) 0%,
          rgba(255, 255, 255, 0) 170px
  );

  grid-row: 1;

}

/* Let the grid area consume the flexible space */
.downloads-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* Footer inside downloads-wrapper */
.downloads-wrapper .footer-legal {
  margin-top: auto;        /* stick to bottom of flex column */
  text-align: center;
  font-size: 0.7rem;
  grid-row: auto;          /* remove hard-coded grid placement */
}

/* Normalize action button heights across all OS cards */
.downloads-wrapper .os-card .actions > .btn,
.downloads-wrapper .os-card .actions > a.btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  white-space: normal;     /* allow wrapping */
  line-height: 1.2;
  height: 64px !important; /* force consistency */
  min-height: 64px !important;
  padding: .5rem .75rem;
}

/* Only stretch cards in the downloads grid */
.downloads-wrapper .row { align-items: stretch; }
.downloads-wrapper .row > [class*="col-"] { display: flex; }

.fixed-layout {
  display: flex;
  width: 100%;
  max-width: 1200px;   /* feel free to tweak (1100–1300) */
  margin: 0 auto;      /* center the three columns */
}

.flex-spacer {
  flex-grow: 1;
}

.footer-legal {
  font-size: 0.7rem;
  text-align: center;
  grid-row: 3;
  margin-top: 0;
}

.main-body {
  margin: 0 auto;
  margin-top: 10.5vh;                /* matches banner */
  min-height: calc(100vh - 10.5vh);  /* fill the viewport below banner */
  background-color: transparent;
  display: flex;
  padding: 0.6rem;
  width: 100%;
}

.navigation-sidebar {
  width: 220px;
  flex-shrink: 0;
  background-color: #d27464;
  margin-right: 3px;
  margin-left: 3px;
  border-right: 1px solid #ddd;
  padding: 0;
}

.navigation-sidebar .list-group {
  margin-top: 9px;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.navigation-sidebar .list-group-item {
  display: flex;
  align-items: center; /* vertically center content */
  justify-content: center; /* optional: horizontally center if needed */
  padding-top: 0.8rem;
  padding-bottom: 0.5rem;
}

/* Normalize card container and let it grow with content */
.os-card {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 560px; /* was 520 — gives room for 3-line lists */
}

/* Card body owns the internal vertical layout */
.os-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background-color: white;
}

/* Keep title tidy, optional */
.os-card .card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Lift Windows and macOS actions to the same starting height as Linux */
/* Top buttons should line up across cards */
.os-card .actions{
  display: grid !important;
  grid-template-rows: repeat(4, 64px); /* 4 rows, each 64px tall */
  gap: .5rem !important;
  margin-top: auto;                     /* keep the block at the card bottom */
}

/* Each action fills its row exactly */
.os-card .actions > .btn,
.os-card .actions > a.btn {
  height: 100% !important;              /* fill the 64px row */
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: normal;
  line-height: 1.2;
}

/* Keep the invisible spacer occupying the same space */
.os-card .actions .btn.invisible {
  visibility: hidden;           /* don’t collapse it — still occupies the 60px */
  pointer-events: none;
}

/* Normalize the space above the buttons so 'Copy Install Command' aligns */
.os-card .intro {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-height: 157px; /* adjust: 120–150px depending on your fonts/zoom */
}

/* Allow up to 3 lines without clipping; can grow if needed */
.os-card .pkg-links {
  min-height: 52px;   /* reserve space for 3 short lines */
  margin-top: 0.75rem;
  margin-bottom: .25rem;
  overflow: visible;  /* don’t hide last line */
}

.os-card .pkg-links ul { margin: 0; padding-left: 1rem; }
.os-card .pkg-links a { word-break: break-word; }

/* Optional: shrink bullets if you prefer */
.os-card .pkg-links.small li {
  font-size: 0.8rem;
}

.right-column {
  background-color: #d27464;
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 0 0.33rem;

  /* Ensure it doesn’t overlay content-area */
  position: relative;
  z-index: 1;
}

.site-logo { /* Styling for the inlined SVG logo */
  width: 80px;
  height: auto;
  position: absolute;
  top: 10px;
  right: 18px;
  z-index: 2;
  fill: white;
  stroke: white;
  color: white; /* For currentColor SVGs */
}

.vertical-spacer {
  height: 217px; /* Adjust as needed */
}

.vertical-spacer-tiny {
  height: 53px; /* Adjust as needed */
}

/* ==========================================================================
   Responsive adjustments for smaller screens (e.g., mobile)
   THIS SHOULD BE THE ONLY @media (max-width: 768px) BLOCK
   ========================================================================== */
@media (min-width: 1280px) {
  .devguide-panel { width: min(1080px, calc(100% - 24px)); }
}

/* ==========================================================================
   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;
}

/* ==========================================================================
   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 (min-width: 1280px) {
  .content-area { max-width: 720px; } /* was 640px */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* --- overflow guards for the Developer's Guide --- */
html, body { overflow-x: hidden; overflow-x: clip; }      /* no page-wide sideways scroll */

#developers-guide, .markdown-body, .md-content {          /* your MD container(s) */
  max-width: 100%;
  overflow-x: auto;                                       /* local scroll if a line is truly huge */
}

pre, code { white-space: pre-wrap; }                      /* wrap long code lines */
table { display: block; width: 100%; overflow-x: auto; }
img, video { max-width: 100%; height: auto; }

/* if the center column sits in a grid/flex, allow it to shrink (prevents blowout) */
.main-content, .content-center, .center-col { min-width: 0; min-height: 0; }
