:root {
  --ink: #2b1a15;
  --cocoa: #4f352d;
  --coffee: #6f4a3f;
  --caramel: #d69b57;
  --cream: #fff8eb;
  --paper: #fffdf8;
  --white: #ffffff;
  --sage: #6f8c68;
  --line: #ead8bf;
  --muted: #756058;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(43, 26, 21, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(115deg, rgba(255, 248, 235, 0.98), rgba(246, 223, 189, 0.62)),
    repeating-linear-gradient(90deg, rgba(79, 53, 45, 0.035) 0 1px, transparent 1px 84px);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

img {
  display: block;
}

.templates-header {
  position: sticky;
  z-index: 20;
  top: 16px;
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 16px auto 0;
  border: 1px solid rgba(234, 216, 191, 0.9);
  border-radius: 999px;
  padding: 10px 14px 10px 22px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 18px 50px rgba(43, 26, 21, 0.11);
  backdrop-filter: blur(18px);
}

.brand img {
  width: 132px;
  height: 46px;
  object-fit: contain;
}

.templates-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--coffee);
  font-weight: 900;
}

.templates-header nav a {
  border-radius: 999px;
  padding: 11px 14px;
}

.templates-header nav a:hover {
  background: rgba(214, 155, 87, 0.12);
}

.header-locale select {
  min-height: 42px;
  border: 1px solid rgba(234, 216, 191, 0.92);
  border-radius: 999px;
  padding: 0 34px 0 12px;
  background: var(--white);
  color: var(--coffee);
  font-size: 0.86rem;
  font-weight: 900;
  outline: none;
}

.templates-header .nav-cta {
  background: var(--ink);
  color: var(--cream);
}

main {
  padding: 112px max(20px, calc((100vw - 1240px) / 2)) 80px;
}

.templates-hero {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
  align-items: end;
  gap: 28px;
  padding-bottom: 48px;
}

.templates-hero p,
.library-sidebar span,
.library-toolbar span,
.preview-panel > span {
  margin: 0 0 12px;
  color: var(--caramel);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.templates-hero h1 {
  max-width: 860px;
  margin: 0;
  font-size: 5rem;
  line-height: 0.96;
  letter-spacing: 0;
}

.templates-hero div > span {
  display: block;
  max-width: 760px;
  margin-top: 22px;
  color: var(--coffee);
  font-size: 1.14rem;
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.hero-stats div,
.library-sidebar,
.library-main,
.preview-panel,
.template-card {
  border: 1px solid rgba(234, 216, 191, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.84);
  box-shadow: 0 16px 44px rgba(43, 26, 21, 0.08);
}

.hero-stats div {
  padding: 22px;
}

.hero-stats strong {
  display: block;
  font-size: 2.55rem;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-weight: 900;
}

.library-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 430px;
  gap: 16px;
  align-items: start;
}

.library-sidebar,
.library-main,
.preview-panel {
  padding: 18px;
}

.library-sidebar {
  position: sticky;
  top: 108px;
}

.library-sidebar h2,
.library-toolbar h2 {
  margin: 0;
  font-size: 1.28rem;
}

.category-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.category-list button {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  background: transparent;
  color: var(--coffee);
  font-weight: 900;
}

.category-list button.is-active,
.category-list button:hover {
  border-color: var(--line);
  background: #fff8eb;
  color: var(--ink);
}

.library-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.library-toolbar label {
  width: min(300px, 100%);
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
}

.library-toolbar input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

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

.template-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
}

.template-card.is-active {
  border-color: var(--template-accent, var(--caramel));
  box-shadow: 0 18px 46px rgba(43, 26, 21, 0.15);
}

.template-page-preview {
  overflow: hidden;
  display: grid;
  grid-template-rows: 20px 88px auto 30px;
  height: 182px;
  border: 1px solid color-mix(in srgb, var(--template-accent, var(--caramel)) 36%, var(--line));
  border-radius: var(--radius);
  background: var(--template-paper, var(--cream));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.mini-browser {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  background: var(--template-ink, var(--ink));
}

.mini-browser i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--template-accent, var(--caramel));
}

.mini-hero {
  display: grid;
  align-content: end;
  gap: 4px;
  padding: 12px;
  background:
    linear-gradient(135deg, var(--template-ink, var(--ink)) 0 58%, var(--template-accent, var(--caramel)) 58% 78%, transparent 78%),
    var(--template-paper, var(--cream));
  color: var(--template-paper, var(--cream));
}

.mini-hero b,
.mini-hero em,
.mini-actions i {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mini-hero strong {
  max-width: 70%;
  font-size: 1rem;
  line-height: 0.98;
}

.mini-hero em {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--template-paper, var(--cream));
  color: var(--template-ink, var(--ink));
}

