/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* optional, prevents horizontal scroll */
}

/* ── The dock ───────────────────────────────────────────────────────────
 * Three names, one mechanism: `shared/_dock` is the fixed wrapper, #bottom-bar
 * is the stack of full-width rows inside it (today just the music player), and
 * --dock-h is how tall that stack currently is.
 *
 * Declare each row's height *here, once*; anything else anchored to the bottom
 * derives from --dock-h instead of restating the number. See docs/patterns/ui.md.
 *
 * Defaults, overrides and the total all live on `body` deliberately. var()
 * substitutes per element, so a default on :root with the override here would
 * resolve --dock-h against :root's zero and inherit down as a constant 0 —
 * silently reserving nothing. Same element, no trap.
 *
 * The padding clears the stack for in-flow content, so footer actions (Delete /
 * Update / Back) aren't covered. On `body` rather than `main` for a second
 * reason: the admin layout's main carries a `py-6` utility, and a class
 * selector outranks a bare element one — the padding would silently lose. */
body {
  --player-h: 0rem;
  --dock-h: var(--player-h);
  padding-bottom: var(--dock-h);
}

body:has(#music-player-bar:not(.hidden)) { --player-h: 6rem; }

/* Safe-area (notch / gesture bar) support — viewport-fit=cover is set in the
 * head, so whatever touches the bottom edge must clear the home indicator
 * itself. env() resolves to 0 on devices without an inset, leaving desktop
 * untouched. `body` prefix outranks the bottom-* utility so cascade order
 * between stylesheets can't flip the result.
 *
 * The inset rides the bottom-most *visible* row, not the #bottom-bar wrapper:
 * the wrapper is 0-tall while the player is hidden, and padding on it would
 * leave an invisible full-width strip over the gesture area swallowing taps on
 * every page. A row added below the player takes the inset over and this drops
 * back to a bare 0.5rem — only one row may carry it, or the gesture bar gets
 * counted twice. (Overlays that escape the bar — the queue drawer and its
 * backdrop — are `fixed` in their own right and handle their own inset below.)
 *
 * The ID selector outranks the bar's own `py-2`, so the 0.5rem base must be
 * restated here — a bare env() would zero the bottom padding wherever the
 * inset is 0 (i.e. every desktop). */
#music-player-bar {
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

[data-music-player-target="queue"] {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Fixed elements ignore the body padding above, so they clear the stack
 * themselves. --dock-h collapses to 0 when the dock is empty, which leaves all
 * three at exactly their pre-dock resting position. */
body [data-bulk-select-target="actionBar"] {
  bottom: calc(1rem + var(--dock-h) + env(safe-area-inset-bottom));
}

/* The mobile "+" FAB: above the gesture inset, and above the dock. */
#new-fab {
  bottom: calc(1.875rem + var(--dock-h) + env(safe-area-inset-bottom));
}

/* Flash toasts, same deal — they sat at a bare bottom-4 and rendered over the
 * player whenever a track was loaded. */
body #flash-dispenser {
  bottom: calc(1rem + var(--dock-h) + env(safe-area-inset-bottom));
}

/* 16px floor on every text-entry control — anything smaller makes iOS
 * Safari auto-zoom the page on focus. The DaisyUI field classes set
 * font-size: .875rem at class specificity, which outranks the bare
 * element selectors — the floor must restate them as compound selectors
 * (input.input beats .input) or it silently loses on every
 * DaisyUI-classed field. trix-editor (contenteditable, not a textarea)
 * and the tagger's dynamically created type-less input need naming
 * explicitly. */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
input.input,
textarea.textarea,
select.select,
trix-editor,
trix-editor.textarea,
.tagger input {
  font-size: 16px;
}

/* Trix toolbar: wrap instead of clipping on narrow screens; real tap
 * targets where the pointer is a finger. */
trix-toolbar .trix-button-row {
  flex-wrap: wrap;
}

@media (pointer: coarse) {
  trix-toolbar .trix-button {
    min-height: 2.75rem;
    min-width: 2.5rem;
  }
}

/* Turbo drives View Transitions (meta[name="view-transition"] in the
 * head). Keep the cross-fade fast so navigation feels snappy rather than
 * animated, and drop it entirely for reduced-motion users. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 150ms;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* Visible keyboard focus everywhere, tokened to the theme so it holds
 * in both solarized variants. :focus-visible only — mouse clicks don't
 * get the ring. */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reduced motion: collapse every animation/transition to a single
 * frame. The View Transition rule above handles navigation; this
 * catches the rest (spinner, skeleton pulse, flash slide, queue-drawer
 * slide) without needing per-component opt-outs. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Global-search toggle: ring the search input while it's searching the whole
 * library. `outline` (not box-shadow) so it doesn't fight the input's shadow
 * utility. Paired with the highlighted pill — see filter_controller#toggleScope. */
.is-global-search {
  outline: 2px solid var(--color-warning, #b58900);
  outline-offset: 2px;
  border-radius: 9999px;
}

.github-signin-container {
  background-color: #000;
  transition: background-color 0.3s ease;
  border-radius: 6px;
  border: none;
}

.github-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 20px;
  border: 2px solid #1b1f23;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.3s ease;
  width: 100%;
}

.github-signin-btn .github-icon {
  width: 64px;
  margin-right: 8px;
}

.github-signin-btn span {
  font-family: Arial, sans-serif;
  font-size: 16px;
}

.animated-border {
    stroke: var(--color-base-content);
    stroke-dasharray: 711.5;
    stroke-dashoffset: -711.5;
    stroke-width: 3;
    transition: stroke-dashoffset 1s ease-in-out;

    transform: rotate(-270deg);
    transform-origin: 50% 50%;
    stroke-linecap: round;
}

.yin-yang-container {
  width: 100%;
  height: auto
}

.yin-yang-container:hover .animated-border {
    stroke-dashoffset: 0;
}

/* #theme-toggler */
#theme-toggler::before {
  background-color: var(--color-secondary);
}
/* #theme-toggler */

/* Comment composer
 *
 * Trix ships a full formatting toolbar. On a comment box that is most of the
 * chrome on screen before anyone has typed a word, so it stays collapsed until
 * the editor is reached for. grid-template-rows (not height/max-height) so the
 * row animates to the toolbar's real height rather than a guessed one.
 */
.comment-composer trix-toolbar {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows 0.2s ease, opacity 0.2s ease;
}

.comment-composer:focus-within trix-toolbar {
  grid-template-rows: 1fr;
  opacity: 1;
}

.comment-composer trix-toolbar .trix-button-row {
  min-height: 0;
}

.comment-composer trix-editor {
  border: 0;
  min-height: 3.5rem;
  padding: 0.5rem 0.75rem;
}

/* The toolbar stays in the tab order on purpose: :focus-within opens the
 * composer, so tabbing into a collapsed button reveals it rather than moving
 * focus somewhere invisible.
 */
@media (prefers-reduced-motion: reduce) {
  .comment-composer trix-toolbar {
    transition: none;
  }
}
