/* Shared auxiliary stylesheet for ZIP Extractor aux pages
   (help, faq, privacy, terms, support, install, opensource).
   index.html uses styles-main.css instead. */

/* Design tokens - the handful of values that recur across rules.
   Purpose-specific one-off colors (kbd chrome, section dividers, etc.)
   stay inline at their point of use. */
:root {
  /* Aux pages are designed light-only; opt out of browser auto-dark
     heuristics (Firefox's auto, Chrome's force-dark for unprepared sites).
     Full dark-mode support is a separate project. */
  color-scheme: light;
  --color-text-muted: #5f6368;
  --color-link-hover: #1967d2;
  --color-border: rgba(0, 0, 0, 0.12);
  --color-shadow: rgba(0, 0, 0, 0.1);
}

/* Roboto font faces (local) */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'),
       url('../fonts/roboto-v20-all-regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  src: local('Roboto Medium'), local('Roboto-Medium'),
       url('../fonts/roboto-v20-all-500.woff2') format('woff2');
  font-display: swap;
}

/* Global document behavior. The window itself must NOT scroll - that would drag
   the top header with it. Instead, #mainScrollableContent is the sole scroller,
   via the flex chain: body -> #centeredBodyContent -> #mainWrapper -> #appContent
   -> #mainApp -> #mainScrollableContent. Mirrors the pattern in styles-main.css
   (index.html) so the aux pages behave identically. */
html, body {
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  line-height: 150%;
  font-weight: 400;
  background-color: #f9f9f9;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Keep the window itself non-scrollable. */
  overflow: hidden;
  overflow: clip; /* modern browsers: blocks programmatic scroll; falls back to hidden. */
}

/* Body is a flex column: the header is the top row, everything else fills below. */
body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Keyboard focus affordance (a11y). Mouse clicks don't trigger this;
   only keyboard nav does, via :focus-visible. */
:focus-visible {
  outline: 2px solid var(--color-link-hover);
  outline-offset: 2px;
}

/* Page layout - flex chain from body down to #mainScrollableContent, the sole
   scroll area. Each step carries flex: 1 1 auto + min-height: 0 (or 0 min-width
   for horizontal flex rows) so inner scrollers can shrink instead of pushing
   the window past 100vh. Mirrors the styles-main.css chain used by index.html. */
#centeredBodyContent {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}
#mainWrapper {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
}
#appContent {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  margin-top: 12px;
  margin-left: 16px;
  margin-right: 16px;
  min-height: 0;
  min-width: 0;
}
@media (max-width: 639px) {
  #appContent { margin-left: 0; margin-right: 0; margin-top: 6px; }
}
/* #mainApp now carries the card (class="cardShadow" in HTML): white surface,
   rounded top corners via .cardShadow, overflow: hidden to clip the inner
   scrollbar below the rounded top edge, padding-top: 12px to offset the
   scrollbar start so it doesn't bump the corner radius. Mirrors index.html's
   #mainScrollableContentContainer. */
#mainApp {
  background-color: #fff;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 328px;
  overflow: hidden;
  padding-top: 12px;
}

/* The sole scroll area on aux pages. scroll-behavior: smooth lives here (not
   on html) because the window itself is non-scrollable. */
#mainScrollableContent {
  flex: 1 1 auto;
  font-size: 16px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  scroll-behavior: smooth;
}
/* Respect OS-level Reduce Motion preference (vestibular a11y). */
@media (prefers-reduced-motion: reduce) {
  #mainScrollableContent { scroll-behavior: auto; }
}

/* Matches styles-main.css's .cardShadow so the shared class renders
   consistently between the main app and aux pages. */
.cardShadow {
  border: 1px solid var(--color-border);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-sizing: border-box;
}
@media (max-width: 639px) { .cardShadow { border-color: transparent; } }

/* Top header. Lives outside the scroll area as a non-growing flex row of body,
   so it stays fixed while only #mainScrollableContent scrolls underneath.
   No position: sticky needed - the window doesn't scroll, so there's nothing
   to stick to. */
#header {
  flex: 0 0 auto;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  cursor: default;
  padding-bottom: 6px;
  background-color: #fff;
  padding-left: 14px;
  padding-right: 10px;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px var(--color-shadow), 0 0 6px var(--color-shadow);
}
@media (max-width: 639px) {
  #header { height: 40px; min-height: 40px; max-height: 40px; padding-left: 10px; padding-right: 4px; }
}

