/* =============================================================================
   Buho — Shared Styles (Solarized Light)
   Mobile-first. No external deps. Vanilla CSS only.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   CSS Custom Properties — Solarized Light Palette
   --------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --buho-bg:       #fdf6e3;  /* base3  — main page background */
  --buho-bg-hi:    #eee8d5;  /* base2  — elevated surfaces, second bar, cards */
  --buho-bg-lo:    #93a1a1;  /* base1  — muted / disabled backgrounds */

  /* Text */
  --buho-fg:       #657b83;  /* base00 — body text */
  --buho-fg-hi:    #586e75;  /* base01 — emphasized text, headings */
  --buho-fg-lo:    #93a1a1;  /* base1  — secondary / muted text */

  /* Accent colours */
  --buho-blue:     #268bd2;  /* links, primary actions */
  --buho-cyan:     #2aa198;  /* highlights */
  --buho-green:    #859900;  /* success */
  --buho-yellow:   #b58900;  /* warning */
  --buho-orange:   #cb4b16;  /* attention */
  --buho-red:      #dc322f;  /* error */
  --buho-magenta:  #d33682;  /* special */
  --buho-violet:   #6c71c4;  /* visited links */

  /* Spacing scale (8px base) */
  --buho-space-1:  4px;
  --buho-space-2:  8px;
  --buho-space-3:  12px;
  --buho-space-4:  16px;
  --buho-space-5:  24px;
  --buho-space-6:  32px;
  --buho-space-7:  48px;

  /* Typography */
  --buho-font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --buho-font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  --buho-fs-base:  16px;
  --buho-fs-sm:    14px;
  --buho-fs-xs:    12px;
  --buho-fs-lg:    18px;
  --buho-fs-xl:    24px;
  --buho-fs-xxl:   32px;
  --buho-lh:       1.5;

  /* Layout */
  --buho-topbar-h:  48px;
  --buho-subbar-h:  36px;
  --buho-max-w:     960px;

  /* Borders & shadows */
  --buho-border:   1px solid #e6dfc8;  /* slightly darker than base2 */
  --buho-radius:   6px;
  --buho-shadow:   0 1px 4px rgba(0,0,0,0.06);
  --buho-shadow-lg: 0 4px 16px rgba(0,0,0,0.08);

  /* Transitions */
  --buho-ease:     0.2s ease;
}

/* ---------------------------------------------------------------------------
   Reset & Base
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--buho-fs-base);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--buho-font);
  font-size: var(--buho-fs-base);
  line-height: var(--buho-lh);
  color: var(--buho-fg);
  background: var(--buho-bg);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

a {
  color: var(--buho-blue);
  text-decoration: none;
  transition: color var(--buho-ease);
}
a:hover { color: var(--buho-cyan); }
a:visited { color: var(--buho-violet); }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

ul, ol { list-style: none; }

/* ---------------------------------------------------------------------------
   Top Bar — sticky, split layout
   --------------------------------------------------------------------------- */
.buho-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--buho-topbar-h);
  padding: 0 var(--buho-space-4);
  background: var(--buho-bg);
  border-bottom: var(--buho-border);
  flex-shrink: 0;
}

.buho-topbar__left {
  display: flex;
  align-items: center;
  gap: var(--buho-space-2);
}

.buho-topbar__logo {
  display: flex;
  align-items: center;
  gap: var(--buho-space-2);
  font-size: var(--buho-fs-lg);
  font-weight: 700;
  color: var(--buho-fg-hi);
  text-decoration: none;
  user-select: none;
}
.buho-topbar__logo:hover { color: var(--buho-blue); }
.buho-topbar__logo:visited { color: var(--buho-fg-hi); }

.buho-topbar__logo-owl {
  font-size: 1.3em;
  line-height: 1;
}

.buho-topbar__right {
  position: relative;
}

.buho-topbar__cat-btn {
  display: flex;
  align-items: center;
  gap: var(--buho-space-2);
  height: 36px;
  padding: 0 var(--buho-space-3);
  font-size: var(--buho-fs-sm);
  font-weight: 600;
  color: var(--buho-fg-hi);
  background: var(--buho-bg-hi);
  border-radius: var(--buho-radius);
  transition: background var(--buho-ease);
  white-space: nowrap;
}
.buho-topbar__cat-btn:hover { background: #e6dfc8; }
.buho-topbar__cat-btn:active { background: #ddd6be; }

.buho-topbar__cat-arrow {
  font-size: 10px;
  transition: transform var(--buho-ease);
}
.buho-topbar__cat-btn--open .buho-topbar__cat-arrow {
  transform: rotate(180deg);
}

/* ---------------------------------------------------------------------------
   Dropdown
   --------------------------------------------------------------------------- */
.buho-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--buho-space-2));
  right: 0;
  min-width: 220px;
  max-width: calc(100vw - var(--buho-space-6));
  max-height: 60vh;
  overflow-y: auto;
  background: var(--buho-bg);
  border: var(--buho-border);
  border-radius: var(--buho-radius);
  box-shadow: var(--buho-shadow-lg);
  z-index: 200;
  animation: buho-fade-in 0.15s ease;
}

.buho-dropdown--open { display: block; }

@keyframes buho-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.buho-dropdown__category {
  border-bottom: var(--buho-border);
}
.buho-dropdown__category:last-child { border-bottom: none; }

.buho-dropdown__cat-name {
  display: block;
  padding: var(--buho-space-2) var(--buho-space-4);
  font-size: var(--buho-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--buho-fg-lo);
  background: var(--buho-bg-hi);
}