.mini-menu {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.mini-dish {
  min-height: 24px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(234, 216, 191, 0.72);
  border-radius: 6px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.72);
}

.mini-dish i {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--template-accent, var(--caramel)) 82%, white);
}

.mini-dish b {
  overflow: hidden;
  color: var(--template-ink, var(--ink));
  font-size: 0.64rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}

.mini-actions i {
  min-width: 0;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--template-ink, var(--ink));
  color: var(--template-paper, var(--cream));
  overflow: hidden;
  padding: 0 4px;
  font-size: 0.5rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-page-preview[data-layout="express"],
.template-page-preview[data-layout="delivery"],
.template-page-preview[data-layout="lunch"] {
  grid-template-rows: 20px auto 76px 30px;
}

.template-page-preview[data-layout="express"] .mini-menu,
.template-page-preview[data-layout="delivery"] .mini-menu,
.template-page-preview[data-layout="lunch"] .mini-menu {
  grid-row: 2;
}

.template-page-preview[data-layout="express"] .mini-hero,
.template-page-preview[data-layout="delivery"] .mini-hero,
.template-page-preview[data-layout="lunch"] .mini-hero {
  grid-row: 3;
  min-height: 76px;
}

.template-page-preview[data-layout="dark"],
.template-page-preview[data-layout="night"],
.template-page-preview[data-layout="club"] {
  background: var(--template-ink, var(--ink));
}

.template-page-preview[data-layout="dark"] .mini-menu,
.template-page-preview[data-layout="night"] .mini-menu,
.template-page-preview[data-layout="club"] .mini-menu {
  background: color-mix(in srgb, var(--template-ink, var(--ink)) 86%, black);
}

.template-page-preview[data-layout="clean"] .mini-hero,
.template-page-preview[data-layout="minimal"] .mini-hero {
  background: var(--template-paper, var(--cream));
  color: var(--template-ink, var(--ink));
}

.template-page-preview[data-layout="clean"] .mini-hero em,
.template-page-preview[data-layout="minimal"] .mini-hero em {
  background: var(--template-ink, var(--ink));
  color: var(--template-paper, var(--cream));
}

.template-page-preview[data-layout="photo"] .mini-menu,
.template-page-preview[data-layout="editorial"] .mini-menu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-page-preview[data-layout="photo"] .mini-dish,
.template-page-preview[data-layout="editorial"] .mini-dish {
  min-height: 40px;
  grid-template-columns: 1fr;
}

.template-page-preview[data-layout="family"] .mini-actions,
.template-page-preview[data-layout="loyalty"] .mini-actions,
.template-page-preview[data-layout="growth"] .mini-actions {
  background: color-mix(in srgb, var(--template-support, var(--sage)) 16%, white);
}

.template-page-preview[data-layout="chef"] .mini-hero,
.template-page-preview[data-layout="story"] .mini-hero,
.template-page-preview[data-layout="market"] .mini-hero {
  background:
    radial-gradient(circle at 76% 24%, var(--template-support, var(--sage)) 0 18%, transparent 19%),
    linear-gradient(135deg, var(--template-ink, var(--ink)) 0 62%, var(--template-accent, var(--caramel)) 62%);
}

.template-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.template-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.template-card small {
  color: var(--template-ink, var(--ink));
  font-size: 0.72rem;
  font-weight: 950;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-tags span {
  border-radius: 999px;
  padding: 6px 8px;
  background: rgba(214, 155, 87, 0.14);
  color: var(--coffee);
  font-size: 0.72rem;
  font-weight: 900;
}

.preview-panel {
  position: sticky;
  top: 108px;
}

.preview-window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--preview-paper, var(--paper));
}

.template-stage {
  overflow: hidden;
  background: var(--preview-paper, var(--paper));
}

.stage-contact,
.stage-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--preview-ink, var(--ink)) 90%, black);
  color: var(--preview-paper, var(--cream));
}

.stage-contact {
  min-height: 32px;
  padding: 0 16px;
  font-size: 0.62rem;
  font-weight: 850;
}

.stage-contact strong {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  background: var(--preview-accent, var(--caramel));
  color: var(--preview-paper, var(--cream));
  text-transform: uppercase;
}

.stage-nav {
  min-height: 58px;
  padding: 0 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: color-mix(in srgb, var(--preview-ink, var(--ink)) 78%, transparent);
}

