/*
Theme Name: WP Portal Base
Theme URI: https://example.invalid/wp-portal-base
Author: Local Project
Description: Shared multisite base theme with lightweight per-site branding.
Version: 0.3.0
Requires at least: 6.8
Tested up to: 6.8
Requires PHP: 8.3
Text Domain: wp-portal-base
*/

:root {
  --wp-portal-accent: #1657c0;
  --wp-portal-accent-soft: #dce8ff;
  --wp-portal-surface: #eef2f6;
  --wp-portal-surface-alt: #f8fafc;
  --wp-portal-text: #17212b;
  --wp-portal-muted: #5d6873;
  --wp-portal-border: color-mix(in srgb, var(--wp-portal-accent) 18%, white);
  --wp-portal-shadow: 0 18px 44px rgba(9, 20, 33, 0.12);
  --wp-portal-header-bg: #041e42;
  --wp-portal-header-bg-strong: #041e42;
  --wp-portal-header-border: color-mix(in srgb, var(--wp-portal-accent) 42%, white);
  --wp-portal-nav-active: #2a6ecf;
  --wp-portal-header-sticky-offset: 10.5rem;
  --wp-portal-context-sticky-gap: 1rem;
  --wp-portal-breadcrumb-sticky-offset: calc(var(--wp-portal-header-sticky-offset) + var(--wp-portal-context-sticky-gap));
  --wp-portal-branch-nav-sticky-offset: calc(var(--wp-portal-breadcrumb-sticky-offset) + 4.5rem);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--wp-portal-text);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--wp-portal-accent-soft) 70%, white), transparent 28%),
    linear-gradient(180deg, var(--wp-portal-surface), var(--wp-portal-surface-alt));
  line-height: 1.6;
}

a {
  color: var(--wp-portal-accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

.site-header {
  width: 100%;
  background: linear-gradient(180deg, var(--wp-portal-header-bg), var(--wp-portal-header-bg-strong));
  color: #fff;
  box-shadow: 0 16px 40px rgba(2, 20, 47, 0.22);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header__top,
.site-header__nav-row,
.site-header__nav-shell {
  width: 100%;
}

.site-header__top {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.site-header__nav-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.site-header__inner {
  width: min(100%, 120rem);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header__top .site-header__inner {
  min-height: 6.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.site-header__wordmark {
  flex-shrink: 0;
  color: #fff;
  text-decoration: none;
  font-size: clamp(1.75rem, 3.1vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.site-header__divider {
  width: 1px;
  height: 2.75rem;
  background: rgba(255, 255, 255, 0.18);
}

.site-header__application {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.site-header__app-name {
  color: #fff;
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-header__mobile-title {
  display: none;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: uppercase;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.site-header__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.site-header__menu-toggle-lines,
.site-header__menu-toggle-lines::before,
.site-header__menu-toggle-lines::after {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.site-header__menu-toggle-lines {
  position: relative;
}

.site-header__menu-toggle-lines::before,
.site-header__menu-toggle-lines::after {
  content: "";
  position: absolute;
  left: 0;
}

.site-header__menu-toggle-lines::before {
  top: -0.38rem;
}

.site-header__menu-toggle-lines::after {
  top: 0.38rem;
}

.site-header.is-open .site-header__menu-toggle-lines {
  background: transparent;
}

.site-header.is-open .site-header__menu-toggle-lines::before {
  top: 0;
  transform: rotate(45deg);
}

.site-header.is-open .site-header__menu-toggle-lines::after {
  top: 0;
  transform: rotate(-45deg);
}

.site-header__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  transition: background-color 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.site-header__login:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.34);
  transform: translateY(-1px);
}

.site-nav {
  padding: 0;
}

.site-header__mobile-action {
  display: none;
}

.site-nav ul,
.site-nav__list,
.site-nav .menu,
.site-nav .page-menu,
.site-nav .page_item_has_children > ul,
.site-nav .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__list,
.site-nav .menu,
.site-nav .page-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  min-height: 4rem;
}

.site-nav li {
  position: relative;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.8rem 1rem;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 4px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.site-nav a:hover,
.site-nav .current_page_item > a,
.site-nav .current-menu-item > a,
.site-nav .current_page_ancestor > a,
.site-nav .current-menu-ancestor > a {
  color: #fff;
  border-bottom-color: var(--wp-portal-nav-active);
}

.site-shell {
  width: min(100%, 78rem);
  margin: 0 auto 4rem;
  padding: 1.75rem 1rem 0;
}

.site-main {
  display: grid;
  gap: 1.5rem;
}

.context-panel,
.content-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--wp-portal-border);
  border-radius: 1.4rem;
  box-shadow: var(--wp-portal-shadow);
}

.context-panel {
  display: grid;
  gap: 1rem;
}

.context-panel--compact {
  padding-top: 1rem;
  padding-bottom: 1rem;
  background: rgba(255, 255, 255, 0.92);
}

.branch-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 18.5rem) minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.branch-sidebar {
  position: relative;
}

.branch-content {
  min-width: 0;
}

.branch-sidebar .section-shortcuts {
  position: sticky;
  top: var(--wp-portal-branch-nav-sticky-offset);
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.95));
  border: 1px solid color-mix(in srgb, var(--wp-portal-accent) 14%, white);
  border-radius: 1.4rem;
  box-shadow: 0 12px 28px rgba(9, 20, 33, 0.1);
}

.breadcrumb-trail__list,
.section-shortcuts__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb-trail__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.breadcrumb-trail__item {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--wp-portal-muted);
  font-size: 0.95rem;
}

.breadcrumb-trail__item:not(:last-child)::after {
  content: "/";
  color: color-mix(in srgb, var(--wp-portal-muted) 65%, white);
}

.breadcrumb-trail__item a {
  color: inherit;
  text-decoration: none;
}

.breadcrumb-trail__item a:hover {
  color: var(--wp-portal-accent);
}

.section-shortcuts {
  display: grid;
  gap: 0.9rem;
}

.section-shortcuts__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.1rem 0.1rem 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--wp-portal-accent) 12%, white);
}

.section-shortcuts__title,
.content-card__title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.1;
}

