/* ==========================================================================
   ArtLair UI 2027 — loaded AFTER style.css and theme-2026.css.
   Direction: a gallery at night. Chrome stays quiet and cool so the artwork
   carries the colour; one warm marigold accent marks what you can act on.
   Fast by design: system fonts, no blur on phones, no always-on animation.
   ========================================================================== */

:root {
  --ui-bg: #0a1113;
  --ui-bg-2: #0e171a;
  --ui-surface: #111c20;
  --ui-surface-2: #172429;
  --ui-line: #26373d;
  --ui-line-soft: #1b2a2f;
  --ui-ink: #e9f0f1;
  --ui-ink-dim: #9db1b7;
  --ui-ink-faint: #667a80;
  --ui-ember: #f0b44c;      /* primary accent (marigold) — name kept for old rules */
  --ui-ember-2: #ffd98a;
  --ui-jade: #5fd4b4;
  --ui-sky: #7fc4e8;
  --ui-danger: #ff6b6b;
  --ui-radius: 14px;
  --ui-radius-sm: 9px;
  --ui-pill: 999px;
  --ui-shadow: 0 14px 34px -22px rgba(0, 0, 0, .85);
  --ui-font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ui-display: "Avenir Next", "Segoe UI Variable Display", "SF Pro Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --ui-nav-h: 56px;
  --ui-tabbar-h: 58px;
  --ui-gutter: clamp(12px, 3vw, 28px);
  --ui-max: 1480px;
  --ui-focus: 0 0 0 3px rgba(240, 180, 76, .45);
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--ui-nav-h) + 12px); }
*, *::before, *::after { box-sizing: border-box; }

