/*! 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
   ========================================================================== */

/* ============================================================
   Dark mode — "light dark" soft palette
   Page bg: #1c1f24  Surface: #252930  Elevated: #2e333c
   Border: #363c47   Text: #e3e6ea    Muted: #8b97a8
   ============================================================ */

/* Base */
html.dark {
  color-scheme: dark;
  color: #e3e6ea;
}
html.dark body {
  background-color: #1c1f24 !important;
  color: #e3e6ea !important;
}

/* White surfaces → dark surface
   (cards, nav, bottom nav, modals, match toast/sheet, row items) */
html.dark .bg-white {
  background-color: #252930 !important;
}

/* Gray-50 surfaces → slightly darker
   (page background variant, top nav) */
html.dark .bg-gray-50 {
  background-color: #1e2227 !important;
}

/* Muted surfaces (#f1f2f4, #f0f2f5)
   (tab containers, icon containers, select, secondary btn bg, chart bars) */
html.dark .bg-\[\#f1f2f4\],
html.dark .bg-\[\#f0f2f5\] {
  background-color: #2e333c !important;
}

/* Progress/chart track (#dbe0e6, #dde0e4) */
html.dark .bg-\[\#dbe0e6\],
html.dark .bg-\[\#dde0e4\] {
  background-color: #363c47 !important;
}

/* Progress fill used as background (#111418, #121417 as bg color) */
html.dark .bg-\[\#111418\],
html.dark .bg-\[\#121417\] {
  background-color: #e3e6ea !important;
}

/* Secondary button (#d2e2f3 light blue) → dark blue tint */
html.dark .bg-\[\#d2e2f3\] {
  background-color: #1a3656 !important;
}

/* Primary text (#111418, #121417) */
html.dark .text-\[\#111418\],
html.dark .text-\[\#121417\] {
  color: #e3e6ea !important;
}

/* Secondary / muted text (#60758a, #677583) */
html.dark .text-\[\#60758a\],
html.dark .text-\[\#677583\] {
  color: #8b97a8 !important;
}

/* Tailwind named text colors */
html.dark .text-gray-500 { color: #8b97a8 !important; }
html.dark .text-gray-900 { color: #e3e6ea !important; }

/* Borders */
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300 {
  border-color: #363c47 !important;
}
html.dark .border-\[\#dde0e4\],
html.dark .border-\[\#f1f2f4\] {
  border-color: #363c47 !important;
}
html.dark .border-\[\#677583\] {
  border-color: #8b97a8 !important;
}

/* Dividers between list items */
html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: #363c47 !important;
}

/* Tab switcher: active pill (has-[:checked]:bg-white → dark pill) */
html.dark .has-\[\:checked\]\:bg-white:has(:checked) {
  background-color: #363c47 !important;
}
/* Active tab text (has-[:checked]:text-[#121417] → light text) */
html.dark .has-\[\:checked\]\:text-\[\#121417\]:has(:checked) {
  color: #e3e6ea !important;
}

/* Input / textarea / select */
html.dark input[type="search"],
html.dark input[type="text"],
html.dark textarea,
html.dark select {
  background-color: #2e333c !important;
  border-color: #363c47 !important;
  color: #e3e6ea !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #8b97a8 !important;
}

/* Hover states */
html.dark .hover\:bg-gray-100:hover {
  background-color: #363c47 !important;
}

/* Toggle switch thumb: keep it visually light against dark/blue track */
html.dark .has-\[\:checked\]\:bg-\[\#3d98f4\] > div.bg-white {
  background-color: #d0d5de !important;
}

/* Match page: inline-style white backgrounds on #match-toast and #matches-sheet */
html.dark #match-toast,
html.dark #matches-sheet {
  background: #252930 !important;
}
html.dark #btn-pass,
html.dark #btn-undo {
  background-color: #252930 !important;
}

/* Settings: verified badge */
html.dark .bg-emerald-50 { background-color: #052e16 !important; }
html.dark .text-emerald-700 { color: #6ee7b7 !important; }
html.dark .text-emerald-600 { color: #34d399 !important; }

/* Settings: logout button */
html.dark .bg-red-50 { background-color: #2d0a0a !important; }
html.dark .text-red-600 { color: #f87171 !important; }
html.dark .hover\:bg-red-100:hover { background-color: #3d1515 !important; }

/* Avatar ring */
html.dark .ring-white { --tw-ring-color: #363c47 !important; }

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

/* ==========================================================================
   Desktop layout — matches settings.html exactly:
     outer: min-h-screen flex items-start justify-center py-10 px-4
     card:  w-full max-w-lg bg-white rounded-2xl shadow-sm
   Mobile layout is completely unchanged — every rule here is media-queried.
   ========================================================================== */
@media (min-width: 768px) {
  /* Same muted background as settings.html (bg-gray-50 = #f9fafb) */
  body.app-body {
    background-color: #f9fafb !important;
    min-height: 100vh;
  }
  html.dark body.app-body {
    background-color: #111318 !important;
  }

  /* Card: max-w-lg (32rem / 512px) centered with py-10 (2.5rem) top/bottom
     spacing — exactly the dimensions settings.html uses on desktop.        */
  .page-frame {
    max-width: 32rem;                       /* max-w-lg */
    margin: 2.5rem auto;                    /* py-10 equivalent */
    min-height: calc(100vh - 5rem);         /* fill viewport minus both margins */
    background: #ffffff;
    border-radius: 1rem;                    /* rounded-2xl */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
  }
  html.dark .page-frame {
    background: #1c1f24 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }

  /* Fixed bottom nav: aligns with card's left/right and bottom edges.
     max-w-lg = 32rem → half = 16rem.  Card bottom is 2.5rem from viewport
     bottom (matching margin-bottom: 2.5rem on .page-frame).               */
  .bottom-nav-fixed {
    bottom: 2.5rem !important;
    left:  max(0px, calc(50vw - 16rem)) !important;
    right: max(0px, calc(50vw - 16rem)) !important;
    border-radius: 0 0 1rem 1rem !important; /* close the card's bottom corners */
  }

  /* Bottom sheets (e.g. matches-sheet in match.html) */
  .bottom-sheet-fixed {
    left:  max(0px, calc(50vw - 16rem)) !important;
    right: max(0px, calc(50vw - 16rem)) !important;
  }

  /* FABs: keep inside the card's right edge, above the bottom nav */
  .fab-fixed {
    bottom: 8.5rem !important; /* 2.5rem card offset + ~5rem nav + 1rem gap */
    right: max(1rem, calc(50vw - 16rem + 1rem)) !important;
  }

  /* Bottom-sheet modals/panels: constrain to card width and center horizontally.
     Add `modal-sheet-outer` to the `fixed inset-0 flex items-end` wrapper and
     `modal-sheet-inner` to the `w-full rounded-t-2xl` sheet content div. */
  .modal-sheet-outer {
    justify-content: center !important;
  }
  .modal-sheet-inner {
    max-width: 32rem !important;
  }

  /* Chat panel uses flex-col, so centering is via align-items instead */
  #chat-panel {
    align-items: center !important;
  }
}

@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;
  }
}

