:root {
  --paper-edge: rgba(178, 138, 68, 0.18);
  --paper-shadow: rgba(32, 26, 21, 0.16);
}

html {
  overflow-x: hidden;
}

body {
  background-attachment: fixed;
  overflow-x: hidden;
}

input,
textarea,
button,
a {
  transition: all 160ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(178, 138, 68, 0.12);
}

.certificate-hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.14), transparent 22%),
    radial-gradient(circle at 80% 30%, rgba(255, 215, 150, 0.18), transparent 20%),
    linear-gradient(140deg, #1f1711 0%, #4c3724 48%, #927141 100%);
}

.certificate-shell {
  position: relative;
}

.certificate-shell::before {
  position: absolute;
  inset: 12px;
  border: 1px solid var(--paper-edge);
  border-radius: 22px;
  content: "";
  pointer-events: none;
}

.certificate-header {
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.16), transparent 22%),
    radial-gradient(circle at 90% 0%, rgba(255, 208, 117, 0.26), transparent 18%),
    linear-gradient(135deg, #1f1711 0%, #604529 52%, #a47f3c 100%);
}

.mobile-safe-shell {
  padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
}

.mobile-tab-bar {
  top: calc(env(safe-area-inset-top, 0px) + 0.4rem);
}

.content-panel {
  box-shadow: 0 18px 44px rgba(32, 26, 21, 0.1);
}

img {
  max-width: 100%;
}

.gallery-stage {
  position: relative;
  min-height: 240px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(178, 138, 68, 0.16), transparent 42%),
    linear-gradient(180deg, #f7f2e8 0%, #efe3cf 100%);
}

.gallery-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 260ms ease, transform 260ms ease;
  pointer-events: none;
}

.gallery-slide[data-active="true"] {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.gallery-image-shell {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
}

.gallery-image {
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 18px;
  filter: drop-shadow(0 14px 26px rgba(32, 26, 21, 0.14));
}

.gallery-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.9rem;
}

.gallery-button,
.gallery-toggle {
  min-height: 44px;
  border: 1px solid rgba(125, 97, 64, 0.18);
  border-radius: 999px;
  background: #f8f3eb;
  color: #4f3a27;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.6rem 0.95rem;
}

.gallery-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.gallery-dot {
  width: 0.72rem;
  height: 0.72rem;
  border: 0;
  border-radius: 999px;
  background: rgba(125, 97, 64, 0.26);
}

.gallery-dot[data-active="true"] {
  background: #7d6140;
  transform: scale(1.16);
}

.gallery-meta {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #7d6140;
  font-size: 0.78rem;
  line-height: 1.5;
}

.gallery-toggle[aria-pressed="true"] {
  background: #201a15;
  color: #fff;
  border-color: #201a15;
}

.social-links-panel {
  box-shadow: 0 12px 28px rgba(32, 26, 21, 0.08);
}

.social-link-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  background: #fbf8f0;
  color: #201a15;
  text-decoration: none;
}

.social-link-row:hover {
  background: #f4ecde;
}

.social-link-row__icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  border-radius: 0.2rem;
  object-fit: contain;
}

.social-link-row__name {
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-all;
}

.gallery-button:focus,
.gallery-dot:focus,
.gallery-toggle:focus,
.social-link-row:focus {
  outline: 2px solid rgba(178, 138, 68, 0.45);
  outline-offset: 2px;
}

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

@media (min-width: 768px) {
  .certificate-shell::before {
    inset: 18px;
    border-radius: 28px;
  }

  .gallery-stage {
    min-height: 320px;
  }

  .gallery-image-shell {
    padding: 1.1rem;
  }

  .social-link-row {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}