.buho-dropdown__tool-link {
  display: block;
  padding: var(--buho-space-2) var(--buho-space-4);
  font-size: var(--buho-fs-sm);
  color: var(--buho-fg);
  transition: background var(--buho-ease), color var(--buho-ease);
}
.buho-dropdown__tool-link:hover {
  background: var(--buho-bg-hi);
  color: var(--buho-blue);
}

.buho-dropdown__empty {
  padding: var(--buho-space-4);
  text-align: center;
  font-size: var(--buho-fs-sm);
  color: var(--buho-fg-lo);
}

/* ---------------------------------------------------------------------------
   Second Bar — tool name
   --------------------------------------------------------------------------- */
.buho-subbar {
  position: sticky;
  top: var(--buho-topbar-h);
  z-index: 99;
  display: flex;
  align-items: center;
  height: var(--buho-subbar-h);
  padding: 0 var(--buho-space-4);
  background: var(--buho-bg-hi);
  border-bottom: var(--buho-border);
  font-size: var(--buho-fs-sm);
  color: var(--buho-fg-lo);
  flex-shrink: 0;
}

.buho-subbar__tool-name {
  font-weight: 500;
  color: var(--buho-fg);
}

.buho-subbar--hidden { display: none; }

/* ---------------------------------------------------------------------------
   Content Area — scrolls independently
   --------------------------------------------------------------------------- */
.buho-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--buho-space-5) var(--buho-space-4);
}

.buho-content__inner {
  max-width: var(--buho-max-w);
  margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   Hero (index / landing)
   --------------------------------------------------------------------------- */
.buho-hero {
  text-align: center;
  padding: var(--buho-space-7) 0 var(--buho-space-5);
}

.buho-hero__owl {
  font-size: 64px;
  line-height: 1;
  display: block;
  margin-bottom: var(--buho-space-4);
}

.buho-hero__title {
  font-size: var(--buho-fs-xxl);
  font-weight: 800;
  color: var(--buho-fg-hi);
  margin-bottom: var(--buho-space-2);
}

.buho-hero__tagline {
  font-size: var(--buho-fs-lg);
  color: var(--buho-fg-lo);
  max-width: 480px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   Category Cards Grid
   --------------------------------------------------------------------------- */
.buho-categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--buho-space-4);
  padding-bottom: var(--buho-space-7);
}

@media (min-width: 600px) {
  .buho-categories { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 800px) {
  .buho-categories { grid-template-columns: repeat(3, 1fr); }
}

.buho-category-card {
  background: var(--buho-bg-hi);
  border: var(--buho-border);
  border-radius: var(--buho-radius);
  padding: var(--buho-space-4);
  transition: box-shadow var(--buho-ease);
}
.buho-category-card:hover { box-shadow: var(--buho-shadow); }

.buho-category-card__name {
  font-size: var(--buho-fs-lg);
  font-weight: 700;
  color: var(--buho-fg-hi);
  margin-bottom: var(--buho-space-3);
  padding-bottom: var(--buho-space-2);
  border-bottom: var(--buho-border);
}

.buho-category-card__tool {
  display: block;
  padding: var(--buho-space-2) 0;
  font-size: var(--buho-fs-sm);
  color: var(--buho-blue);
  transition: color var(--buho-ease);
}
.buho-category-card__tool:hover { color: var(--buho-cyan); }

.buho-category-card__empty {
  font-size: var(--buho-fs-sm);
  color: var(--buho-fg-lo);
  font-style: italic;
}

/* ---------------------------------------------------------------------------
   Empty State
   --------------------------------------------------------------------------- */
.buho-empty {
  text-align: center;
  padding: var(--buho-space-7) 0;
}

.buho-empty__icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--buho-space-4);
  opacity: 0.6;
}

.buho-empty__text {
  font-size: var(--buho-fs-lg);
  color: var(--buho-fg-lo);
}

/* ---------------------------------------------------------------------------
   Tool Page Helpers
   --------------------------------------------------------------------------- */
.buho-tool-section {
  margin-bottom: var(--buho-space-5);
}

.buho-tool-section__title {
  font-size: var(--buho-fs-lg);
  font-weight: 700;
  color: var(--buho-fg-hi);
  margin-bottom: var(--buho-space-3);
}

/* Input / output common styles */
.buho-textarea {
  width: 100%;
  min-height: 160px;
  padding: var(--buho-space-3);
  font-family: var(--buho-font-mono);
  font-size: var(--buho-fs-sm);
  color: var(--buho-fg);
  background: var(--buho-bg);
  border: var(--buho-border);
  border-radius: var(--buho-radius);
  resize: vertical;
  outline: none;
  transition: border-color var(--buho-ease);
}
.buho-textarea:focus { border-color: var(--buho-blue); }

.buho-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--buho-space-2);
  height: 40px;
  padding: 0 var(--buho-space-4);
  font-size: var(--buho-fs-sm);
  font-weight: 600;
  color: #fff;
  background: var(--buho-blue);
  border-radius: var(--buho-radius);
  transition: background var(--buho-ease), transform 0.1s ease;
  user-select: none;
}
.buho-btn:hover { background: #1f7bc4; }
.buho-btn:active { transform: scale(0.97); }

.buho-btn--outline {
  color: var(--buho-blue);
  background: transparent;
  border: 1px solid var(--buho-blue);
}
.buho-btn--outline:hover {
  color: #fff;
  background: var(--buho-blue);
}

/* ---------------------------------------------------------------------------
   Utility
   --------------------------------------------------------------------------- */
.buho-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
