/* Final topbar-only override. Existing Fal bamboo is the control surface;
   the former green parent panels are removed, not covered with ornaments. */
.topbar {
  --topbar-bamboo: url('./material-assets/bamboo-culm.webp');
  --topbar-node: url('./material-assets/bamboo-node.webp');
  --topbar-ink: #fff4d8;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 16px 25px;
  padding-block: 18px;
  overflow: visible;
}
.topbar .topbar-brand,
.topbar .preferences,
.topbar .account-actions {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.topbar .topbar-brand::before,
.topbar .topbar-brand::after,
.topbar .preferences::before,
.topbar .preferences::after,
.topbar .account-actions::before,
.topbar .account-actions::after { content: none; display: none; }

/* The real home link is a Fal wood plaque nailed onto the main timber beam. */
.topbar .topbar-brand {
  display: inline-flex;
  justify-self: start;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 15 / 4;
  width: clamp(280px, 30vw, 420px);
  max-width: calc(100% - 24px);
  margin-inline-start: 24px;
  padding: 13px 34px 15px;
  background: url('./material-assets/header-tiki-plaque.webp') center / 100% 100% no-repeat;
  color: #ffe1a3;
  font: 700 clamp(24px, 2.5vw, 34px)/1.08 Georgia, 'Times New Roman', serif;
  letter-spacing: .075em;
  text-decoration: none;
  text-shadow: 0 2px 1px #281307, 0 -1px #fff2c35e, 0 4px 9px #1c0e0799;
}
.topbar .topbar-brand > .tiki-detail-icon { display: none; }
.topbar .topbar-brand > span:not(.tiki-detail-icon) { white-space: nowrap; }
.topbar .topbar-controls {
  display: grid;
  grid-template-columns: 172px max-content;
  justify-content: end;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.topbar .preferences {
  flex: 0 0 157px;
  padding: 0;
  min-width: 0;
}
.topbar .preferences .compact-label {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--topbar-ink);
}
.topbar .preferences .compact-label > span {
  position: absolute;
  top: 6px;
  left: 24px;
  width: calc(100% - 52px);
  z-index: 1;
  color: #fff0cf;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px #080503, 0 0 3px #080503;
  pointer-events: none;
}
.topbar .account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 13px;
  min-width: 0;
  padding: 0;
}

/* The existing physical bamboo remains visible beneath a dark wood stain.
   Cream lettering stays readable over both bright grain and dark natural nodes. */
