/* ======================================================
   Consolidated layout/styles for index.html
   - Neutral, minimalist hover states (silver/white), no border accents
   - Includes: base tokens, resets, utilities, grid, columns, topnav,
               left drawer/menu, backdrop, iframe sizing
   ====================================================== */

/* 0) Design tokens (neutral palette) */
:root {
  --navy: #34516e;          /* primary brand navy for bars */
  --muted: #6b7785;         /* muted text */
  --bg: #ffffff;            /* site background */
  --hair: #e6e9ee;          /* subtle separators */
  --radius: 10px;
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.18);
  --accent: #e08a00;        /* orange accent for desktop H1 titles */
  --topbar-h: 3rem;         /* shared top bar height */
}

/* 1) Resets and base */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scrollbar-gutter: stable; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: #2d435e;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* 2) Utilities and W3CSS compatibility shims */
.w3-container { padding: 0 !important; }
.bg-site { background: var(--bg); }
.bg_navi { background: var(--navy); color: #fff; }
.w3-white, .bg-white { background: #fff; color: inherit; }
.w3-padding { padding: 1rem; }
.w3-center, .text-center { text-align: center; }
.w3-left { float: left; } .w3-right { float: right; }

/* Show/Hide helpers (names aligned with existing markup) */
.w3-hide-small { display: none; }
@media (min-width: 768px) { .w3-hide-small { display: initial; } }
.w3-hide-medium { display: none; }
@media (min-width: 1183px) { .w3-hide-medium { display: initial; } }
.w3-hide-large { display: initial; }
@media (min-width: 1183px) { .w3-hide-large { display: none; } }

/* 3) Grid / columns (maps l2 / l8 layout) */
.w3-row { display: flex; flex-wrap: wrap; margin-inline: 0 !important; }
.w3-col { padding-inline: 0 !important; }
@media (min-width: 1183px) {
  .w3-col.l2 { flex: 0 0 16.666%; max-width: 16.666%; }
  .w3-col.l8 { flex: 0 0 66.666%; max-width: 66.666%; }
}

/* Two-column page frame behavior */
@media (min-width: 1183px) {
  body.two-col { overflow: hidden; }
  #column_middle {
    height: 100vh; /* fill viewport */
    overflow: hidden; /* delegate scrolling to iframe */
    display: flex; flex-direction: column;
  }
}
@media (max-width: 1182.98px) {
  body.two-col { overflow: auto; }
  .w3-col { flex: 0 0 100%; max-width: 100%; }
  #column_middle { display: block; height: auto; min-height: auto; overflow: visible; }
}

/* Two-column mode: expand middle at desktop */
body.two-col #column_right { display: none !important; }
@media (min-width: 1183px) {
  body.two-col #column_middle { flex: 0 0 78%; max-width: 78%; }
  body.two-col .w3-col.l2 { flex: 0 0 22%; max-width: 22%; }
  /* Remove inner gutter between left and middle so bars touch */
  body.two-col #column_left { padding-right: 0; }
  body.two-col #column_middle { padding-left: 0; }
}

/* 4) Top bar (mobile) */
.topnav {
  display: none;
  background: var(--navy);
  color: #fff;
  padding: 0 0.75rem;            /* vertical height is controlled by min-height */
  min-height: var(--topbar-h);   /* keep a consistent height */
  font-size: 1.1rem;
  align-items: center;
  position: sticky; top: 0; z-index: 1300; /* ensure bar stays above drawer/backdrop */
}
.topnav .menu-icon { cursor: pointer; font-size: 1.6rem; margin-right: 0.75rem; line-height: 1; }
.topnav .site-title { font-weight: 600; }
@media (max-width: 1182.98px) { .topnav { display: flex; } }

/* 5) Columns and inner panes */
#column_left {
  height: 100dvh; min-height: 100vh; overflow: hidden; background: var(--navy); color: #fff;
}
@media (min-width: 1183px) {
  #column_left {
    border-bottom-right-radius: 20px;
    border-right: 1px solid var(--hair);
    box-shadow: 2px 0 6px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.06);
  }
}
#column_middle { min-height: 100vh; background: #fff; display: flex; flex-direction: column; overflow: visible; }

