/* static/css/layout.css
   Page shell + Header + Footer + Header panels (tooltip, account dropdown, locality panel)
   Depends on: base.css (tokens + typography + svg fill/gradient)
*/

/* ============================
   1) GLOBAL / SAFETY
============================ */
[hidden]{ display:none !important; }

/* ============================
   2) PAGE SHELL
   Sticky footer: footer stays at bottom on short pages
============================ */
.d25-page{ min-height:100vh; display:flex; flex-direction:column; }
.d25-main{ flex:1; }

/* ============================
   3) SKIP LINK (A11Y)
============================ */
.d25-skip-link{
  position:absolute;
  left:-999px;
  top:0.625rem;
  padding:0.625rem 0.75rem;
  background:var(--surface);
  border:var(--b1) solid var(--border);
  border-radius:var(--r10);
  z-index:var(--z-toast);
}
.d25-skip-link:focus{ left:0.625rem; }

/* ============================
   4) HEADER (bar + zones)
============================ */
.d25-hdr{
  position:sticky;
  top:0;
  z-index:var(--z-header);
}

.d25-hdr__bar{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--s12);
  padding:8px;
  background:var(--surface);
}

/* left + right zones */
.d25-hdr__left{
  display:flex;
  align-items:center;
  gap:var(--s8);
  position:relative;
  z-index:3;
}

.d25-hdr__right{
  display:flex;
  align-items:center;
  gap:var(--s10);
  flex:0 0 auto;
  position:relative;
  z-index:3;
}

/* centered logo/element */
.d25-hdr__center{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:auto;
}

/* ============================
   5) ICON WRAPPER
============================ */
.d25-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

/* ============================
   6) HEADER ICON BUTTON
============================ */
.d25-ibtn{
  width:48px;
  height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border:0;
  background:transparent;
  appearance:none;
  -webkit-appearance:none;
}

.d25-ibtn::-moz-focus-inner{ border:0; padding:0; }

.d25-ibtn:focus{ outline:none; }
.d25-ibtn:focus-visible{
  outline:var(--focus-ring);
  outline-offset:var(--focus-offset);
}

.d25-ibtn .d25-icon{ width:38px; height:38px; }

/* legacy (keep until templates are cleaned) */
.d25-ibtn__svg{ display:block; }

/* apps dots */
.d25-ibtn__apps{
  width:20px;
  height:20px;
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:3px;
}
.d25-ibtn__apps i{
  width:100%;
  height:100%;
  display:block;
  border-radius:8px;
  background:#b6b8ba;
}

/* ============================
   7) MORE SHEET (NO SCROLL)
============================ */
.d25-sheet{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  z-index:var(--z-modal);

  width:min(92vw, 26.5rem);
  padding:12px;

  border-radius:var(--radius-card);
  background:var(--surface);
  box-shadow:var(--shadow-2);
}

.d25-sheet__head{
  display:flex;
  justify-content:flex-end;
  padding:2px 2px 10px;
}

.d25-sheet__close{
  width:32px;
  height:32px;
  border-radius:999px;
  border:var(--b1) solid var(--border);
  background:var(--surface);
  color:var(--grey-09);
  font-size:20px;
  line-height:1;
}
.d25-sheet__close:hover{ background:var(--grey-01); }

.d25-sheet__grid{
  display:grid;
  grid-template-columns:repeat(3, max-content);
  justify-content:center;
  gap:24px;
  padding:4px;
}

.d25-sheet__item{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:6px;
  border:0;
  background:transparent;
  color:var(--grey-09);
}
.d25-sheet__item .d25-icon{ width:60px; height:60px; }

@media (hover:hover) and (pointer:fine){
  .d25-sheet__item:hover{ opacity:0.92; }
}

/* desktop popover position */
@media (min-width:56.25rem){
  .d25-sheet{
    left:10px;
    top:calc(var(--header-h, 64px) + 2px);
    transform:none;
    width:320px;
    padding:24px;
  }
  .d25-sheet__head{ display:none; }
}

