/* ---------------------------------------
   CSS Variables / Theme Colors
---------------------------------------- */
:root {
  /* Shell surface defaultss */
  --color-main-bg: #ffffff;
  --color-sidebar-bg: #0080c6;
  --color-header-bg: #d0ebff;
  --color-intro-bg: #ffffb0;
  --color-footer-bg: #e5dbff;
  --color-section-bg: #ffffff;
  --color-link: #0056b3;

  /* Content well */
  --color-content-bg: transparent;
  --content-width: 650px;

  /* Buttons / links */
  --btn-fg-light: #ffffff;
  --btn-fg-dark: #1f2933;

  --bs-primary: #0056b3;
  --bs-primary-rgb: 0, 86, 179;
}

/* ---------------------------------------
   Base Styling
---------------------------------------- */

/* Page layout */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* ensures full viewport height */
  gap: 0.5rem;
}

.page-header {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0.5rem;
}

.page-main {
  display: flex; /* horizontal flex: sidebar + content */
  flex: 1 1 auto; /* fills remaining space between header/footer */
  gap: 1rem;
  align-items: stretch; /* key: sidebar stretches to match content */
  background: var(--color-main-bg);
  border-top-left-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
  padding-right: 0.25rem;
}

.identity-rail {
  display: flex;
  flex: 0 0 240px; /* fixed width */
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--color-sidebar-bg);
  border-radius: 0.5rem;
  padding-top: 2rem;
  min-height: 100%; /* stretch to fill flex container */
}

.identity-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
}

.identity-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wp-logo img {
  max-width: 350px;
  max-height: 125px;
}

/* Content column flex */
.content-column {
  flex: 1 1 auto; /* takes remaining width */
  display: flex;
  flex-direction: column;
  min-height: 0; /* allows child scrolling */
}
/* Center form with max-width */
.content-column > * {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.content-column .wp-panel[data-panel="content"] {
  overflow-y: visible;
  min-height: 0;
  /* CONTENT WELL: structural only */
  background: var(--color-content-bg);
  box-shadow: none;
  border: none;
  border-radius: 0.25rem;
  padding: 0 0.75rem;
  margin: 0 auto;
}

/* Panels and sections */
/* Panels: all except content get subtle border */
.wp-panel {
  border-radius: 0.5rem;
  padding: 1rem 1rem 0.25rem 1rem;
  margin: 0.5rem auto;
  border: 1px solid rgba(0, 0, 0, 0.08); /* subtle edge for light backgrounds */
}

.wp-section {
  border-radius: 0.375rem;
  padding: 1rem;
  margin: 0.25rem auto;
}

[data-panel="main"] {
  background: var(--color-main-bg);
  color: var(--fg-calc);
}

[data-panel="header"] {
  background: var(--color-header-bg);
  color: var(--fg-calc);
  padding-bottom: 1rem;
}

[data-panel="intro"] {
  background: var(--color-intro-bg);
  color: var(--fg-calc);
}

[data-panel="section"] {
  background: var(--color-section-bg);
  color: var(--fg-calc);
}

[data-panel="footer"] {
  background: var(--color-footer-bg);
  color: var(--fg-calc);
}

.wp-title {
  color: var(--color-sidebar-bg);
  margin-top: 1rem;
  margin-bottom: 0;
}

.wp-subtitle {
  color: var(--color-link);
  margin-top: 0.75rem;
}

.wp-horiz-line {
  opacity: 0.6;
  height: 1px;
  background-color: var(--color-sidebar-bg);
  margin-top: 1em;
}

.wp-upload-input {
  background-color: var(--color-footer-bg);
}

.wp-brand-mark {
  position: fixed;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 0.8rem;
  color: #666;
  opacity: 0.7;
  pointer-events: none;
}

.wp-brand-mark img {
  height: 4.5rem;
  margin-left: 2rem;
}

.wp-panel[data-panel="content"] form-group label {
  margin-top: 0.75rem;
  font-weight: bold;
}

.wp-panel[data-panel="content"] a {
  color: var(--color-link);
  font-weight: 500;
  text-decoration: none;
}
.wp-panel[data-panel="content"] a:hover {
  text-decoration: underline;
}
.wp-panel[data-panel="content"] ul {
  margin-bottom: 0;
}

/* Buttons */
.content-column .btn {
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}
.content-column .wp-btn-primary {
  --bs-btn-bg: var(--color-link);
  --bs-btn-border-color: var(--color-link);
  --bs-btn-color: var(--btn-fg-calc);
  --bs-btn-hover-color: color-mix(in srgb, var(--btn-fg-calc) 85%, black);
  --bs-btn-hover-bg: color-mix(in srgb, var(--color-link) 85%, black);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--color-link) 85%, black);
  --bs-btn-active-bg: color-mix(in srgb, var(--color-link) 70%, black);
  --bs-btn-active-border-color: color-mix(in srgb, var(--color-link) 70%, black);
  padding: 0.33rem .7rem;
}

