:root {
  --ink: #172033;
  --muted: #667085;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --line: #dfe5ee;
  --brand: #6d45e8;
  --brand-dark: #4e2db8;
  --accent: #f5b942;
  --danger: #b42318;
  --success: #027a48;
  --shadow: 0 18px 50px rgb(23 32 51 / 9%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(180deg, #fbfcff 0, #f5f7fb 100%);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--brand-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--brand);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

h2,
h3 {
  letter-spacing: -0.025em;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  background: rgb(255 255 255 / 88%);
  border-bottom: 1px solid rgb(223 229 238 / 85%);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.navbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  min-height: 72px;
  padding: 0 1.5rem;
}

.brand {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand::before {
  background: var(--brand);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 0.7rem;
  margin-right: 0.55rem;
  width: 0.7rem;
}

.nav-links {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-links form {
  margin: 0;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 3.5rem 1.5rem 5rem;
}

.flash {
  border: 1px solid;
  border-radius: 0.75rem;
  margin: 1rem auto 0;
  max-width: 1132px;
  padding: 0.8rem 1rem;
}

.alert,
.error {
  color: var(--danger);
}

.alert {
  background: #fff1f0;
  border-color: #fecdca;
}

.notice {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--success);
}

.button,
button,
input[type="submit"] {
  align-items: center;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 0.7rem;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: white;
  transform: translateY(-1px);
}

.button--small {
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
}

.button--quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
}

.button--quiet:hover {
  color: white;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]),
select,
textarea,
trix-editor {
  background: white;
  border: 1px solid #cfd7e3;
  border-radius: 0.65rem;
  font: inherit;
  margin: 0.3rem 0 1rem;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  width: min(100%, 38rem);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(109 69 232 / 28%);
  outline-offset: 2px;
}

.page-header {
  margin-bottom: 2.5rem;
  max-width: 46rem;
}

.page-header p:last-child {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.eyebrow {
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
}

.product-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.product-card,
.card,
.review {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.product-card {
  overflow: hidden;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.product-card:hover {
  box-shadow: 0 22px 55px rgb(23 32 51 / 14%);
  transform: translateY(-3px);
}

.product-card__image {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e8e2ff, #d8f3ff);
  display: flex;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
}

.product-card__image img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.product-card__image span,
.product-gallery__placeholder span {
  color: rgb(78 45 184 / 38%);
  font-size: clamp(5rem, 12vw, 8rem);
  font-weight: 900;
}

.product-card__body {
  padding: 1.25rem;
}

.product-card__body h2 {
  font-size: 1.2rem;
  margin-bottom: 0.55rem;
}

.product-card__body h2 a {
  color: var(--ink);
  text-decoration: none;
}

.product-card__body p:last-child {
  color: var(--muted);
  margin-bottom: 0;
}

.back-link {
  margin-bottom: 1.5rem;
}

.back-link a {
  font-weight: 700;
  text-decoration: none;
}

.product-detail {
  align-items: start;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1.15fr) minmax(20rem, 0.85fr);
}

.product-gallery {
  min-width: 0;
}

.carousel,
.product-gallery__placeholder {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e8e2ff, #d8f3ff);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.carousel__slide {
  height: 100%;
  margin: 0;
}

.carousel__slide[hidden] {
  display: none;
}

.carousel__slide img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.product-gallery__placeholder {
  align-items: center;
  display: flex;
  justify-content: center;
}

.carousel__controls {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.carousel__button {
  border-radius: 50%;
  font-size: 1.2rem;
  height: 2.8rem;
  padding: 0;
  width: 2.8rem;
}

.carousel__status {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 3.5rem;
  text-align: center;
}

.product-info {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  position: sticky;
  top: 6rem;
}

.product-info h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.product-description {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.4rem;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.rating {
  display: flex;
}

.rating label,
.gray {
  color: #d0d5dd;
}

.gold {
  color: var(--accent);
}

.rating input:is(:checked, :focus) + label,
.rating label:has(~ input:is(:checked, :focus)),
.rating label:hover,
.rating label:has(~ input + label:hover) {
  color: var(--accent);
}

.rating input:focus-visible + label {
  outline: 0.2em solid;
  outline-offset: 2px;
}

section.reviews {
  display: grid;
  gap: 2rem;
  grid-template-columns: 260px 1fr;
  margin-top: 4rem;
}

section.reviews > aside {
  align-self: start;
  background: #eeebff;
  border-radius: 1.25rem;
  padding: 1.5rem;
}

.review__summary,
.review__summary > div {
  align-items: center;
  display: flex;
  margin-top: 0.35rem;
  width: 100%;
}

.review__stars {
  width: 1rem;
}

.review__bars {
  display: flex;
  flex: 1;
  margin: 0 5px;
  position: relative;
}

.review__bar--background {
  background: #d8d4e8;
  border-radius: 15px;
  flex: 1;
  height: 10px;
}

.review__bar {
  background: var(--accent);
  border-radius: 15px;
  inset-block: 0;
  position: absolute;
}

.review__percentage {
  text-align: right;
  width: 2.5rem;
}

.reviews__list {
  display: grid;
  gap: 1rem;
}

.reviews__limit {
  background: #fff8e7;
  border: 1px solid #f9db95;
  border-radius: 0.8rem;
  color: #7a5012;
  margin-bottom: 0;
  padding: 0.8rem 1rem;
}

.review {
  padding: 1.35rem;
}

.review__images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1em;
}

.review__images img {
  border-radius: 0.6rem;
}

table {
  background: white;
  border-collapse: collapse;
  border-radius: 0.8rem;
  overflow: hidden;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem;
  text-align: left;
}

.portal-header {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.portal-header > div,
.portal-header > p {
  max-width: 44rem;
}

.portal-header h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 0.75rem;
}

.portal-header p:last-child {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.portal-header--admin {
  background: linear-gradient(135deg, #21143f, #4e2db8);
  border-radius: 1.35rem;
  color: white;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.portal-header--admin .eyebrow,
.portal-header--admin p:last-child {
  color: #dcd3ff;
}

.portal-header--admin .button--quiet {
  border-color: rgb(255 255 255 / 35%);
  color: white;
  flex: 0 0 auto;
}

.portal-shell {
  align-items: start;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 220px minmax(0, 1fr);
}

.portal-sidebar {
  background: white;
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.35rem;
  padding: 0.65rem;
  position: sticky;
  top: 6rem;
}

.portal-sidebar a {
  border-radius: 0.65rem;
  color: var(--ink);
  font-weight: 700;
  padding: 0.75rem 0.85rem;
  text-decoration: none;
}

.portal-sidebar a:hover {
  background: var(--surface-soft);
  color: var(--brand-dark);
}

.portal-sidebar--admin {
  background: #21143f;
  border-color: #21143f;
}

.portal-sidebar--admin a {
  color: #f5f1ff;
}

.portal-sidebar--admin a:hover {
  background: #392563;
  color: white;
}

.portal-content {
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 2.25rem);
}

.portal-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.admin-content > h1:first-child {
  margin-bottom: 1.5rem;
}

.admin-content #products,
.admin-content > .review,
.admin-content > div:not(.trix-content) {
  border-bottom: 1px solid var(--line);
  padding-block: 0.75rem;
}

@media (max-width: 820px) {
  .navbar {
    align-items: flex-start;
    gap: 0.8rem;
    padding-block: 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .product-detail,
  section.reviews,
  .portal-shell {
    grid-template-columns: 1fr;
  }

  .product-info {
    position: static;
  }

  .portal-header {
    align-items: start;
    flex-direction: column;
    gap: 1.25rem;
  }

  .portal-sidebar {
    display: flex;
    overflow-x: auto;
    position: static;
  }

  .portal-sidebar a {
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  main {
    padding: 2rem 1rem 4rem;
  }

  .navbar {
    padding-inline: 1rem;
  }

  .nav-links {
    gap: 0.65rem;
  }

  .nav-links a {
    font-size: 0.82rem;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}