/* ============================
   8) LANGUAGE (toggle only)
============================ */
.d25-lang{ display:inline-flex; }
.d25-lang-code{ min-width:2ch; }

.d25-lang-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  height:36px;
  width:36px;
  padding:4px;

  border-radius:var(--radius-pill);
  border:var(--b1) solid var(--border);
  background:var(--surface);
  color:var(--grey-09);

  line-height:1;
  transition:
    background var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
}

.d25-lang-btn:hover{
  background:var(--grey-01);
  border-color:var(--border);
}

.d25-lang-btn:focus-visible{
  outline:var(--focus-ring);
  outline-offset:var(--focus-offset);
}

/* ============================
   9) LOGIN (icon-only)
============================ */
.d25-login-ico{
  width:36px;
  height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--grey-09);
}
.d25-login-ico:focus{ outline:none; }
.d25-login-ico:focus-visible{
  outline:var(--focus-ring);
  outline-offset:var(--focus-offset);
}
.d25-login-ico .d25-icon{ width:28px; height:28px; }

/* ==========================================================
   10) TOOLTIP
========================================================== */

/* Popover container (injected by JS) */
[data-pop="panel"]{
  position:fixed;
  z-index:var(--z-toast);
  display:none;
  opacity:0;
  transform:none;
  transition:opacity var(--dur-1) var(--ease-out);
  pointer-events:none;
}

/* Open state */
[data-pop="panel"][data-open="1"]{
  display:block;
  opacity:1;
  pointer-events:auto;
}

/* Tooltip card */
.d25-tip{
  min-width:160px;
  max-width:280px;
  padding:12px 18px;
  border-radius:8px;
  background:var(--surface);
  box-shadow:var(--shadow-1);
}

/* Tooltip title */
.d25-tip__t{
  font-weight:var(--w-semibold);
  font-size:1rem;
  color:var(--grey-08);
}

/* Tooltip description */
.d25-tip__d{
  font-size:.9rem;
  color:var(--grey-08);
}

/* ==========================================================
   11) ACCOUNT DROPDOWN (logged-in)
========================================================== */
.d25-userdd{ position:relative; }

.d25-userdd__btn{
  list-style:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
}
.d25-userdd__btn::-webkit-details-marker{ display:none; }

/* Outline icon effect (works for most inline SVG symbols) */
.d25-login-ico.is-outline{
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

.d25-userdd__name{
  font-size:.9rem;
  color:var(--grey-10);
  max-width:110px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Menu */
.d25-userdd__menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:180px;

  background:var(--surface);
  border:var(--b1) solid var(--grey-02);
  border-radius:14px;
  box-shadow:var(--shadow-2);
  padding:8px;

  z-index:var(--z-dropdown);
}

.d25-userdd__item{
  display:block;
  padding:10px 12px;
  border-radius:10px;
  color:var(--grey-10);
  text-decoration:none;
  font-size:14px;
}
.d25-userdd__item:hover{ background:var(--grey-01); }

/* ============================
   12) LOCALITY SELECTOR (header)
============================ */
.d25-loc{ position:relative; display:inline-flex; align-items:center; }

.d25-loc-btn,
#d25LocBtn{
  display:inline-flex;
  align-items:center;
  gap:4px;
  height:36px;
  padding:0 20px;

  border-radius:var(--radius-pill);
  border:0;
  background:var(--surface);
  color:var(--grey-09);
  line-height:1;

  transition: background var(--dur-1) var(--ease-out);
}

.d25-loc-btn,
#d25LocBtn{ max-width:min(42vw, 320px); }

.d25-loc-btn:hover,
#d25LocBtn:hover{
  background:var(--grey-01);
}

.d25-loc-btn:focus-visible,
#d25LocBtn:focus-visible{
  outline:var(--focus-ring);
  outline-offset:var(--focus-offset);
}