.section-shortcuts__title {
  font-size: clamp(1.2rem, 1.7vw, 1.45rem);
}

.section-shortcuts__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.branch-sidebar .section-shortcuts__list {
  display: grid;
  gap: 0.4rem;
}

.section-shortcuts__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.7rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.95rem;
  background: color-mix(in srgb, var(--wp-portal-accent-soft) 72%, white);
  color: var(--wp-portal-text);
  text-decoration: none;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.branch-sidebar .section-shortcuts__link {
  justify-content: flex-start;
  width: 100%;
  padding: 0.8rem 0.95rem 0.8rem 1.05rem;
  border-left: 4px solid transparent;
  background: rgba(237, 242, 249, 0.92);
}

.branch-sidebar .section-shortcuts__link::after {
  content: "›";
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  color: color-mix(in srgb, var(--wp-portal-muted) 88%, white);
  opacity: 1;
 }

.section-shortcuts__link:hover,
.section-shortcuts__link.is-current {
  background: var(--wp-portal-accent);
  color: #fff;
}

.branch-sidebar .section-shortcuts__link:hover {
  background: rgba(255, 255, 255, 0.98);
  color: var(--wp-portal-text);
  border-color: color-mix(in srgb, var(--wp-portal-accent) 18%, white);
  border-left-color: var(--wp-portal-nav-active);
  box-shadow: 0 8px 16px rgba(9, 20, 33, 0.08);
}

.branch-sidebar .section-shortcuts__link.is-current {
  background: #fff;
  color: var(--wp-portal-text);
  border-color: color-mix(in srgb, var(--wp-portal-nav-active) 28%, white);
  border-left-color: var(--wp-portal-nav-active);
  box-shadow: 0 10px 18px rgba(9, 20, 33, 0.1);
}

.branch-sidebar .section-shortcuts__link.is-current::after,
.branch-sidebar .section-shortcuts__link:hover::after {
  color: var(--wp-portal-nav-active);
}

.content-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.content-card__title {
  font-size: clamp(1.7rem, 2.2vw, 2.8rem);
}

.content-card__body > *:first-child {
  margin-top: 0;
}

.content-card__body > *:last-child {
  margin-bottom: 0;
}

.content-card__body img,
.content-card__body iframe,
.content-card__body embed,
.content-card__body object,
.content-card__body video {
  max-width: 100%;
  height: auto;
}

.content-card__body table {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  table-layout: auto;
}

.content-card__body th,
.content-card__body td {
  max-width: 100%;
  word-break: break-word;
}

.site-footer {
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--wp-portal-muted);
}

@media (max-width: 1024px) {
  :root {
    --wp-portal-header-sticky-offset: 4.75rem;
  }

  .site-header__inner {
    padding: 0 1rem;
  }

  .site-header__top .site-header__inner {
    min-height: 4.75rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding-top: 0;
    padding-bottom: 0;
  }

  .site-header__brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .site-header__wordmark,
  .site-header__divider,
  .site-header__application,
  .site-header__login {
    display: none;
  }

  .site-header__mobile-title {
    display: block;
  }

  .site-header__menu-toggle {
    display: inline-flex;
  }

  .site-header__actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  .site-header__nav-shell {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .site-header__nav-shell.is-open {
    display: block;
  }

  .site-header__nav-row {
    border-bottom: 0;
  }

  .site-header__mobile-action {
    display: flex;
    padding: 0.75rem 0 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 0.25rem;
  }

  .site-header__login--mobile {
    display: inline-flex;
    min-height: 2.6rem;
  }

  .site-nav__list,
  .site-nav .menu,
  .site-nav .page-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    min-height: auto;
    padding: 0.75rem 0 1rem;
  }

  .site-nav a {
    width: 100%;
    min-height: 2.9rem;
    padding: 0.7rem 0.85rem 0.7rem 1rem;
    border-bottom: 0;
    border-left: 4px solid transparent;
    border-radius: 0.9rem;
  }

  .site-nav .current_page_item > a,
  .site-nav .current-menu-item > a,
  .site-nav .current_page_ancestor > a,
  .site-nav .current-menu-ancestor > a {
    border-left-color: var(--wp-portal-nav-active);
    background: rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 720px) {
  .site-shell {
    padding-top: 1.25rem;
  }

  .branch-layout {
    grid-template-columns: 1fr;
  }

  .context-panel--compact,
  .branch-sidebar .section-shortcuts {
    position: static;
    padding: 1rem;
  }

  .branch-sidebar .section-shortcuts__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .branch-sidebar .section-shortcuts__link {
    width: auto;
    border-radius: 999px;
  }

  .branch-sidebar .section-shortcuts__link::after {
    content: none;
  }

  .context-panel,
  .content-card {
    padding: 1.2rem;
    border-radius: 1.15rem;
  }
}
