/* ==========================================================================
   DownPortal — Base, Reset & Global Utilities
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  accent-color: var(--ui-color-primary);
  color-scheme: light;
  overflow-x: clip;
}

body {
  background-color: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-base);
  font-size: 0.875rem;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--ui-color-primary);
}

:focus-visible {
  outline: 2px solid var(--ui-color-primary);
  outline-offset: 2px;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

/* Base Shell Wrapper */
.shell {
  width: 100%;
  max-width: var(--shell-width, var(--ui-shell-width));
  margin-inline: auto;
  padding-inline: clamp(20px, 3.5vw, 44px);
}

.layout-top-inset {
  padding-top: 16px;
}

/* Page Headers & General Action Bars */
.page-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--color-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-title-lg-size, 20px);
  font-weight: 800;
  color: var(--color-ink-soft);
  margin: 0;
  letter-spacing: -0.01em;
}

.page-title-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(234, 179, 8, 0.15);
  color: #854d0e;
  border: 1px solid rgba(234, 179, 8, 0.3);
  margin-left: 4px;
}

.page-title-badge.is-hidden {
  display: none;
}

.page-subtitle,
.page-desc {
  font-size: var(--type-body-sm-size, 13px);
  color: var(--color-ink-muted);
  margin: 0;
  line-height: 1.5;
}

.simplefavorite-clear-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  background: var(--ui-surface-muted, #f1f5f9);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
  cursor: pointer;
  transition: all 0.12s ease;
}

.simplefavorite-clear-button:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.4);
  color: #b91c1c;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.form-actions-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* Utility Classes */
.hidden,
.is-hidden {
  display: none !important;
}

.text-muted { color: var(--ui-text-muted); }
.text-strong { color: var(--ui-text-strong); }
.text-danger { color: var(--semantic-danger); }
.is-primary { color: var(--ui-action); font-weight: 700; }

.markdown-code {
  padding: 2px 6px;
  color: var(--ui-text-strong);
  background: var(--ui-color-surface-muted);
  border-radius: var(--ui-radius-xs);
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
}

.markdown-rule {
  margin: var(--ui-space-4) 0;
  border: 0;
  border-top: 1px solid var(--ui-border);
}

/* Lucide Vector Icons Baseline & Utility Sizes */
.lucide,
.lucide-icon,
svg.lucide {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
}

.lucide-xs {
  width: 13px !important;
  height: 13px !important;
  stroke-width: 2.2 !important;
}

.lucide-sm {
  width: 15px !important;
  height: 15px !important;
}

.lucide-md {
  width: 18px !important;
  height: 18px !important;
}

.lucide-lg {
  width: 22px !important;
  height: 22px !important;
}