/* 6) Left menu content (neutral, minimalist) - IMPROVED */
.menu_left { padding: 0.5rem 1.15rem 1rem; line-height: 1.5rem; font-size: 0.95rem; }
.menu_left__title-spacer { height: 0; flex: 0 0 auto; }
@media (min-width: 1183px) {
  .menu_left h1.title:first-of-type { top: 1.35rem; }
  .menu_left__title-spacer { height: 1.35rem; }
}
.menu_left .title { color: inherit; font-family: inherit; font-weight: 600; letter-spacing: 0.15px; font-size: 1.06rem; margin: 0.85rem 0 0.35rem; }
.menu_left h1.title:first-of-type { position: static; background: transparent; border: none; border-radius: 0; margin: 0.15rem 0 0.25rem; box-shadow: none; }
.menu_left h1.title > a { display: block; color: inherit; text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 6px; margin: 0; border: none; }
.menu_left h1.title > a:hover, .menu_left h1.title > a:focus-visible { background: rgba(255,255,255,0.1); color: #fff; }
.menu_left ul { list-style: none; padding-left: 0; margin: 0.25rem 0 0.25rem; }
.menu_left li { margin-left: 0; line-height: 2rem; }
.menu_left a { color: inherit; display: block; padding: 0.4rem 0.7rem; border-radius: 6px; margin: 0; border: none; transition: background-color 0.15s ease, color 0.15s ease; }
.menu_left ul > li > a { padding-left: 1.35rem; }
.menu_left .picker-list > li > a { padding-left: 1.65rem; }
.menu_left a:hover, .menu_left a:focus-visible { background: rgba(255,255,255,0.1); color: #fff; }

/* Add subtle separator between menu groups on desktop */
@media (min-width: 1183px) {
  .menu_left .menu-group {
    padding-bottom: 0.65rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .menu_left .menu-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
  }
}

/* Compact mobile-only menu default hidden on desktop/tablet */
#column_left .menu_left .compact-menu { display: none; }

/* 7) Scroll containers and spacers */
#column_left .menu_left {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom,0px) + 1rem);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  /* Light scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
#column_left .menu_left::-webkit-scrollbar {
  width: 8px;
}
#column_left .menu_left::-webkit-scrollbar-track {
  background: transparent;
}
#column_left .menu_left::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.3);
  border-radius: 4px;
}
#column_left .menu_left::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,0.5);
}
@media (min-width: 1183px) { #column_left .menu_left::after { content: ""; display: block; flex: 0 0 160px; } }

/* 8) Drawer backdrop and mobile drawer behavior */
@media (max-width: 1182.98px) {
  /* Make the drawer itself as short as possible on mobile */
  #column_left { height: auto; max-height: calc(100vh - 3rem); min-height: 0; overflow: visible; }
  #column_left.open { height: auto; }

  /* Off-canvas left menu: hidden by default, shown when .open */
  #column_left {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); /* align exactly under the top bar */
    left: 0; right: auto;      /* drawer has its own width, not full screen */
    width: 72vw;               /* even narrower panel on mobile */
    max-width: 320px;          /* tighter cap for compact look */
    min-width: 260px;          /* prevent overly narrow drawer */
    transform: translateX(-105%); /* push a bit more than -100% to avoid subpixel seam */
    transition: none;          /* avoid animation on breakpoint switch */
    z-index: 1200;             /* below topnav (1300), above page content */
    pointer-events: none;      /* don't capture taps when closed */
    visibility: hidden;        /* do not paint when closed */
    opacity: 0;                /* extra safeguard */
    overflow-x: hidden;        /* prevent horizontal bar */
    overflow-y: visible;
  }
  #column_left.open {
    transform: translateX(0);
    transition: transform 0.22s ease; /* animate only when opened via JS */
    pointer-events: auto;      /* accept taps when open */
    visibility: visible;
    opacity: 1;
    border-bottom-right-radius: 16px; /* rounded bottom-right corner on mobile drawer */
    overflow-x: hidden;        /* keep horizontal overflow hidden */
    overflow-y: visible;
  }

  .drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.32);
    backdrop-filter: blur(2px);
    z-index: 1150;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  }
  .drawer-backdrop.show { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.22s ease; }
  body.noscroll { overflow: hidden; }

  /* Show compact mobile menu; hide desktop sections */
  #column_left .menu_left .compact-menu { display: block; }
  #column_left .menu_left .menu_left__title-spacer,
  #column_left .menu_left h1.title,
  #column_left .menu_left .menu-group { display: none; }

  /* Compact list basic styling (tight) */
  #column_left .menu_left { height: auto; max-height: inherit; overflow-y: auto; padding: 0.15rem 0.5rem 0.25rem; font-size: 1rem; line-height: 1.3; }
  #column_left .menu_left .compact-menu .compact-list { list-style: none; margin: 0; padding: 0; line-height: 1.05; }
  #column_left .menu_left .compact-menu .compact-list li { margin: 0; }
  #column_left .menu_left .compact-menu .compact-list li + li { margin-top: 0.28rem; }
  #column_left .menu_left .compact-menu .compact-list a {
    display: block;
    padding: 0.38rem 0.6rem 0.38rem 1.35rem; /* slightly larger tap target */
    color: inherit; text-decoration: none;
    border-radius: 8px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.045);
    line-height: 1.25;        /* slightly larger line-height for readability */
    opacity: 0.55;            /* fade non-active by default */
    transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    position: relative;       /* for indicator positioning */
    white-space: normal;      /* allow wrapping */
    overflow-wrap: anywhere;  /* prevent overflow on long words */
    word-break: break-word;   /* fallback for older engines */
    hyphens: auto;            /* nicer breaks where supported */
  }
  /* Small chevron indicator to the left of each item (silver-toned) */
  #column_left .menu_left .compact-menu .compact-list a::before {
    content: "\203A"; /* › chevron glyph */
    position: absolute;
    left: 0.68rem;
    top: 50%;
    transform: translateY(-52%); /* slight optical tweak */
    font-size: 0.85rem;
    color: rgba(230,233,238,0.9); /* silver-toned */
    line-height: 1;
    width: auto; height: auto;
    border: 0; border-radius: 0;
    background: none;
    box-sizing: content-box;
  }
  #column_left .menu_left .compact-menu .compact-list a:hover,
  #column_left .menu_left .compact-menu .compact-list a:focus-visible,
  #column_left .menu_left .compact-menu .compact-list a[aria-current="page"] {
    opacity: 1;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.26);
  }
  /* Brighten the chevron on hover/active */
  #column_left .menu_left .compact-menu .compact-list a:hover::before,
  #column_left .menu_left .compact-menu .compact-list a:focus-visible::before,
  #column_left .menu_left .compact-menu .compact-list a[aria-current="page"]::before {
    color: #fff;
  }
}