body.ui27 {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
body.ui27 img, body.ui27 video, body.ui27 canvas, body.ui27 svg { max-width: 100%; }
body.ui27 img { height: auto; }
body.ui27 h1, body.ui27 h2, body.ui27 h3, body.ui27 .idx-hero h1, body.ui27 .landing-title {
  font-family: var(--ui-display);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--ui-ink);
}
body.ui27 h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.4rem); }
body.ui27 h2 { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); }
body.ui27 a { color: var(--ui-sky); }
body.ui27 a:hover { color: var(--ui-ember-2); }
body.ui27 ::selection { background: var(--ui-ember); color: #1b1303; }
body.ui27 :focus-visible { outline: none; box-shadow: var(--ui-focus); border-radius: 6px; }

/* Layout shell */
body.ui27 .main-content {
  max-width: var(--ui-max);
  margin: 0 auto;
  padding: 22px var(--ui-gutter) 40px;
}

/* ---------- Desktop navbar ---------- */
body.ui27 .navbar {
  background: rgba(10, 17, 19, .94);
  border-bottom: 1px solid var(--ui-line-soft);
  height: var(--ui-nav-h);
  position: sticky; top: 0; z-index: 300;
}
@supports (backdrop-filter: blur(10px)) {
  @media (min-width: 1025px) { body.ui27 .navbar { background: rgba(10, 17, 19, .82); backdrop-filter: blur(12px); } }
}
body.ui27 .nav-container { max-width: var(--ui-max); height: 100%; padding: 0 var(--ui-gutter); gap: 8px; }
body.ui27 .nav-links > li > a {
  color: var(--ui-ink-dim);
  border-radius: var(--ui-pill);
  padding: 8px 14px;
  font-weight: 600;
  font-size: .9rem;
  transition: color .15s, background-color .15s;
}
body.ui27 .nav-links > li > a:hover,
body.ui27 .nav-links > li > a.active { color: var(--ui-ink); background: var(--ui-surface-2); }
body.ui27 .dropdown-menu {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  padding: 6px;
  min-width: 220px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
body.ui27 .dropdown-menu a { border-radius: var(--ui-radius-sm); color: var(--ui-ink-dim); padding: 9px 12px; }
body.ui27 .dropdown-menu a:hover { background: var(--ui-surface-2); color: var(--ui-ink); }
body.ui27 .nav-avatar { border-radius: 50%; width: 28px; height: 28px; object-fit: cover; }
body.ui27 .badge, body.ui27 .m-badge { background: var(--ui-ember); color: #1b1303; font-weight: 800; }

/* ---------- Buttons & forms ---------- */
body.ui27 .btn {
  border-radius: var(--ui-pill);
  font-weight: 700;
  min-height: 40px;
  padding: 9px 18px;
  font-family: inherit;
  transition: background-color .15s, border-color .15s, transform .1s;
}
body.ui27 .btn:active { transform: scale(.98); }
body.ui27 .btn-primary { background: var(--ui-ember); color: #1b1303; border: 1px solid var(--ui-ember); }
body.ui27 .btn-primary:hover { background: var(--ui-ember-2); border-color: var(--ui-ember-2); color: #1b1303; }
body.ui27 .btn-secondary { background: transparent; color: var(--ui-ink); border: 1px solid var(--ui-line); }
body.ui27 .btn-secondary:hover { background: var(--ui-surface-2); border-color: var(--ui-ink-faint); color: var(--ui-ink); }
body.ui27 .btn-danger { background: transparent; color: var(--ui-danger); border: 1px solid rgba(255, 107, 107, .45); }
body.ui27 .btn-danger:hover { background: rgba(255, 107, 107, .12); }
body.ui27 .btn-sm { min-height: 34px; padding: 6px 14px; font-size: .85rem; }

body.ui27 input[type=text], body.ui27 input[type=email], body.ui27 input[type=password],
body.ui27 input[type=search], body.ui27 input[type=number], body.ui27 input[type=url],
body.ui27 input[type=date], body.ui27 input[type=datetime-local], body.ui27 select, body.ui27 textarea {
  background: var(--ui-bg-2);
  color: var(--ui-ink);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;               /* stops iOS zooming into inputs */
  max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
body.ui27 input:focus, body.ui27 select:focus, body.ui27 textarea:focus {
  border-color: var(--ui-ember); box-shadow: var(--ui-focus); outline: none;
}
body.ui27 .form-group { margin-bottom: 16px; }
body.ui27 .form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ui-ink-dim); font-size: .9rem; }

/* ---------- Cards, panels, tables ---------- */
body.ui27 .card, body.ui27 .idx-tags-card, body.ui27 .idx-filter-panel {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line-soft);
  border-radius: var(--ui-radius);
  box-shadow: none;
}
body.ui27 .page-header { background: none; border: 0; padding: 4px 0 18px; border-radius: 0; }
body.ui27 .page-header::before, body.ui27 .page-header h1::after { display: none; }
body.ui27 .modal { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 18px; max-width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
body.ui27 .alert { border-radius: var(--ui-radius-sm); }
body.ui27 .data-table { width: 100%; border-collapse: collapse; }
body.ui27 .data-table th { color: var(--ui-ink-faint); font-weight: 700; font-size: .78rem; text-align: left; }
body.ui27 .data-table td, body.ui27 .data-table th { border-color: var(--ui-line-soft); }
body.ui27 .data-table tbody tr:hover td { background: var(--ui-surface-2); }
body.ui27 .tag, body.ui27 .landing-tags .tag { background: var(--ui-surface-2); border: 1px solid var(--ui-line); color: var(--ui-ink-dim); border-radius: var(--ui-pill); }
body.ui27 .tag:hover { color: var(--ui-ink); border-color: var(--ui-ember); }

/* ---------- Gallery (index.php browse) ---------- */
body.ui27 .idx-layout { gap: clamp(14px, 2vw, 28px); }
body.ui27 .idx-sidebar { width: 230px; top: calc(var(--ui-nav-h) + 16px); }
body.ui27 .idx-grid { display: flex; flex-wrap: wrap; gap: 8px; }
body.ui27 .idx-grid::after { content: ""; flex-grow: 1e6; }         /* last row never stretches */
body.ui27 .idx-card {
  background: var(--ui-surface);
  border: 0;
  border-radius: var(--ui-radius-sm);
  min-width: 140px;
  flex-basis: calc(var(--ar, 1.3) * 210px);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
body.ui27 .idx-card:hover { transform: translateY(-2px); border: 0; box-shadow: 0 0 0 2px var(--ui-ember), var(--ui-shadow); }
body.ui27 .idx-thumb { height: auto; background: var(--ui-surface-2); }
body.ui27 .idx-thumb img:not(.idx-thumb-bg) { width: 100%; height: 100%; object-fit: cover; max-height: none; }
body.ui27 .idx-card-link { display: block; }
body.ui27 .idx-card-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 8px;
  background: linear-gradient(to top, rgba(5, 9, 10, .88), transparent);
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
body.ui27 .idx-card-info a { pointer-events: auto; }
body.ui27 .idx-card:hover .idx-card-info, body.ui27 .idx-card:focus-within .idx-card-info { opacity: 1; }
body.ui27 .idx-card-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
body.ui27 .idx-card-author { color: #fff; font-weight: 700; font-size: .82rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ui27 .idx-card-stats { display: flex; gap: 10px; font-size: .78rem; color: var(--ui-ink-dim); white-space: nowrap; }
body.ui27 .idx-rating-badge { border-radius: 6px; }
body.ui27 .idx-hero { background: none; border: 0; padding: 8px 0 18px; text-align: left; }
body.ui27 .idx-search input[type=text] { border-radius: var(--ui-pill); padding-left: 18px; }

/* Touch screens have no hover: keep the caption visible */
@media (hover: none) {
  body.ui27 .idx-card-info { opacity: 1; padding-top: 22px; }
  body.ui27 .idx-card:hover { transform: none; box-shadow: none; }
}

/* ---------- Footer ---------- */
body.ui27 .site-footer {
  background: var(--ui-bg-2);
  border-top: 1px solid var(--ui-line-soft);
  margin-top: 48px;
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}
body.ui27 .footer-container { max-width: var(--ui-max); margin: 0 auto; padding: 36px var(--ui-gutter) 28px; }
body.ui27 .footer-columns { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 28px; }
body.ui27 .footer-col-title { color: var(--ui-ink); font-size: .95rem; margin-bottom: 10px; }
body.ui27 .footer-nav { list-style: none; margin: 0; padding: 0; }
body.ui27 .footer-nav a { color: var(--ui-ink-dim); text-decoration: none; display: inline-block; padding: 4px 0; }
body.ui27 .footer-nav a:hover { color: var(--ui-ember-2); }
body.ui27 .footer-bottom { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; border-top: 1px solid var(--ui-line-soft); margin-top: 26px; padding-top: 16px; color: var(--ui-ink-faint); font-size: .85rem; }
body.ui27 .footer-bottom-links { display: flex; gap: 14px; flex-wrap: wrap; }
body.ui27 .footer-partners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
body.ui27 .footer-partner-banner { width: 100%; height: auto; border-radius: var(--ui-radius-sm); }

/* ---------- Mobile / tablet header + drawer ---------- */
body.ui27 .m-header { background: var(--ui-bg); border-bottom: 1px solid var(--ui-line-soft); padding-top: env(safe-area-inset-top, 0); }
body.ui27 .m-header-inner { padding: 8px var(--ui-gutter); min-height: var(--ui-nav-h); }
body.ui27 .m-icon-btn, body.ui27 .m-menu-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ui-ink); }
body.ui27 .m-drawer {
  background: var(--ui-bg-2);
  border-left: 1px solid var(--ui-line);
  width: min(340px, 88vw);
  padding-bottom: env(safe-area-inset-bottom, 0);
  overscroll-behavior: contain;
}
body.ui27 .m-drawer-list a { min-height: 46px; display: flex; align-items: center; gap: 12px; border-radius: var(--ui-radius-sm); color: var(--ui-ink-dim); }
body.ui27 .m-drawer-list a:hover { background: var(--ui-surface-2); color: var(--ui-ink); }
body.ui27 .m-drawer-section-title { color: var(--ui-ink-faint); font-size: .78rem; font-weight: 700; }

/* ---------- Phone bottom tab bar ---------- */
.m-tabbar { display: none; }
@media (max-width: 768px) {
  body.ui27 { padding-bottom: calc(var(--ui-tabbar-h) + env(safe-area-inset-bottom, 0)); }
  .m-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 250;
    height: calc(var(--ui-tabbar-h) + env(safe-area-inset-bottom, 0));
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--ui-bg-2);
    border-top: 1px solid var(--ui-line);
  }
  .m-tabbar a, .m-tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: 0; color: var(--ui-ink-faint); font: inherit; font-size: .68rem; font-weight: 600;
    text-decoration: none; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .m-tabbar i { font-size: 1.15rem; }
  .m-tabbar a.is-active { color: var(--ui-ember); }
  .m-tabbar .m-tab-cta i {
    background: var(--ui-ember); color: #1b1303; width: 42px; height: 30px; border-radius: var(--ui-pill);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  }
  .m-tabbar .m-tab-dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--ui-ember); color: #1b1303; font-size: .62rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
  #cookieConsent { bottom: calc(var(--ui-tabbar-h) + env(safe-area-inset-bottom, 0)) !important; padding: 12px 14px !important; }
}

/* ---------- Breakpoints ---------- */
@media (max-width: 1024px) {
  body.ui27 .idx-layout { flex-direction: column; }
  body.ui27 .idx-sidebar { width: 100%; position: static; }
  body.ui27 .footer-columns { grid-template-columns: repeat(3, 1fr); }
  body.ui27 .footer-col--brand { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  body.ui27 { font-size: 15px; }
  body.ui27 .main-content { padding: 14px var(--ui-gutter) 28px; }
  body.ui27 .idx-grid { gap: 6px; }
  body.ui27 .idx-card { min-width: 42%; flex-basis: calc(var(--ar, 1) * 150px); border-radius: 8px; }
  body.ui27 .footer-columns { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  body.ui27 .site-footer { margin-top: 32px; }
  body.ui27 .card { padding: 16px; }
  body.ui27 .btn { min-height: 44px; }
  body.ui27 .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  body.ui27 .flex-between { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 420px) {
  body.ui27 .footer-columns { grid-template-columns: 1fr; }
  body.ui27 .idx-card { min-width: 46%; }
}
@media (min-width: 1800px) { :root { --ui-max: 1720px; } }

/* ---------- Performance & accessibility ---------- */
@media (max-width: 1024px) {
  body.ui27 .m-header, body.ui27 .navbar, body.ui27 .m-drawer-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Fixes found in device testing ---------- */
body.ui27 .idx-hero::before, body.ui27 .idx-hero::after, body.ui27 .idx-hero h1::after, body.ui27 .idx-hero h1::before { display: none; }
body.ui27 .idx-hero, body.ui27 .idx-hero-inner { background: none; box-shadow: none; }
body.ui27 .idx-result-count { text-transform: none; letter-spacing: normal; font-weight: 600; }
body.ui27 .m-tabbar span { font-size: .68rem; line-height: 1.1; }
body.ui27 .m-tabbar button { font-size: .68rem; padding: 0; }
body.ui27 .m-header .m-menu-btn, body.ui27 .m-header .m-icon-btn { background: var(--ui-surface); border: 1px solid var(--ui-line); }
body.ui27 .m-header .m-brand { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 640px) {
  /* index.php builds justified rows from --row-h; a taller row on phones keeps it to ~2 cards per row. */
  body.ui27 .idx-page .idx-grid, body.ui27.theme-2026 .idx-page #gwGrid { --row-h: 150px; gap: 6px; }
  body.ui27 .idx-page .idx-grid > .idx-card { border-radius: 10px; }
  body.ui27 .idx-page .idx-search { border-radius: 14px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  body.ui27 .idx-page .idx-grid, body.ui27.theme-2026 .idx-page #gwGrid { --row-h: 200px; gap: 8px; }
}

/* Browse page (index.php, .idx-page): style.css forces a 3-column grid with fixed-height thumbs on phones/tablets
   using !important. Replace it with justified rows that keep each image's real shape. Other pages keep their layout. */
@media (max-width: 960px) {
  body.ui27 .idx-page .idx-grid, body.ui27 .idx-page #gwGrid {
    display: flex !important; flex-wrap: wrap !important; grid-template-columns: none !important;
    grid-auto-flow: row !important; gap: 6px !important;
  }
  body.ui27 .idx-page .idx-grid > .idx-card, body.ui27 .idx-page #gwGrid > .idx-card { min-width: 0 !important; max-width: none !important; }
  body.ui27 .idx-page .idx-thumb, body.ui27 .idx-page .idx-video-placeholder { height: auto !important; }
  body.ui27 .idx-page .idx-card-info { padding: 22px 10px 8px !important; }
  body.ui27 .idx-page .idx-card-author { font-size: .78rem !important; }
  body.ui27 .idx-page .idx-card-stats { font-size: .72rem !important; }
}

body.ui27 .idx-page .idx-card-info { border-top: 0 !important; }

/* Slide-out menu: style.css sets `height:100dvh; height:100vh;` (the second wins), and 100vh is taller than the
   visible screen on mobile Chrome, so the bottom of the menu (Logout) was cut off. Use dvh and keep Logout pinned. */
@media (max-width: 1024px) {
  body.ui27 .m-drawer { height: 100vh; height: 100dvh; max-height: 100dvh; }
  body.ui27 .m-drawer-body { min-height: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
  body.ui27 .m-drawer-footer {
    position: sticky; bottom: 0; z-index: 2;
    background: var(--ui-bg-2); border-top: 1px solid var(--ui-line);
    margin-top: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  body.ui27 .m-drawer-logout { min-height: 46px; }
}