/* ---------------------------------------
   Layout
---------------------------------------- */
.wp-left-sidebar-image aside {
  flex: 0 0 240px;
}
.wp-left-sidebar-image .identity-photo {
  display: block;
}
.wp-left-sidebar-image .wp-logo {
  display: none;
}

.wp-left-sidebar-logo aside {
  flex: 0 0 240px;
}
.wp-left-sidebar-logo .identity-photo {
  display: none;
}
.wp-left-sidebar-logo .wp-logo {
  display: block;
}

.wp-top-sidebar aside {
  height: 160px;
}
.wp-top-sidebar .identity-photo {
  display: none;
}
.wp-top-sidebar {
  flex-direction: column;
}
.wp-top-sidebar aside.identity-rail {
  flex: 0 0 60px;
  width: 100%;
  height: auto;
  padding: 0.75rem 1rem;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}
.wp-top-sidebar .content-column {
  flex: 1 1 auto;
}

.wp-no-sidebar aside {
  display: none;
}

/* ---------------------------------------
   Themes
---------------------------------------- */
/* -- Modern -- */
.wp-theme-modern .wp-panel:not([data-panel="content"]),
.wp-theme-modern .wp-section,
.wp-theme-modern aside {
  border-radius: 0;
  border: none;
  box-shadow: none;
}
.wp-theme-modern .wp-top-sidebar {
  flex-direction: column;
  gap: 0;
}
.wp-theme-modern .wp-top-sidebar aside {
  flex: 0 0 auto;
  height: 6px;
  padding: 0;
  border-radius: 0;
}
.wp-theme-modern .wp-top-sidebar .wp-panel[data-panel="header"] {
  margin-top: 0;
  border-radius: 0;
}
.wp-theme-modern .wp-section {
  padding: 0.6rem;
}