.d25-loc-ic{ display:inline-flex; align-items:center; }
.d25-loc-pin{ width:1rem; height:1rem; color:var(--grey-06); }

.d25-loc-label,
#d25LocLabel{
  color:var(--grey-09);
  line-height:1;
  display:inline-block;
  max-width:22ch;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.d25-loc-caret{
  margin-left:2px;
  color:var(--grey-06);
  font-size:12px;
  line-height:1;
  flex:0 0 auto;
}

.d25-loc-panel,
#d25LocPanel{
  position:fixed;
  top:4rem;
  right:1rem;
  bottom:1rem;

  width:min(20rem, calc(100vw - 1.5rem));
  border-radius:var(--radius-surface);
  z-index:var(--z-modal);

  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:var(--surface);
  box-shadow:var(--shadow-2);
}

/* Search header */
.d25-loc-search{
  position:relative;
  padding:0.8rem;
  background:var(--grey-01);
}

.d25-loc-search-card{ position:relative; }
.d25-loc-search-top{ position:relative; display:flex; align-items:center; gap:8px; }

.d25-loc-search-ic{
  position:absolute;
  left:.9rem;
  top:50%;
  transform:translateY(-50%);
  display:inline-flex;
  align-items:center;
  color:var(--grey-04);
  pointer-events:none;
  z-index:2;
}

/* Search input (class + id compatible) */
.d25-loc-search-input,
#d25LocSearch{
  width:100%;
  height:2.5rem;
  border:0;
  border-radius:var(--radius-pill);
  padding:0 2.5rem;
  background:var(--surface);
  color:var(--grey-09);
}
.d25-loc-search-input::placeholder,
#d25LocSearch::placeholder{ color:var(--grey-06); }

.d25-loc-search-input:focus,
#d25LocSearch:focus{
  outline:0;
  outline-offset:var(--focus-offset);
}

/* Go button */
.d25-loc-search-go{
  height:2.5rem;
  width:2.5rem;
  border-radius:var(--radius-pill);
  border:var(--b1) solid transparent;
  background:var(--surface);
  color:var(--grey-09);
}
.d25-loc-search-go:hover{
  background:var(--grey-01);
  border-color:var(--border);
}

/* Suggestions dropdown */
.d25-loc-suggest{
  position:absolute;
  left:0.125rem;
  right:0.125rem;
  top:calc(100% - 0.25rem);
  z-index:var(--z-dropdown);

  border:var(--b1) solid var(--border);
  border-radius:var(--radius-card);
  overflow:hidden;
  background:var(--surface);
  box-shadow:var(--shadow-2);
}
.d25-loc-suggest-inner{ max-height:min(44vh, 21.25rem); overflow:auto; }

.d25-loc-suggest-item{
  border:0;
  margin:0;
  width:100%;
  display:block;
  text-align:left;
  padding:0.5rem 0.625rem;
  cursor:pointer;
  color:var(--grey-09);
  background:transparent;
  transition:background var(--dur-1) var(--ease-out);
}
.d25-loc-suggest-item:hover,
.d25-loc-suggest-item:focus{ background:var(--grey-01); outline:none; }

/* Body */
.d25-loc-body{
  flex:1;
  overflow:auto;
  padding:1.5rem;
  background:var(--surface);
}

/* List structure */
.d25-loc-list{
  --loc-gap:12px;
  display:flex;
  flex-direction:column;
  gap:var(--loc-gap);
}

.d25-loc-parent{
  width:100%;
  display:flex;
  align-items:center;
  gap:6px;
  padding:.02rem .4rem;
  border-radius:8px;
  background:var(--surface);
  box-shadow:0 .5px 1px rgba(0,0,0,0.1);
}

.d25-loc-row.is-open .d25-loc-parent,
.d25-loc-row[aria-expanded="true"] .d25-loc-parent{
  border-radius:var(--radius-card) var(--radius-card) 0 0;
  border:var(--b1) solid var(--border);
  border-bottom:0;
}