.topbar .preferences select,
.topbar .account-actions .text-button {
  position: relative;
  min-height: 56px;
  border: 1px solid #7c502a;
  border-top-color: #efc382;
  border-bottom: 3px solid #583319;
  border-radius: 10px 7px 9px 7px / 12px 9px 12px 9px;
  background-color: #332215;
  background-image: linear-gradient(#2a1a0dbc, #160e08c7 65%, #100b07cc), var(--topbar-bamboo);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  color: var(--topbar-ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  text-shadow: 0 1px 2px #080503, 0 0 3px #080503cc;
  box-shadow: inset 0 1px 1px #fff1c67a, inset 0 -2px 3px #3c210936, 0 3px 0 #27160bd9, 0 5px 8px #160d0959;
}
.topbar .preferences select {
  /* Keep the native select behavior, without the macOS compact menulist skin. */
  -webkit-appearance: none;
  appearance: none;
  height: 56px;
  min-height: 56px;
  line-height: 18px;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 21px 30px 8px 24px;
  cursor: pointer;
}
.topbar .preferences select option { background: #2b1e13; color: #fff4d8; text-shadow: none; }
.topbar .account-actions .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 112px;
  max-width: 244px;
  padding: 11px 25px 10px;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* The exact inscription stays crisp and accessible on the generated wood plaque. */
.topbar .topbar-brand > .topbar-inscription:not(.tiki-detail-icon) {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  color: #ffdf9f;
  text-align: center;
  font-size: clamp(22px, 2.1vw, 29px);
  font-variant-caps: small-caps;
  letter-spacing: .055em;
  line-height: 1.15;
  white-space: normal;
  text-shadow: 0 2px 2px #231106, 0 -1px 0 #fff2c055;
}
/* The arrow is painted inside the select, keeping both rope rails unobstructed. */
.topbar .preferences .compact-label > span::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  top: 18px;
  right: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
/* Keep the actual logout text as the accessible name; the opaque atlas tile is
   decorative and would put a new green square back onto this bamboo control. */
.topbar .account-actions .text-button > .tiki-detail-icon { display: none; }

.topbar .preferences .compact-label::before,
.topbar .preferences .compact-label::after,
.topbar .account-actions .text-button::before,
.topbar .account-actions .text-button::after {
  content: '';
  display: block;
  position: absolute;
  z-index: 1;
  top: 4px;
  bottom: 6px;
  width: 8px;
  border-inline: 1px solid #57391f;
  border-radius: 2px;
  background-image: repeating-linear-gradient(28deg, #d5b582b8 0 1px, #69503199 1px 2px, transparent 2px 4px), var(--topbar-node);
  background-position: center;
  background-size: 100% 100%;
  box-shadow: inset 1px 0 #ffe4ac66, 1px 1px 2px #2d180b7a;
  pointer-events: none;
}
.topbar .preferences .compact-label::before,
.topbar .account-actions .text-button::before { left: 7px; }
.topbar .preferences .compact-label::after,
.topbar .account-actions .text-button::after { right: 7px; }
.topbar .account-actions .text-button:is(:hover, :focus-visible),
.topbar .preferences select:is(:hover, :focus-visible) {
  background-color: #3a2819;
  background-image: linear-gradient(#302012b8, #211309c2 65%, #130c08cc), var(--topbar-bamboo);
  color: var(--topbar-ink);
  border-top-color: #ffe4aa;
}
.topbar .account-actions .text-button:active {
  box-shadow: inset 0 2px 4px #4c2e2255, 0 1px 0 #27160bd9;
}
.topbar :is(a, button, select):focus-visible {
  outline: 3px solid #fff1b5;
  outline-offset: 4px;
}
/* Extinguish the beam artwork itself; never dim its child labels or controls. */
html[data-bar-state="closed"] .topbar {
  background-image: linear-gradient(#08130ca8, #08130cb8), var(--header-bamboo-art);
}
html[data-bar-state="closed"] .topbar .preferences select,
html[data-bar-state="closed"] .topbar .account-actions .text-button {
  background-color: #201c13;
  background-image: linear-gradient(#151b12d4, #0e120bd9 65%, #090d08dd), var(--topbar-bamboo);
  box-shadow: inset 0 1px 1px #cabc6d20, inset 0 -2px 3px #080b083d, 0 3px 0 #120d09d9, 0 5px 8px #100b0859;
}

@media (max-width: 1000px) and (min-width: 561px) {
  .topbar { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .topbar .topbar-brand { justify-self: center; margin-inline-start: 0; }
  .topbar .topbar-controls { justify-content: center; }
}
@media (max-width: 560px) {
  .topbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; padding: 12px 13px 15px; }
  .topbar .topbar-brand { grid-column: 1 / -1; justify-self: center; width: min(100%, 420px); max-width: 100%; margin-inline-start: 0; min-height: 0; aspect-ratio: 15 / 4; letter-spacing: .045em; padding: 12px 28px 14px; }
  .topbar .topbar-controls { display: contents; }
  .topbar .preferences { grid-column: 1; width: 100%; padding: 0; }
  .topbar .preferences select { height: 56px; min-height: 56px; font-size: 12px; padding-inline: 22px 23px; }
  .topbar .preferences .compact-label > span { left: 22px; font-size: 8px; }
  .topbar .topbar-brand > .topbar-inscription:not(.tiki-detail-icon) { font-size: clamp(18px, 4.8vw, 23px); line-height: 1.2; letter-spacing: .045em; }
  .topbar .account-actions {
    grid-column: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 0;
  }
  .topbar .account-actions .text-button {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 58px;
    padding: 9px 21px 8px;
    font-size: 12px;
    line-height: 1.4;
  }
}
@media (forced-colors: active) {
  .topbar .topbar-brand { color: LinkText; text-shadow: none; background: Canvas; border: 1px solid LinkText; }
  .topbar .topbar-brand > .topbar-inscription:not(.tiki-detail-icon) { color: LinkText; text-shadow: none; }
  .topbar .preferences select,
  .topbar .preferences select:is(:hover, :focus-visible),
  .topbar .account-actions .text-button,
  .topbar .account-actions .text-button:is(:hover, :focus-visible),
  html[data-bar-state="closed"] .topbar .preferences select,
  html[data-bar-state="closed"] .topbar .account-actions .text-button {
    background: ButtonFace;
    color: ButtonText;
    border: 2px solid ButtonText;
    text-shadow: none;
    box-shadow: none;
  }
  .topbar .preferences .compact-label > span { color: ButtonText; text-shadow: none; }
  .topbar .preferences .compact-label::before, .topbar .preferences .compact-label::after,
  .topbar .account-actions .text-button::before, .topbar .account-actions .text-button::after { display: none; }
  .topbar :is(a, button, select):focus-visible { outline-color: Highlight; }
}
