/*
 * Jules Skin - Atomikos-inspired styling for public pages
 * Clean, modern marketing page aesthetic
 *
 * This skin ONLY styles the Jules chrome (header, footer, nav, layout).
 * Web component rendering (.jibe-web__*) is handled entirely by
 * JibeWebPlugin's ensureCss() for consistency with the admin preview.
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
  --jules-font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --jules-font-size-base: 16px;
  --jules-line-height: 1.6;

  --jules-color-primary: var(--jibe-accent, #5c6bc0);
  --jules-color-primary-dark: var(--jibe-accent, #3949ab);
  --jules-color-secondary: var(--jibe-accent-2, #ff7043);
  --jules-color-text: var(--jibe-text, #333);
  --jules-color-text-light: #666;
  --jules-color-text-muted: #999;
  --jules-color-background: var(--jibe-bg, #ffffff);
  --jules-color-surface: var(--jibe-surface, #f8f9fa);
  --jules-color-border: var(--jibe-border, #e0e0e0);

  --jules-header-bg: var(--jibe-surface, inherit);
  --jules-header-height: 80px;

  --jules-spacing-xs: 0.25rem;
  --jules-spacing-sm: 0.5rem;
  --jules-spacing-md: 1rem;
  --jules-spacing-lg: 1.5rem;
  --jules-spacing-xl: 2rem;
  --jules-spacing-2xl: 3rem;
  --jules-spacing-3xl: 4rem;

  --jules-max-width: 1200px;
  --jules-content-padding: 2rem;
}

/* ========================================
   Base Styles
   ======================================== */
.jibePublic-html {
  scroll-behavior: smooth;
}

