/*
 * Website style atlas: product chrome only.
 * The 54 examples live inside isolated iframes and keep their own design.
 * Catalog controls compose ui.css primitives; layout stays page-specific.
 */

/* Hero ------------------------------------------------------------------- */

.wg-page { padding-bottom: 45px; }

.wg-hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 55px;
  padding-top: 90px;
  padding-bottom: 70px;
  align-items: center;
  max-width: 1440px;
}

.wg-hero h1 {
  margin: 25px 0 28px;
}

.wg-hero-meta {
  display: flex;
  gap: 18px;
  margin-top: 30px;
}

.wg-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  transform: rotate(-3deg);
}

.wg-feature {
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.1 / 1;
  text-decoration: none !important;
  transition: transform var(--motion-switch) var(--motion-ease-switch), box-shadow var(--motion-switch) var(--motion-ease-switch);
}

.wg-feature > span {
  font-family: var(--font-mono);
  font-size: var(--type-eyebrow-size);
  letter-spacing: 0.05em;
}

.wg-feature > strong {
  font-size: 95px;
  line-height: 1.1;
  letter-spacing: -0.08em;
  flex: 1;
  display: flex;
  align-items: center;
}

.wg-feature > p {
  font-size: var(--type-small-size);
}

.wg-feature-swiss {
  background: #eeeee7;
  border-top: 6px solid #df3a2e;
  color: #1d1d1f;
  box-shadow: 0 12px 30px #00000006;
  transform: translateY(35px);
}

.wg-feature-swiss > strong { font-weight: 500; }

.wg-feature-bauhaus {
  background: #e1d5b6;
  color: #d73426;
  border-radius: 50% 50% 0 0;
  transform: rotate(8deg);
}

.wg-feature-bauhaus > span {
  margin-top: 16px;
  text-align: center;
  color: #282b31;
}

.wg-feature-bauhaus > strong {
  justify-content: center;
  font-size: 112px;
  transform: rotate(-30deg);
}