.d25-loc-parent-text{
  flex:0 1 auto;
  max-width:72%;
  padding:0.1rem 0.25rem;
  border:0;
  background:transparent;
  color:inherit;
  text-align:left;
  cursor:pointer;
  border-radius:var(--r10);
}
.d25-loc-parent-text:hover{ font-weight:var(--w-semibold); }

.d25-loc-parent-toggle{
  position:relative;
  flex:1 1 auto;
  height:2.75rem;
  border:0;
  background:transparent;
  border-radius:var(--radius-card);
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding:0 0.375rem;
}

.d25-loc-parent-toggle::after{
  content:"";
  position:absolute;
  right:0.375rem;
  top:50%;
  transform:translateY(-50%);
  width:1.6rem;
  height:1.6rem;
  border-radius:var(--radius-pill);
  background:var(--grey-01);
  z-index:0;
}

.d25-loc-parent-toggle::before{
  content:"";
  position:absolute;
  right:1rem;
  top:50%;
  transform:translateY(-50%) rotate(45deg);
  width:0.4rem;
  height:0.4rem;
  border-right:0.125rem solid var(--grey-05);
  border-bottom:0.125rem solid var(--grey-05);
  z-index:1;
}

.d25-loc-row.is-open .d25-loc-parent-toggle::before,
.d25-loc-row[aria-expanded="true"] .d25-loc-parent-toggle::before{
  transform:translateY(-50%) rotate(-135deg);
}

/* Children open/close (robust for sibling + nested markup) */
.d25-loc-children{ display:none; }

.d25-loc-row.is-open + .d25-loc-children,
.d25-loc-row[aria-expanded="true"] + .d25-loc-children,
.d25-loc-row.is-open .d25-loc-children,
.d25-loc-row[aria-expanded="true"] .d25-loc-children{
  display:block;
  margin-top:calc(0px - var(--loc-gap));
  padding:0.375rem 0;
  border:var(--b1) solid var(--border);
  border-top:0;
  border-radius:0 0 var(--radius-card) var(--radius-card);
  background:var(--surface);
  overflow:hidden;
}

.d25-loc-item{
  width:100%;
  display:block;
  padding:0.625rem 1.25rem;
  border:0;
  background:transparent;
  color:var(--grey-08);
  text-align:left;
  transition:background var(--dur-1) var(--ease-out);
}
.d25-loc-item + .d25-loc-item{ border-top:1px solid rgba(0,0,0,0.04); }
.d25-loc-item:hover{ background:var(--grey-01); }

@media (max-width:32.5rem){
  .d25-loc-panel,
  #d25LocPanel{
    top:4rem;
    left:0.75rem;
    right:0.75rem;
    width:auto;
    bottom:0.75rem;
  }
}


/* Locality search – keyboard navigation highlight */
.d25-loc-suggest-item.is-active{
  background: var(--grey-01);
}
.d25-loc-suggest-item:hover,
.d25-loc-suggest-item.is-active{
  background: var(--grey-01);
}



/* ============================
   13) HEADER · SHRINK MODE
============================ */
[data-d25-shrink-only]{ display:none; }
.d25-hdr.is-shrink [data-d25-shrink-only]{
  display:flex;
  align-items:center;
  justify-content:center;
}

.d25-shrhome img{
  height:40px;
  width:auto;
  display:block;
  object-fit:contain;
}

/* ============================
   14) FOOTER
============================ */
.d25-footer{
  padding:1.125rem 1.75rem;
  display:flex;
  justify-content:space-between;
  align-items:center;
  color:var(--text-muted);
}

.d25-footer-left,
.d25-footer-right{
  display:flex;
  gap:var(--s12);
  align-items:center;
}

.d25-footer a{ color:var(--text-muted); }
.d25-footer a:hover{ text-decoration:underline; }


/* ============================
   15) RESPONSIVE (general)
============================ */
@media (max-width:35rem){
  .d25-footer{ padding:0.875rem; }
  .d25-ibtn{ width:52px; height:52px; }
  .d25-hdr__right{ gap:var(--s8); }
}