/* 9) Middle iframe sizing */
.transparent-iframe { background: transparent; border: none; width: 100%; }
@media (min-width: 1183px) {
  #column_middle .transparent-iframe { flex: 1 1 auto; height: auto; min-height: 0; overflow: auto; }
}
@media (max-width: 1182.98px) {
  #column_middle .transparent-iframe { display: block; width: 100%; height: auto; min-height: 100vh; }
  @supports (height: 100svh) { #column_middle .transparent-iframe { min-height: 100svh; } }
}

/* ======================================================
   Aliases without w3- prefix (for gradual migration)
   ====================================================== */

/* Container */
.page-container { padding: 0 !important; }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin-inline: 0 !important; }
.col { padding-inline: 0 !important; }
@media (min-width: 1183px) {
  .col.l2 { flex: 0 0 16.666%; max-width: 16.666%; }
  .col.l8 { flex: 0 0 66.666%; max-width: 66.666%; }
}

/* Alias grid: stack columns on small screens */
@media (max-width: 1182.98px) {
  .col { flex: 0 0 100%; max-width: 100%; }
}

/* Two-column overrides for alias grid */
body.two-col #column_right { display: none !important; }
@media (min-width: 1183px) {
  body.two-col .col.l2 { flex: 0 0 22%; max-width: 22%; }
}