.wg-feature-bauhaus > p { color: #282b31; }

.wg-feature-neo-brutalist {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  min-height: 115px;
  background: #c6eaa2;
  color: #1d1d1f;
  border: 2px solid #1d1d1f;
  box-shadow: 5px 5px #1d1d1f;
  border-radius: var(--r-xs);
  transform: translateX(20px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.wg-feature-neo-brutalist > strong {
  grid-column: 2;
  grid-row: 1 / 3;
  line-height: 0.8;
  font-size: 85px;
}

.wg-feature-neo-brutalist > p {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Catalog ---------------------------------------------------------------- */

.wg-catalog { max-width: 1440px; }

.wg-tools {
  padding: 24px 0 30px;
  border-top: 1px solid var(--line);
  margin-bottom: 4px;
}

.wg-search-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.wg-result-heading {
  margin-right: auto;
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.wg-search {
  width: 300px;
  max-width: 100%;
}

.wg-purpose {
  width: auto;
  min-width: 140px;
}

.wg-groups {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.wg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.wg-card {
  position: relative;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 520px;
}

.wg-card-link {
  display: block;
  color: inherit;
  text-decoration: none !important;
}

.wg-preview {
  aspect-ratio: 1.46 / 1;
  position: relative;
  overflow: hidden;
  background: #ededef;
  --wg-scale: .3;
  pointer-events: none;
  border-bottom: 1px solid var(--line);
}

.wg-preview > .wc-scene {
  width: 1200px;
  height: 840px;
  min-height: 840px;
  transform: scale(var(--wg-scale));
  transform-origin: 0 0;
  contain: layout paint style;
  overflow: hidden;
}

.wg-card-copy { padding: 22px 24px 24px; }

.wg-card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  color: var(--ink-3);
  font-size: var(--type-meta-size);
  line-height: var(--type-meta-leading);
}

.wg-card-meta > span:last-child {
  font-family: var(--font-mono);
}

.wg-card-copy h3 {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.wg-card-copy h3 > span {
  font-size: var(--type-card-size);
  color: var(--ink-3);
  transition: transform var(--motion-switch) var(--motion-ease-switch), color var(--motion-switch) var(--motion-ease-switch);
}

.wg-english {
  min-height: 16px;
  line-height: 1.5;
}

.wg-tagline {
  font-size: var(--type-small-size);
  color: var(--ink-2);
  line-height: 1.8;
  margin-top: 13px;
  min-height: 22px;
}

.wg-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.wg-save {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
  background: var(--surface-translucent);
  color: #444;
  font-size: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wg-save[aria-pressed="true"] {
  color: #cd4b50;
  background: var(--surface);
}

.wg-empty {
  padding: 90px 0;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.wg-empty > span {
  font-size: 50px;
  color: var(--ink-3);
}

.wg-empty h3 { font-size: var(--type-section-size); }

.wg-empty p {
  font-size: var(--type-small-size);
  color: var(--ink-2);
}

.wg-footnote {
  max-width: 1440px;
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 50px;
  font-size: var(--type-meta-size);
  color: var(--ink-3);
}

.wg-footnote p { max-width: 67em; }
.wg-footnote a { white-space: nowrap; }

/* Example host ----------------------------------------------------------- */

.wg-example-page {
  min-width: 1100px;
  padding: 0 24px 24px;
}

.wg-example-toolbar {
  min-height: 88px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.wg-catalog-back { justify-self: start; }

.wg-example-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wg-style-select {
  width: auto;
  font-weight: 600;
  max-width: 260px;
}

.wg-toolbar-actions {
  justify-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
}

.wg-frame-state {
  font-family: var(--font-mono);
  font-size: var(--type-eyebrow-size);
  color: var(--ink-3);
  white-space: nowrap;
}

.wg-frame-state[data-ready="true"] { color: #28613e; }

.wg-example-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--type-meta-size);
  color: var(--ink-3);
  padding: 0 4px 12px;
}

.wg-example-info > span { font-family: var(--font-mono); }

.wg-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.wg-example-frame {
  display: block;
  width: 100%;
  height: calc(100dvh - 200px);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* Inspector -------------------------------------------------------------- */

.wg-inspector {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 370px;
  max-height: calc(100% - 28px);
  overflow: auto;
  background: var(--surface-translucent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 25px;
  box-shadow: var(--shadow-lift);
  overscroll-behavior: contain;
}

.wg-inspector-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
}

.wg-inspector h2 {
  font-size: var(--type-section-size);
  line-height: var(--type-section-leading);
  letter-spacing: var(--type-section-tracking);
  outline: none;
}

.wg-inspector-en {
  margin: 7px 0 18px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--type-meta-size);
  line-height: var(--type-meta-leading);
}

.wg-inspector-tagline {
  font-size: var(--type-small-size);
  line-height: 1.8;
}

.wg-palette {
  display: flex;
  gap: 12px;
  margin: 25px 0;
}

.wg-palette > div { flex: 1; }

.wg-palette span {
  display: block;
  height: 38px;
  border-radius: var(--r-xs);
  border: 1px solid #00000008;
  margin-bottom: 7px;
}

.wg-palette code {
  font-size: var(--type-meta-size);
  color: var(--ink-3);
}

.wg-breakdown > div {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.wg-breakdown dt {
  font-size: var(--type-meta-size);
  font-weight: 600;
  margin-bottom: 10px;
}

.wg-breakdown dd {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--type-small-size);
  line-height: 1.8;
}

.wg-reference {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.wg-reference a {
  display: block;
  font-size: var(--type-small-size);
  line-height: 1.7;
  margin: 14px 0;
}

.wg-reference > p:last-child {
  font-size: var(--type-meta-size);
  color: var(--ink-3);
  line-height: 1.8;
}

.wg-related {
  display: block;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 25px;
  font-size: var(--type-small-size);
}

/* Remaining catalog copy ------------------------------------------------ */

.wg-experience {
  font-size: var(--type-meta-size);
  line-height: 1.7;
  color: var(--ink-2);
  margin: 10px 0 0;
}

.wg-routes { padding-top: 0; padding-bottom: 50px; }

.wg-routes > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.wg-routes a {
  padding: 12px 17px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-size: var(--type-small-size);
  background: var(--surface);
  text-decoration: none;
}

.wg-routes a:hover { border-color: var(--ink-2); }

.wg-edition-brief {
  border: 1px solid var(--line);
  padding: 20px;
  margin: 22px 0;
  background: var(--bg);
  border-radius: var(--r-xs);
}

.wg-edition-brief h3 {
  font-size: var(--type-meta-size);
  margin: 18px 0 9px;
}

.wg-edition-brief p {
  font-size: var(--type-small-size);
  line-height: 1.9;
}

.wg-edition-brief a {
  display: block;
  font-size: var(--type-small-size);
  margin-top: 20px;
}

/* Hover and motion preference ------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
  .wg-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lift);
  }

  .wg-card:hover h3 > span {
    transform: translate(2px, -2px);
    color: var(--ink);
  }

  .wg-card:hover .wc-preview .wc-art svg {
    transform: translateY(-6px) rotate(-2deg) scale(1.025);
  }

  .wg-feature:hover { box-shadow: 0 20px 40px #0001; }
  .wg-feature-swiss:hover { transform: translateY(25px); }
  .wg-feature-bauhaus:hover { transform: rotate(3deg) translateY(-5px); }

  .wg-feature-neo-brutalist:hover {
    transform: translate(17px, -3px);
    box-shadow: 8px 8px #1d1d1f;
  }
}

:root[data-motion="reduced"] .wg-card,
:root[data-motion="reduced"] .wg-card:hover,
:root[data-motion="reduced"] .wg-feature,
:root[data-motion="reduced"] .wg-feature:hover {
  transition: none;
}

:root[data-motion="reduced"] .wg-card:hover { transform: none; }
:root[data-motion="reduced"] .wg-card:hover .wc-preview .wc-art svg { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .wg-card,
  .wg-feature,
  .wg-card h3 > span { transition: none; }
  .wg-card:hover { transform: none; }
  .wg-card:hover .wc-preview .wc-art svg { transform: none; }
}

/* Sticky host layout ----------------------------------------------------- */

.wg-example-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 45;
  background: var(--surface-header);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.wg-tools {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.wg-grid { scroll-margin-top: 240px; }

.wg-inspector {
  position: fixed;
  top: calc(var(--header-h) + 102px);
  right: 38px;
  z-index: 90;
  max-height: calc(100dvh - var(--header-h) - 126px);
}

/* The example owns its inner scroll; host chrome must not slide over its navigation. */
.site-shell:has(.wg-example-page) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.site-main:has(.wg-example-page) {
  min-height: 0;
  overflow: hidden;
}

.site-shell:has(.wg-example-page) > .site-footer { display: none; }

.wg-example-page {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}

.wg-example-toolbar,
.wg-example-info { flex-shrink: 0; }

.wg-example-page .wg-example-toolbar {
  position: relative;
  top: auto;
}

.wg-example-frame {
  height: 100%;
  min-height: 0;
}