/* ==========================================================
   16) MOBILE HEADER (APP-GRADE)
   Mobile: 2-row header (util + brand)
   Util order: Language | Locality | Account (right aligned)
   Mobile cleanups:
   - Remove locality icon
   - Disable tooltips completely
========================================================== */

/* Mobile-only logo variants hidden by default */
[data-d25-home-only],
[data-d25-shrink-only]{ display:none; }

@media (max-width:520px){

  /* Disable tooltips on mobile */
  [data-pop="panel"]{ display:none !important; }

  /* Hide desktop-only header icons on mobile */
  [data-d25-desktop-only]{ display:none !important; }

  /* Logo visibility rules */
  body.d25-page--home [data-d25-home-only],
  body.d25-page--inner [data-d25-shrink-only],
  .d25-hdr.is-shrink [data-d25-shrink-only]{ display:inline-flex; }

  body.d25-page--home [data-d25-shrink-only],
  body.d25-page--inner [data-d25-home-only],
  .d25-hdr.is-shrink [data-d25-home-only]{ display:none; }

  /* 2-row header layout */
  .d25-hdr__bar{
    display:grid;
    grid-template-columns: 1fr auto; /* burger hugs right edge */
    grid-template-areas:
      "util util"
      "brand menu";
    gap:1px 0;
    padding:10px 16px 2px;
    align-items:center;
  }

  .d25-hdr__right{
    grid-area: util;
    display:flex;
    align-items:center;
    gap:8px;
    width:100%;
    min-width:0;
  }

  .d25-hdr__center{
    grid-area: brand;
    display:flex;
    justify-self:start;
    align-self:center;
    position:static;
    transform:none;
    padding-left:2px;
  }

  .d25-hdr__left{
    grid-area: menu;
    justify-self:end;
    align-self:center;
    gap:0;
  }

  /* Util order */
  .d25-hdr__right .d25-lang{ order:1; }

  .d25-hdr__right .d25-loc{
    order:2;
    flex:0 1 180px;
    max-width:180px;
    min-width:120px;
  }

  .d25-hdr__right .d25-userdd,
  .d25-hdr__right .d25-login-ico{
    order:3;
    margin-left:auto; /* pushes account to far right */
  }

  /* Locality pill */
  .d25-loc-btn,
  #d25LocBtn{
    width:100%;
    height:24px;
    padding:6px 10px;
    justify-content:flex-start;
    gap:4px;
  }

  /* Remove locality icon on mobile */
  .d25-loc-ic,
  .d25-loc-pin{ display:none !important; }

  .d25-loc-btn span,
  #d25LocBtn span{
    font-size:.8rem;
    line-height:1;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  /* Language */
  .d25-lang-btn{
    width:24px;
    height:22px;
    padding:0;
  }
  .d25-lang-code{
    font-size:.75rem;
    line-height:1;
  }

  /* Account */
  .d25-login-ico{ width:24px; height:24px; }
  .d25-login-ico .d25-icon{ width:20px; height:20px; }

  .d25-userdd__btn{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:4px;
  }

  .d25-userdd__name{
    margin:0;
    padding:0;
    display:inline;
    max-width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:.8rem;
  }

  /* Burger alignment (shift glyph inside the button) */
  .d25-ibtn--burger{
    justify-content:flex-end;
    padding-right:4px; /* adjust 3–6px */
  }

  /* Logos */
  .d25-home-logo{
    display:inline-flex;
    align-items:center;
    line-height:1;
    text-decoration:none;
  }
  .d25-home-logo img{
    height:34px;
    width:auto;
    display:block;
    object-fit:contain;
  }

  .d25-shrhome{
    height:40px;
    padding:0;
    display:inline-flex;
    align-items:center;
  }
  .d25-shrhome img{
    height:32px;
    width:auto;
    display:block;
    object-fit:contain;
  }
}