.stage-nav strong {
  max-width: 150px;
  font-size: 0.84rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.stage-nav nav {
  display: flex;
  gap: 14px;
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.stage-hero {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--preview-ink, var(--ink));
  color: white;
}

.stage-food-art {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 68% 64%, color-mix(in srgb, var(--preview-support, var(--sage)) 78%, white) 0 8%, transparent 9%),
    radial-gradient(circle at 52% 60%, #fff2bc 0 15%, transparent 16%),
    radial-gradient(circle at 78% 62%, #c93a2d 0 9%, transparent 10%),
    linear-gradient(140deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.34)),
    linear-gradient(120deg, color-mix(in srgb, var(--preview-accent, var(--caramel)) 76%, #ff5f24), color-mix(in srgb, var(--preview-ink, var(--ink)) 76%, #6b0000));
  filter: saturate(1.12);
}

.stage-food-art::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 12%;
  bottom: 7%;
  height: 46%;
  border-radius: 999px 999px 38px 38px;
  background:
    radial-gradient(circle at 40% 45%, #f8eeb7 0 10%, transparent 11%),
    radial-gradient(circle at 60% 45%, #f8eeb7 0 10%, transparent 11%),
    linear-gradient(135deg, #44261d, #15100e);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  opacity: 0.92;
}

.stage-food-art::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 18%;
  top: 20%;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(-18deg);
}

.stage-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 330px;
  padding: 22px;
  text-align: center;
}

.stage-hero-copy em {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-style: italic;
  line-height: 1;
}

.stage-hero-copy h3 {
  margin: 0;
  color: white;
  font-size: 2.1rem;
  line-height: 0.95;
  text-transform: uppercase;
}

.stage-hero-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  line-height: 1.45;
}

.stage-hero-copy button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 0;
  padding: 0 22px;
  background: transparent;
  color: white;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stage-menu {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.stage-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px 0;
}

.stage-sections span {
  border: 1px solid color-mix(in srgb, var(--preview-accent, var(--caramel)) 45%, white);
  border-radius: 999px;
  padding: 6px 8px;
  color: var(--preview-ink, var(--ink));
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.stage-menu div {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 950;
}

.stage-menu span {
  overflow: hidden;
  color: var(--preview-accent, var(--caramel));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-menu b {
  color: var(--preview-ink, var(--ink));
  white-space: nowrap;
}

.template-stage[data-stage-layout="clean"] .stage-contact,
.template-stage[data-stage-layout="minimal"] .stage-contact {
  display: none;
}

.template-stage[data-stage-layout="clean"] .stage-nav,
.template-stage[data-stage-layout="minimal"] .stage-nav {
  background: var(--preview-paper, var(--paper));
  color: var(--preview-ink, var(--ink));
}

.template-stage[data-stage-layout="express"] .stage-hero,
.template-stage[data-stage-layout="delivery"] .stage-hero,
.template-stage[data-stage-layout="lunch"] .stage-hero {
  min-height: 220px;
}

.template-stage[data-stage-layout="photo"] .stage-menu,
.template-stage[data-stage-layout="editorial"] .stage-menu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-stage[data-stage-layout="dark"],
.template-stage[data-stage-layout="night"],
.template-stage[data-stage-layout="club"] {
  background: color-mix(in srgb, var(--preview-ink, var(--ink)) 88%, black);
}

.template-stage[data-stage-layout="dark"] .stage-menu div,
.template-stage[data-stage-layout="night"] .stage-menu div,
.template-stage[data-stage-layout="club"] .stage-menu div {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.preview-topbar {
  display: flex;
  gap: 6px;
  padding: 12px;
  background: var(--preview-ink, var(--ink));
}

.preview-topbar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--preview-accent, var(--caramel));
}

.preview-hero {
  min-height: 220px;
  padding: 24px;
  background:
    linear-gradient(140deg, var(--preview-ink, var(--ink)) 0 54%, var(--preview-accent, var(--caramel)) 54% 76%, var(--preview-paper, var(--paper)) 76%);
  color: var(--preview-paper, var(--cream));
}

.preview-hero strong {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.preview-hero h3 {
  max-width: 260px;
  margin: 50px 0 10px;
  font-size: 2rem;
  line-height: 1;
}

.preview-hero p {
  max-width: 250px;
  margin: 0;
  color: rgba(255, 248, 235, 0.78);
  line-height: 1.45;
}

.preview-menu {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.preview-menu div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.preview-menu span {
  overflow: hidden;
  color: var(--preview-accent, var(--caramel));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-menu b {
  color: var(--preview-ink, var(--ink));
  white-space: nowrap;
}

.preview-actions {
  display: grid;
  grid-template-columns: 0.85fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.preview-cta {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 950;
}

.preview-cta.secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

/* Premium flagship template library */
body {
  background:
    linear-gradient(180deg, #fffaf1 0%, #f5e6d0 46%, #fffdf8 100%),
    repeating-linear-gradient(90deg, rgba(79, 53, 45, 0.03) 0 1px, transparent 1px 92px);
}

.templates-header {
  border-color: rgba(79, 53, 45, 0.12);
  background: rgba(255, 253, 248, 0.92);
  box-shadow:
    0 24px 72px rgba(43, 26, 21, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.templates-hero {
  min-height: 500px;
  align-items: end;
  padding-top: 48px;
}

.templates-hero h1 {
  max-width: 920px;
  font-size: clamp(4.2rem, 8vw, 6.5rem);
  line-height: 0.88;
}

.hero-stats div,
.library-sidebar,
.library-main,
.preview-panel,
.template-card {
  border-color: rgba(79, 53, 45, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 250, 242, 0.94)),
    var(--paper);
  box-shadow:
    0 22px 58px rgba(43, 26, 21, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.hero-stats div:first-child {
  background:
    linear-gradient(145deg, #1a0f0c, #3c261d),
    var(--ink);
  color: var(--cream);
}

.hero-stats div:first-child span {
  color: rgba(255, 248, 235, 0.72);
}

.library-shell {
  grid-template-columns: 260px minmax(0, 1fr) 460px;
  gap: 18px;
}

.category-list button,
.library-toolbar input,
.header-locale select {
  border-color: rgba(79, 53, 45, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

.category-list button.is-active,
.category-list button:hover {
  border-color: rgba(214, 155, 87, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(246, 223, 189, 0.28)),
    #fff8eb;
}

.template-grid {
  gap: 14px;
}

.template-card {
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.template-card:hover,
.template-card.is-active {
  border-color: var(--template-accent, var(--caramel));
  box-shadow: 0 30px 76px rgba(43, 26, 21, 0.16);
  transform: translateY(-3px);
}

.template-page-preview {
  height: 214px;
  border-color: color-mix(in srgb, var(--template-accent, var(--caramel)) 46%, var(--line));
  box-shadow:
    0 16px 38px rgba(43, 26, 21, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.mini-browser {
  min-height: 24px;
}

.mini-hero {
  min-height: 104px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--template-ink, var(--ink)) 92%, black), color-mix(in srgb, var(--template-ink, var(--ink)) 58%, transparent)),
    url("https://images.unsplash.com/photo-1559339352-11d035aa65de?auto=format&fit=crop&w=700&q=78");
  background-position: center;
  background-size: cover;
}

.mini-hero strong {
  max-width: 86%;
  font-size: 1.12rem;
}

.mini-dish {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 242, 0.88)),
    rgba(255, 255, 255, 0.72);
}

.template-page-preview[data-layout="checkout"] .mini-hero,
.template-page-preview[data-layout="express"] .mini-hero,
.template-page-preview[data-layout="delivery"] .mini-hero {
  background:
    linear-gradient(135deg, var(--template-paper, var(--cream)) 0 50%, color-mix(in srgb, var(--template-accent, var(--caramel)) 86%, white) 50%),
    var(--template-paper, var(--cream));
  color: var(--template-ink, var(--ink));
}

.template-page-preview[data-layout="noir"] .mini-hero,
.template-page-preview[data-layout="dark"] .mini-hero,
.template-page-preview[data-layout="night"] .mini-hero,
.template-page-preview[data-layout="club"] .mini-hero {
  background:
    linear-gradient(90deg, rgba(10, 6, 5, 0.92), rgba(43, 26, 21, 0.58)),
    url("https://images.unsplash.com/photo-1551218808-94e220e084d2?auto=format&fit=crop&w=700&q=78");
  background-position: center;
  background-size: cover;
}

.preview-panel {
  box-shadow:
    0 30px 84px rgba(43, 26, 21, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.preview-window {
  border-color: rgba(79, 53, 45, 0.14);
  box-shadow: 0 20px 54px rgba(43, 26, 21, 0.1);
}

.preview-hero {
  background:
    linear-gradient(90deg, rgba(43, 26, 21, 0.92), rgba(43, 26, 21, 0.52)),
    url("https://images.unsplash.com/photo-1559339352-11d035aa65de?auto=format&fit=crop&w=1000&q=80");
  background-position: center;
  background-size: cover;
}

.preview-cta {
  box-shadow: 0 16px 32px rgba(43, 26, 21, 0.16);
}

:focus-visible {
  outline: 3px solid rgba(214, 155, 87, 0.52);
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .library-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .preview-panel {
    position: static;
    grid-column: 1 / -1;
  }

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

@media (max-width: 860px) {
  .templates-header {
    align-items: flex-start;
    border-radius: var(--radius);
  }

  .templates-header nav {
    display: none;
  }

  main {
    padding-top: 44px;
  }

  .templates-hero,
  .library-shell {
    grid-template-columns: 1fr;
  }

  .templates-hero h1 {
    font-size: 3rem;
  }

  .library-sidebar,
  .preview-panel {
    position: static;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  main {
    padding-inline: 16px;
  }

  .templates-hero h1 {
    font-size: 2.55rem;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .template-grid,
  .category-list {
    grid-template-columns: 1fr;
  }
}