#headerInfo {
  display: flex;
  margin-right: 8px;
  padding-top: 8px;
}
@media (max-width: 639px) { #headerInfo { padding-top: 5px; } }

#headerSubInfo {
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  padding-right: 12px;
}

#headerIconImg { height: 40px; width: 40px; }
@media (max-width: 639px) { #headerIconImg { height: 36px; width: 36px; } }

#mainAppTitle {
  font-size: 26px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0;
  white-space: nowrap;
  padding-left: 14px;
  padding-right: 20px;
}
@media (max-width: 639px) { #mainAppTitle { font-size: 24px; } }

#mainAppSubTitle {
  padding: 0;
  margin: 0;
  cursor: default;
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: normal;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 639px) { #mainAppSubTitle { font-size: 16px; } }

/* Anchor-jump landing: small visual gap above the target so it doesn't
   touch the top edge of #mainScrollableContent. The top header lives
   outside the scroll area now, so there's nothing to "clear" - this is
   purely breathing room. Applied to <section> so native browser hash-scroll
   (e.g. faq.html and opensource.html TOC clicks) honors the gap.
   help.html's JS scroll handler uses the same 12px constant; keep in sync. */
:target,
#mainScrollableContent section { scroll-margin-top: 12px; }

/* Typography */
/* Break long tokens (e.g. a long topic id rendered as a heading) at
   character boundaries if they don't fit - protects narrow viewports. */
h1, h2, h3 { overflow-wrap: break-word; }
h1 {
  padding: 0;
  margin: 0 0 8px 0;
  cursor: default;
  font-size: 28px;
  color: var(--color-text-muted);
  line-height: normal;
  font-weight: 500;
}
@media (max-width: 639px) { h1 { font-size: 24px; } }

h2 {
  padding: 2px 0 0 0;
  margin: 0 0 8px 0;
  line-height: normal;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 24px;
}
@media (max-width: 639px) { h2 { font-size: 22px; } }

h3 {
  padding: 0;
  margin: 12px 0 6px 0;
  line-height: normal;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 20px;
}

p {
  font-size: 16px;
  margin: 0 0 16px;
  padding: 0;
  line-height: 150%;
  letter-spacing: 0;
}
p.lastPara { margin-bottom: 0; }

li {
  font-size: 16px;
  line-height: 150%;
}

/* Keyboard key presentation (used on faq.html for keyboard shortcuts). */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 90%;
  line-height: 1;
  color: #333;
  vertical-align: middle;
  background-color: #f3f3f3;
  border: 1px solid #ccc;
  border-bottom: 2px solid #bbb;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Content chrome (back-to-app link, TOC, section separators, in-content links,
   back-to-top link). */
.backToApp {
  margin-bottom: 16px;
  font-size: 16px;
}

/* Table of contents (help.html, faq.html, opensource.html). */
nav.toc { margin: 8px 0 16px 0; }
nav.toc ul { margin: 0; padding-left: 18px; }
nav.toc li { margin: 4px 0; }

/* Section breathing room: thin separator between consecutive topic sections,
   no-op on pages without <section> blocks. */
#mainScrollableContent section + section {
  border-top: 1px solid #eee;
  padding-top: 8px;
  margin-top: 24px;
}

/* Content-area link hover (scoped to the scrollable content so header, footer,
   and other app chrome retain their own affordances). Subtle color shift on
   hover; plain state inherits the default browser/link color. */
#mainScrollableContent a { transition: color 0.15s ease; }
#mainScrollableContent a:hover { color: var(--color-link-hover); }

/* Back-to-top link, right-aligned at the end of each topic section
   (help.html, faq.html). */
.back-to-top-wrap {
  text-align: right;
  margin-top: 12px;
}
.back-to-top {
  font-size: 14px;
  color: var(--color-text-muted);
  text-decoration: none;
}
.back-to-top:hover { color: var(--color-link-hover); text-decoration: underline; }

/* Footer */
#footer {
  margin: 24px 16px;
  padding-top: 18px;
  border-top: 1px solid #ccc;
  color: var(--color-text-muted);
}
#about { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
#copyright { font-size: 14px; }
#applinks { font-size: 14px; }
#applinks a { text-decoration: none; }

/* Utility classes */
.mediumBold { font-weight: 500; }
.hideOnMobileOrDisplayBlock { display: block; }
@media (max-width: 639px) { .hideOnMobileOrDisplayBlock { display: none !important; } }
