/* Ψηφιακό Μουσείο — Layout, Responsive & Interactive States
   Συμπληρώνει τα tokens.css και components.css (χωρίς kit.css) */

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Font size overrides from ♿ panel */
body.fs-sm {
  --fs-display: 25px;
  --fs-h1: 21px;
  --fs-h2: 18px;
  --fs-h3: 16px;
  --fs-body: 14px;
  --fs-small: 13px;
  --fs-caption: 11px;
}

body.fs-lg {
  --fs-display: 32px;
  --fs-h1: 28px;
  --fs-h2: 23px;
  --fs-h3: 19px;
  --fs-body: 19px;
  --fs-small: 16px;
  --fs-caption: 14px;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font: 700 var(--fs-small)/1 var(--font-sans);
  text-decoration: none;
}
.skip-link:focus {
  left: 12px;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* App Shell (Mobile-first 375px, responsive upwards) */
.app-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  position: relative;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0 var(--space-sm);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottomnav-h) + 96px);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
}

.bottomnav .nav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  height: 100%;
}

/* Reset outer bottomnav grid when wrapping .nav-inner */
.bottomnav.has-inner {
  display: block;
}

.sticky-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottomnav-h);
  z-index: 35;
}

.sticky-bottom-bar .action-bar {
  max-width: 480px;
  margin: 0 auto;
}

/* Interactive enhancements over static kit */
.btn,
.icon-btn,
.chip,
.cat-tile,
.exhibit-row,
.route-card,
.switch,
.seg button,
.toast .undo,
.more {
  transition: transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    filter var(--dur-fast) var(--ease-out);
}

.btn:active,
.icon-btn:active {
  transform: scale(0.98);
}

.btn:active {
  filter: brightness(0.9);
}

.btn.ghost:active {
  background: var(--accent-soft);
  filter: none;
}

button {
  font-family: inherit;
}

.chip {
  min-height: 40px;
  cursor: pointer;
}

.chip:focus-visible,
.cat-tile:focus-visible,
.exhibit-row-link:focus-visible,
.bottomnav a:focus-visible,
.switch:focus-visible,
.seg button:focus-visible,
.toast .undo:focus-visible,
.more:focus-visible,
.player button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Search input inside .search */
.search {
  position: relative;
}

.search input[type="search"],
.search input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: 400 var(--fs-body)/1.3 var(--font-sans);
  outline: none;
}

.search input::placeholder {
  color: var(--text-secondary);
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}

/* Images inside .thumb and .cat-tile */
.thumb {
  position: relative;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-tile {
  border: 0;
  text-align: left;
  cursor: pointer;
  padding: 0;
  min-height: 112px;
}

.cat-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cat-tile .cat-label {
  position: relative;
  z-index: 2;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
}

.cat-tile::before {
  z-index: 1;
}

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.tiles-grid .cat-tile:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.routes-grid,
.exhibits-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.exhibit-row {
  width: 100%;
}

.exhibit-row-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  min-height: var(--target-min);
}

/* Exhibit detail page */
.exhibit-hero {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 240px;
}

.exhibit-hero .zoom-trigger {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-sm);
  background: rgba(18, 19, 22, 0.72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-full);
  min-height: var(--target-min);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 var(--fs-small)/1 var(--font-sans);
  cursor: pointer;
}

.more {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  align-self: flex-start;
}

.exhibit-full-text {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}

/* Accessibility Sheet & Overlays */
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.backdrop[hidden] {
  display: none;
}

.sheet,
.voice {
  width: 100%;
  max-width: 480px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.sheet-header h3 {
  margin: 0;
}

.switch {
  border: 0;
  cursor: pointer;
  padding: 0;
}

.switch::after {
  transition: left var(--dur-fast) var(--ease-out);
}

.seg button {
  min-width: var(--target-min);
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font: 700 var(--fs-small) var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
}

.seg button + button {
  border-left: 1.5px solid var(--border-strong);
}

.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* Voice controls */
.voice-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-sm);
}

/* Mini TTS Player */
.player-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottomnav-h) + 8px);
  z-index: 45;
  padding: 0 var(--space-lg);
  pointer-events: none;
}

.player-wrap.above-action-bar {
  bottom: calc(var(--bottomnav-h) + 80px);
}

.player-wrap .player {
  max-width: 448px;
  margin: 0 auto;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
}

.player .pp,
.player .speed,
.player .close-player {
  border: 0;
  cursor: pointer;
}

.player .speed {
  background: transparent;
  color: var(--text-inverse);
}

.player .close-player {
  width: var(--target-min);
  height: var(--target-min);
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-inverse);
  border-radius: var(--radius-full);
}

/* Toast container */
.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottomnav-h) + 12px);
  z-index: 70;
  padding: 0 var(--space-lg);
  pointer-events: none;
}

.toast-wrap.above-action-bar {
  bottom: calc(var(--bottomnav-h) + 84px);
}

.toast-wrap .toast {
  max-width: 448px;
  margin: 0 auto;
  pointer-events: auto;
}

.toast .undo {
  cursor: pointer;
}

/* Offline / Status banner */
.status-banner-wrap {
  width: 100%;
  max-width: 480px;
  margin: var(--space-sm) auto 0;
  padding: 0 var(--space-lg);
}

/* Zoom Modal */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(12, 14, 16, 0.94);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.zoom-modal[hidden] {
  display: none;
}

.zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  gap: var(--space-sm);
}

.zoom-toolbar .icon-btn,
.zoom-toolbar .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.zoom-stage {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: var(--space-lg);
}

.zoom-stage img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-md);
  transform-origin: center center;
  transition: transform var(--dur-base) var(--ease-out);
}

.zoom-caption {
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  font: 500 var(--fs-small)/1.4 var(--font-sans);
  color: rgba(255, 255, 255, 0.85);
}

/* Skeleton pulse animation (respects reduced motion) */
@keyframes skel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.skel {
  animation: skel-pulse 1.2s ease-in-out infinite;
}

body.rm .skel {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .skel {
    animation: none;
  }
}

/* Responsive upwards: Tablet & Desktop */
@media (min-width: 768px) {
  .app-main {
    max-width: 760px;
    padding: var(--space-xl);
    padding-bottom: calc(var(--bottomnav-h) + 96px);
  }

  .status-banner-wrap {
    max-width: 760px;
    padding: 0 var(--space-xl);
  }

  .sticky-bottom-bar .action-bar {
    max-width: 760px;
    border-left: 1px solid var(--border-default);
    border-right: 1px solid var(--border-default);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
  }

  .tiles-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .tiles-grid .cat-tile:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .routes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .exhibit-hero {
    height: 360px;
  }
}

@media (min-width: 1024px) {
  .app-main {
    max-width: 960px;
  }

  .status-banner-wrap {
    max-width: 960px;
  }

  .sticky-bottom-bar .action-bar {
    max-width: 960px;
  }
}
