@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/SourceSans3-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/SourceSans3-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans Pro";
  src: url("/assets/fonts/SourceSans3-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans Pro";
  src: url("/assets/fonts/SourceSans3-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cred-ink: #1a2332;
  --cred-muted: #5c6b7a;
  --cred-line: #d8dee6;
  --cred-bg: #eef2f6;
  --cred-card: #ffffff;
  --cred-accent: #0b6e4f;
  --cred-accent-soft: #e6f4ef;
  --cred-warn: #c9a227;
}

* {
  box-sizing: border-box;
}

body.cred-page {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 500px at 10% -10%, #dfe9f2 0%, transparent 55%),
    linear-gradient(180deg, #f7f9fb 0%, var(--cred-bg) 100%);
  color: var(--cred-ink);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

.cred-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--cred-line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.cred-brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--cred-ink);
}

.cred-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cred-btn {
  border: 1px solid var(--cred-line);
  background: #fff;
  color: var(--cred-ink);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cred-btn:hover {
  border-color: #b7c2cf;
  background: #f8fafc;
}

.cred-btn-primary {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #fff;
}

.cred-btn-primary:hover {
  filter: brightness(1.05);
}

.cred-layout {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 28px;
  align-items: start;
  overflow-x: hidden;
}

.cred-layout > * {
  min-width: 0;
}

.cred-loading,
.cred-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--cred-muted);
}

.cred-error {
  color: #b42318;
}

.cred-preview {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}

.cred-cert-scale {
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: hidden;
  min-height: 320px;
}

.cred-cert-sheet {
  position: absolute;
  left: 50%;
  top: 0;
  background: #fff;
  box-shadow: none;
  transform-origin: top center;
}

.cred-cert-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.cred-cert-els {
  position: absolute;
  inset: 0;
}

.cred-cert-el {
  position: absolute;
  display: flex;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.25;
  overflow: hidden;
}

.cred-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cred-card {
  background: var(--cred-card);
  border: 1px solid var(--cred-line);
  border-radius: 14px;
  padding: 18px 18px 16px;
}

.cred-card h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  line-height: 1.3;
}

.cred-card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.cred-card h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cred-muted);
}

.cred-recipient {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 14px;
}

.cred-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.cred-meta-grid strong {
  display: block;
  font-size: 0.95rem;
  margin-top: 2px;
}

.cred-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cred-accent-soft);
  color: var(--cred-accent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.cred-share {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cred-share a,
.cred-share button {
  width: 100%;
  justify-content: center;
}

.cred-share-banner {
  background: linear-gradient(145deg, #3f448c 0%, #2f3470 100%);
  border-radius: 16px;
  padding: 18px 18px 16px;
  color: #fff;
  box-shadow: 0 14px 32px rgba(47, 52, 112, 0.28);
}

.cred-share-banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cred-share-banner h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.cred-share-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
}

.cred-share-medal {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

.cred-share-icons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.cred-share-ico {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}

.cred-share-ico:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.cred-share-more {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.cred-share-more.hidden {
  display: none;
}

.cred-share-more .cred-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  justify-content: center;
}

.cred-share-more .cred-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cred-share-more .cred-link-row input {
  background: rgba(255, 255, 255, 0.95);
}

.cred-embed-api {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--cred-muted);
  word-break: break-all;
}

.cred-embed-api code {
  font-size: 11px;
  color: #1d4ed8;
}

.cred-link-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.cred-link-row input {
  flex: 1;
  border: 1px solid var(--cred-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  background: #f8fafc;
}

.cred-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.cred-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.cred-dialog-inner {
  padding: 20px;
}

.cred-dialog-inner h3 {
  margin: 0 0 8px;
}

.cred-dialog-inner textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--cred-line);
  border-radius: 8px;
  padding: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

.cred-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .cred-layout {
    grid-template-columns: 1fr;
  }

  .cred-top {
    flex-direction: column;
    align-items: stretch;
  }

  .cred-top-actions {
    justify-content: flex-start;
  }
}

@media print {
  @page {
    margin: 0;
  }

  .cred-top,
  .cred-side,
  .cred-dialog {
    display: none !important;
  }

  html,
  body.cred-page {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .cred-layout {
    display: block;
    padding: 0;
    max-width: none;
  }

  .cred-preview {
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
  }

  .cred-cert-scale {
    height: auto !important;
    width: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  /* Ekranda left:50% + translateX(-50%) scale; yazdırmada translate kalkınca
     sayfa ortasından başlayıp sağdan kesiliyordu — göreli ortala. */
  .cred-cert-sheet {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    transform: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