/* -- Classic -- */
.wp-theme-classic {
  --classic-radius: 0.5rem;
  --btn-fg-light: #ffffff;
}
.wp-theme-classic body {
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}
.wp-theme-classic .wp-panel:not([data-panel="content"]),
.wp-theme-classic .wp-section,
.wp-theme-classic .wp-top-sidebar aside {
  border-radius: var(--classic-radius);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: none;
}
.wp-theme-classic .wp-left-sidebar-logo aside,
.wp-theme-classic .wp-left-sidebar-image aside {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  margin-left: 0.25rem;
}
.wp-theme-classic .wp-top-sidebar {
  flex-direction: column;
  gap: 0;
}
.wp-theme-classic .wp-top-sidebar aside {
  flex: 0 0 auto;
  height: 24px;
  padding: 0.5rem 1rem;
  border-radius: var(--classic-radius) var(--classic-radius) 0 0;
  border-top-left-radius: var(--classic-radius);
  border-top-right-radius: var(--classic-radius);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.wp-theme-classic .wp-top-sidebar .wp-panel[data-panel="header"] {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.wp-theme-classic .content-column .wp-panel[data-panel="content"] {
  margin-top: 1rem;
  margin-bottom: 1rem;
}
.wp-theme-classic .wp-btn-primary {
  box-shadow: none;
  border-radius: var(--classic-radius);
}
.wp-theme-classic .wp-btn-primary:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

/* -- Soft -- */
.wp-theme-soft {
  --soft-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  --soft-radius: 0.75rem;
  --btn-fg-light: #ffffff;
}
.wp-theme-soft body {
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.02em;
}
.wp-theme-soft ul li::marker {
  font-size: 1.25em;
  line-height: 1;
}
.wp-theme-soft .wp-panel:not([data-panel="content"]) {
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.02);
}
.wp-theme-soft .page-main {
  border-top-left-radius: var(--soft-radius);
  border-bottom-left-radius: var(--soft-radius);
}
.wp-theme-soft aside {
  border-radius: var(--soft-radius);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}
.wp-theme-soft .content-column {
  background: rgba(255, 255, 255, 0.03); /* very faint tint */
}
.wp-theme-soft .content-column .wp-panel[data-panel="content"] {
  margin-top: 1.5rem;
}
.wp-theme-soft .wp-panel {
  margin: 0.75rem auto;
}
.wp-theme-soft .wp-section {
  border-radius: var(--soft-radius);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.03);
  padding: 1rem;
}
.wp-theme-soft .wp-left-sidebar-logo aside,
.wp-theme-soft .wp-left-sidebar-image aside {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  margin-left: 0.25rem;
}
.wp-theme-soft .wp-top-sidebar {
  flex-direction: column;
  gap: 0;
}
.wp-theme-soft .wp-top-sidebar aside {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  height: auto;
  border-radius: 0.5rem 0.5rem 0 0; /* gently rounded top corners */
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.wp-theme-soft .wp-top-sidebar .wp-panel[data-panel="header"] {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
/* Buttons */
.wp-theme-soft .wp-btn-primary {
  border-radius: var(--soft-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: none;
  transition: all 0.2s ease;
  padding: 0.5rem 1rem;
}
.wp-theme-soft .wp-btn-primary:hover {
  filter: brightness(0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* mock color viewer */
.logo-container {
  position: relative;
}

.logo-container img {
  max-width: 250px;
  max-height: 100px;
}

.logo-container label {
  position: absolute;
  margin: 0;
  top: 6px;
  left: 175px;
  color: darkblue;
}

#logo-add,
#logo-remove {
  font-size: 18px;
}

.theme-preview {
  border: 1px solid #c0c0c0;
}

.theme-preview .main {
  background-color: #fff;
}

.theme-preview .preview-logo {
  height: 2rem;
  width: 2.5rem;
  background-color: transparent;
  font-size: smaller;
  border: 2px solid #d8d8d8;
  border-radius: 4px;
}

.theme-preview .header,
.theme-preview .intro,
.theme-preview .section,
.theme-preview .footer {
  margin-top: 0.5rem;
  padding: 0.25rem;
  border-radius: 5px;
  border: 1px solid #d8d8d8;
  font-size: smaller;
}

.theme-preview .wp-top-sidebar.page-main,
.theme-preview .wp-no-sidebar.page-main {
  padding-left: 0.25rem;
  padding-top: 5px;
}

/* ---------------------------------------
   Media queries
--------------------------------------- */

@media (max-width: 768px) {
  /* CSS rules for phones */
  .wp-left-sidebar-image .identity-rail,
  .wp-left-sidebar-logo .identity-rail {
    width: 10px;
    flex: 0 0 10px;
  }

  .wp-left-sidebar-image .identity-photo {
    display: none;
  }

  .wp-brand-mark {
    display: none !important;
  }

  .page-main {
    gap: 0;
  }

  /* Reduce padding/margin for smaller screens */
  .content-column {
    padding: 0.5rem;
  }

  .form-label-group {
    margin-bottom: 0.5rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* CSS rules for portrait orientation */
  .wp-left-sidebar-image .identity-rail,
  .wp-left-sidebar-logo .identity-rail {
    width: 120px;
    flex: 0 0 120px;
  }

  .identity-rail {
    height: auto;
  }

  .identity-photo {
    width: 75px;
    height: 75px;
  }

  .wp-brand-mark {
    left: 1rem;
  }
  .wp-brand-mark img {
    height: 3rem;
    margin-left: 0;
  }
}

@media (min-width: 1025px) and (max-width: 1300px) {
  /* CSS rules for landscape orientation */
  .wp-left-sidebar-image .identity-rail,
  .wp-left-sidebar-logo .identity-rail {
    width: 160px;
    flex: 0 0 160px;
  }

  .identity-rail {
    height: auto;
  }

  .identity-photo {
    width: 75px;
    height: 75px;
  }

  .wp-brand-mark img {
    height: 3.5rem;
  }
}
