/* ==========================================================================
   PotBot.net — shared site styles
   Modernized: semantic HTML, responsive layout, WCAG-friendly focus states,
   native <dialog> lightbox. Shared by table/, showdown/, download/, thanks/.
   (yazin/ and help/ sections keep their own separate styles.)
   ========================================================================== */

:root {
  --color-bg: #ededed;
  --color-surface: #ffffff;
  --color-bar: #bdbdbd;
  --color-bar-dark: #444444;
  --color-text: #1a1a1a;
  --color-accent: #2f6f3e;
  --color-focus: #1a73e8;
  --max-width: 70rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background-color: var(--color-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
}

h1, h2, h3 {
  font-family: "Montserrat-Regular", sans-serif;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }

p { margin: 0 0 1rem; }

@font-face {
  font-family: "Montserrat-Regular";
  src: url("Montserrat-Regular.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "Montserrat-UltraLight";
  src: url("Montserrat-UltraLight.otf") format("opentype");
  font-display: swap;
}

/* Skip link (WCAG 2.4.1 bypass blocks) */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Page frame */
.page {
  max-width: var(--max-width);
  margin: 1rem auto;
  background: var(--color-surface);
  border: 3px ridge #000;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 2rem);
}

/* Header / nav */
.site-header {
  background-color: var(--color-bar);
  padding: 1rem 0;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.site-nav a {
  display: block;
  min-width: 11rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: #000;
  font-weight: 600;
  text-align: center;
  /* Reproduces the original button.gif gradient (light top fading to mid-gray) */
  background-image: linear-gradient(to bottom, #e4dedc 0%, #7a7a7c 100%);
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: #fff;
  /* Reproduces the original buttonactive.gif gradient (dark top fading to mid-gray) */
  background-image: linear-gradient(to bottom, #1c2224 0%, #7c8284 100%);
}

/* Visible keyboard-focus indicator everywhere (WCAG 2.4.7) */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Content */
.content {
  flex: 1;
  padding: 1.5rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: center;
}

@media (min-width: 48rem) {
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.feature-list li::before {
  content: "\25B8";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* Gallery + lightbox triggers */
.gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.gallery a { display: block; }

.gallery img {
  display: block;
  border: none;
  border-radius: var(--radius);
  /* Render at natural width/height (matches the original look); only ever
     shrink, and only as a safety net on viewports narrower than the image
     itself, so nothing overflows on very small phones. */
  max-width: 100%;
  height: auto;
}

/* External link icon (kept from the original assets) */
a.externlink {
  background: url("external.png") no-repeat center right;
  padding-right: 15px;
}

/* Footer */
.site-footer {
  background-color: var(--color-bar);
  padding: 0.75rem 1rem;
  text-align: center;
  margin-top: auto;
}

.author-link {
  text-decoration: none;
  color: #000;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.author-link::after {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background: url("mail.png") no-repeat center / contain;
}

.author-link:hover,
.author-link:focus-visible {
  color: #fff;
}

.author-link:hover::after,
.author-link:focus-visible::after {
  background-image: url("mailw.png");
}

/* Native <dialog> lightbox (replaces jQuery Lightbox2) */
.lightbox {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(92vw, 60rem);
  max-height: 90vh;
  background: transparent;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  height: auto;
}

.lightbox-caption {
  background: #fff;
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

/* Download page */
.download-group { margin-bottom: 2rem; }

.download-options {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.download-options li {
  border: 1px solid #999;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
}

.download-options a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.download-options a:hover,
.download-options a:focus-visible {
  text-decoration: underline;
}

.download-options img {
  display: block;
  height: auto;
  max-width: 100%;
}

/* Thanks page */
.credits-list {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0;
}

.credits-list li { margin-bottom: 0.5rem; }