.jibePublic-body {
  margin: 0;
  padding: 0;
  font-family: var(--jules-font-family);
  font-size: var(--jules-font-size-base);
  line-height: var(--jules-line-height);
  color: var(--jules-color-text);
  background-color: var(--jules-color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Typography — scoped to Jules chrome only
   ======================================== */
.jibePublic-header h1,
.jibePublic-header h2,
.jibePublic-header h3 {
  font-family: var(--jules-font-family);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0;
  color: var(--jules-color-text);
}

.jibePublic-body a:not(.jibe-web__btn):not([class*="jibe-web"]) {
  color: var(--jules-color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.jibePublic-body a:not(.jibe-web__btn):not([class*="jibe-web"]):hover {
  color: var(--jules-color-primary-dark);
  text-decoration: underline;
}

/* ========================================
   Header
   ======================================== */
.jibePublic-header {
  position: relative;
  z-index: 100;
  background: var(--jules-header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.jibePublic-body .foswikiMain {
  padding: 0;
  margin: 0;
}

.jibePublic-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: none;
  margin: 0;
  padding: var(--jules-spacing-md) var(--jules-spacing-lg);
  min-height: var(--jules-header-height);
}

.jibePublic-logo {
  flex: 0 0 auto;
}

.jibePublic-logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.jibePublic-logo img {
  height: 40px;
  width: auto;
}

.jibePublic-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  padding: 0 var(--jules-spacing-xl);
}

.jibePublic-actions {
  flex: 0 0 auto;
}

.jibePublic-user-actions {
  display: flex;
  align-items: center;
  gap: var(--jules-spacing-sm);
}

/* ========================================
   Buttons (Jules chrome only)
   ======================================== */
.jibePublic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  font-family: var(--jules-font-family);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.jibePublic-btn-primary {
  background: var(--jules-color-primary);
  color: #fff;
  border: 1px solid var(--jules-color-primary);
}

.jibePublic-btn-primary:hover {
  background: var(--jules-color-primary-dark);
  border-color: var(--jules-color-primary-dark);
  color: #fff;
  text-decoration: none;
}

.jibePublic-btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  color: var(--jules-color-text);
  border: 1px solid var(--jules-color-border);
}

.jibePublic-btn-ghost:hover {
  background: var(--jules-color-surface);
  color: var(--jules-color-text);
  text-decoration: none;
}

/* ========================================
   Main Content Layout
   ======================================== */
.jibePublic-main {
  min-height: calc(100vh - var(--jules-header-height) - 200px);
  padding: 0;
  margin: 0;
}

.jibePublic-main > *:first-child,
.jibePublic-topic:first-child,
.jibePublic-topic > *:first-child,
.foswikiTopic > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Hide empty paragraphs that Foswiki generates between macros */
.jibePublic-topic > p:empty,
.foswikiTopic > p:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
}

.jibePublic-topic,
.foswikiTopic {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.jibePublic-main,
.jibePublic-topic {
  background: var(--jules-color-background);
}

/* ========================================
   Footer
   ----------------------------------------
   Site-level chrome footer was removed.
   The public skin no longer renders a template footer; each site
   provides its own end-of-page component (e.g. a Trust/Legal/Contact
   WebGrid with a centered copyright Footer field).
   ======================================== */

/* ========================================
   Navigation Menu
   ======================================== */
.jibePublic-nav .jibe-webmenu {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0;
}

.jibePublic-nav nav {
  border: none !important;
  background: transparent !important;
}

.jibePublic-nav .jibe-webmenu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
  border: none !important;
  background: transparent !important;
}

.jibePublic-nav .jibe-webmenu__item {
  position: relative;
  list-style: none;
  border: none !important;
  background: transparent !important;
}

.jibePublic-nav .jibe-webmenu__link,
.jibePublic-nav .jibe-webmenu__label {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #333 !important;
  text-decoration: none;
  background: transparent !important;
  border: none !important;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.jibePublic-nav .jibe-webmenu__link:hover {
  color: var(--jules-color-primary) !important;
  text-decoration: none;
}

.jibePublic-nav .jibe-webmenu__label {
  color: var(--jules-color-text-light);
  cursor: default;
}

.jibePublic-nav .jibe-webmenu__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid var(--jules-color-border);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  list-style: none;
  margin: 0;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
}

.jibePublic-nav .jibe-webmenu__item:hover > .jibe-webmenu__dropdown,
.jibePublic-nav .jibe-webmenu__item.sfHover > .jibe-webmenu__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.jibePublic-nav .jibe-webmenu__option a {
  display: block;
  padding: 0.625rem 1.25rem;
  color: #333 !important;
  font-size: 0.875rem;
  text-decoration: none;
  background: #ffffff !important;
  border: none !important;
  transition: color 0.2s ease;
}

.jibePublic-nav .jibe-webmenu__option a:hover {
  color: var(--jules-color-primary) !important;
  background: #ffffff !important;
}

.jibePublic-nav .jibe-webmenu__option--primary a {
  font-weight: 600;
}

/* ========================================
   Hide duplicate menu/br in content area
   (menu is already rendered in the header)
   ======================================== */
.jibePublic-topic > .jibe-webmenu,
.foswikiTopic > .jibe-webmenu,
.jibePublic-main .jibe-webmenu:not(.jibePublic-nav .jibe-webmenu) {
  display: none !important;
}

.jibePublic-topic > br,
.foswikiTopic > br {
  display: none !important;
}

/* ========================================
   Hide Foswiki-specific elements on public pages
   ======================================== */
.jibePublic-body .foswikiFormStep,
.jibePublic-body .foswikiFormSteps,
.jibePublic-body .foswikiAttachments,
.jibePublic-body .foswikiMetaData,
.jibePublic-body .foswikiTopicInfo,
.jibePublic-body .foswikiRevision {
  display: none;
}

/* Responsive images */
.jibePublic-topic img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  :root {
    --jules-content-padding: 1rem;
    --jules-header-height: 70px;
  }

  .jibePublic-header-inner {
    flex-wrap: wrap;
  }

  .jibePublic-logo {
    order: 1;
  }

  .jibePublic-actions {
    order: 2;
  }

  .jibePublic-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding: var(--jules-spacing-sm) 0 0;
    overflow-x: auto;
  }

  .jibePublic-nav .jibe-webmenu__list {
    flex-wrap: nowrap;
  }

  .jibePublic-nav .jibe-webmenu__link,
  .jibePublic-nav .jibe-webmenu__label {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

}

/* ========================================
   Utility Classes
   ======================================== */
.jules-text-center { text-align: center; }
.jules-text-left { text-align: left; }
.jules-text-right { text-align: right; }

.jules-mt-0 { margin-top: 0; }
.jules-mb-0 { margin-bottom: 0; }
.jules-my-0 { margin-top: 0; margin-bottom: 0; }
