/*
  Tab 04 — Master/Detail Navigation Tabs — standalone HTML/CSS/JS
  implementation. No build step, no framework, no external dependency:
  copy index.html, this file, and script.js into any project as-is.
*/

:root {
  --card-accent: #39ff14;
  --card-fg: oklch(0.145 0 0);
  --card-muted: oklch(0.5 0 0);
  --card-border: oklch(0.9 0 0);
}

.master-tabs {
  container-type: inline-size;
  width: 100%;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.master-tabs__layout {
  display: flex;
  flex-direction: column;
}

.master-tabs__list {
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  overflow-x: auto;
}

.master-tabs__indicator {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 2px;
  border-radius: 9999px;
  background-color: var(--card-fg);
  pointer-events: none;
  transition-property: transform, width, height;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
}

.master-tabs__tab {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  gap: 0.125rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background-color 200ms ease-out;
}

.master-tabs__tab:hover {
  background-color: oklch(0.98 0 0 / 70%);
}

.master-tabs__tab--active {
  background-color: oklch(0.98 0 0);
}

.master-tabs__tab:focus-visible {
  outline: 2px solid var(--card-accent);
  outline-offset: 2px;
}

.master-tabs__label {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--card-muted);
  transition: color 200ms ease-out;
}

.master-tabs__tab--active .master-tabs__label {
  color: var(--card-fg);
}

.master-tabs__meta {
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--card-muted);
}

.master-tabs__content {
  min-width: 0;
  border-top: 1px solid var(--card-border);
  padding-top: 1.25rem;
}

.master-tabs__panel {
  animation: master-tabs-panel-in 220ms ease-out both;
}

.master-tabs__panel h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--card-fg);
}

.master-tabs__panel p {
  margin: 0.375rem 0 0;
  max-width: 28rem;
  font-size: 0.875rem;
  color: var(--card-muted);
}

@keyframes master-tabs-panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Transforms into a vertical rail once the container has room — matches
   the React version's `@lg:` container-query breakpoint (32rem). */
@container (min-width: 32rem) {
  .master-tabs__layout {
    flex-direction: row;
    gap: 2rem;
  }

  .master-tabs__list {
    flex-direction: column;
    width: 14rem;
    flex-shrink: 0;
    gap: 0.125rem;
    overflow: visible;
  }

  .master-tabs__content {
    border-top: none;
    padding-top: 0;
  }
}

/* Metadata recedes at the narrowest container widths so the label stays
   primary in the compact horizontal scroller. */
@container (max-width: 22rem) {
  .master-tabs__meta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .master-tabs__indicator {
    transition: none;
  }

  .master-tabs__panel {
    animation: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.tab04-layout {
  display: flex;
  min-height: 20rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 2.5rem;
}
.tab04-layout__panel {
  width: 100%;
  max-width: 36rem;
  border: 1px solid oklch(0.9 0 0);
  border-radius: 1rem;
  background: #fff;
  padding: 1.5rem;
}