/* Utilities */
.float-left { float: left; }
.float-right { float: right; }
.pad { padding: 1rem; }
.bg-white { background: #fff; color: inherit; }
.text-center { text-align: center; }

/* Simple spacing helper */
.margin-bottom { margin-bottom: 1rem; }

/* Visibility helpers */
.hide-sm { display: none; }
@media (min-width: 768px) { .hide-sm { display: initial; } }
.hide-md { display: none; }
@media (min-width: 1183px) { .hide-md { display: initial; } }
.hide-lg { display: initial; }
@media (min-width: 1183px) { .hide-lg { display: none; } }

/* Container alias matching centered layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* Simple card (neutral, delicate) */
.card {
  background: #fff;
  color: inherit;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Bordered list (replacement for w3-ul w3-border) */
.list-bordered {
  list-style: none;
  margin: 0.75rem auto;
  padding: 0;
  max-width: 980px;
  border: 1px solid var(--hair);
  border-radius: 10px;
  background: #fff;
}
.list-bordered > li {
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--hair);
}
.list-bordered > li:first-child { border-top: 0; }

/* Top padding helper */
.pad-top { padding-top: 1rem; }

/* Desktop: make H1 section titles orange in the left menu */
@media (min-width: 1183px) {
  #column_left .menu_left h1.title { color: var(--accent); }
  /* Remove extra stripe from Regulamin group to keep one visual accent */
  #column_left .menu_left h1.title + .menu-group .regulamin-list {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }
}

/* Desktop: make dropdown summary titles look like normal links (match "Regulamin (pdf) szczegółowy") */
@media (min-width: 1183px) {
  #column_left .menu_left .picker-details > summary.title {
    display: list-item;        /* required for native marker to render */
    list-style-position: inside;  /* align first visible sign with links */
    font-weight: 400 !important; /* override .menu_left .title (600) */
    line-height: 1.7rem;         /* tighter vertical rhythm on desktop */
    padding: 0.3rem 0.7rem;      /* reduce vertical padding, match link horizontal */
    padding-left: 1.35rem;       /* same left inset as normal links */
    margin: 0;
    color: inherit;
    text-decoration: none;
    border: none;
    border-radius: 6px;
  }
  /* Restore native summary marker (disclosure triangle) */
  #column_left .menu_left .picker-details > summary.title::marker { content: initial; }
  #column_left .menu_left .picker-details > summary.title::-webkit-details-marker { display: inline-block; }
  #column_left .menu_left .picker-details > summary.title:hover,
  #column_left .menu_left .picker-details > summary.title:focus-visible {
    background: rgba(255,255,255,0.1);
    color: #fff;
  }
  /* Ensure any inner label span inherits same metrics */
  #column_left .menu_left .picker-details > summary.title .sum-text {
    font-weight: inherit;
    line-height: inherit;
  }

  /* REGULAMIN group: use native marker and align text with first <li> */
  #column_left .menu_left .regulamin-list details > summary.title {
    display: list-item !important;     /* show native marker */
    list-style-position: inside !important;  /* place marker inside the content box */
    position: static !important;
    padding-left: 1.35rem !important;   /* same left inset as normal links */
  }
  #column_left .menu_left .regulamin-list details > summary.title::before { content: none !important; }
  #column_left .menu_left .regulamin-list details > summary.title::marker { content: initial !important; }
  #column_left .menu_left .regulamin-list details > summary.title::-webkit-details-marker { display: inline-block !important; }

  /* Tighten overall desktop vertical spacing for left menu */
  .menu_left ul { margin: 0.15rem 0; }
  .menu_left li { line-height: 1.7rem; }
  .menu_left a { padding-top: 0.3rem; padding-bottom: 0.3rem; }
  .menu_left h1.title > a { padding-top: 0.3rem; padding-bottom: 0.3rem; }
  /* Inner items inside details */
  #column_left .menu_left .picker-details .picker-list > li > a {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
  }

  /* Even tighter spacing inside details (inner list items) */
  #column_left .menu_left .picker-details .picker-list { margin: 0.1rem 0; }
  #column_left .menu_left .picker-details .picker-list > li { line-height: 1.55rem; }
  #column_left .menu_left .picker-details .picker-list > li > a {
    padding-top: 0.22rem !important;
    padding-bottom: 0.22rem !important;
  }
}

/* Details content wrapper: indent contents under summary */
#column_left .menu_left .picker-details .inside { padding-left: 2rem; }
/* Keep overall indent consistent: reduce inner link padding inside .inside */
#column_left .menu_left .picker-details .inside .picker-list > li > a { padding-left: 0.7rem !important; }

/* Dropdown lists: dim all items by default, highlight the active one */
#column_left .menu_left .picker-details .picker-list > li > a {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
#column_left .menu_left .picker-details .picker-list > li > a:hover,
#column_left .menu_left .picker-details .picker-list > li > a:focus-visible,
#column_left .menu_left .picker-details .picker-list > li > a[aria-current="page"] {
  opacity: 1;
}

/* Etap wojewódzki page (centered, minimalist) */
body.etap-woj .orange { color: var(--accent); }
body.etap-woj .container { max-width: 980px; margin: 0 auto; padding: 0 12px; }
body.etap-woj .page-title { margin: 1.25rem 0 1.25rem; font-size: 2rem; font-weight: 700; line-height: 1.2; text-align: center; }
body.etap-woj .sub-title { margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 600; color: var(--accent); text-align: center; }
body.etap-woj .list-bordered { text-align: center; }
body.etap-woj .list-bordered > li, 
body.etap-woj .list-bordered > li > a, 
body.etap-woj .list-bordered > li > a .box_h2 { text-align: center; }
body.etap-woj .list-bordered > li { padding: 0.5rem 0.75rem; }
body.etap-woj .list-bordered > li > a { display: block; color: inherit; text-decoration: none; border-radius: 8px; }
body.etap-woj .list-bordered > li > a:hover,
body.etap-woj .list-bordered > li > a:focus-visible { background: rgba(17,24,39,0.04); }
body.etap-woj .list-bordered > li > a .box_h2 { font-weight: 600; }