@font-face {
  font-family: "InstaCard Script";
  src: url("assets/segoesc.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: #f7fbf4;
  color: #17351f;
}

[hidden] {
  display: none !important;
}

.gateway-page {
  min-height: 100vh;
  padding: 24px 24px 36px;
}

.gateway-hero,
.project-grid {
  width: min(980px, 100%);
  margin: 0 auto;
}

.gateway-hero {
  display: flex;
  justify-content: center;
  padding: 8px 0 8px;
}

.gateway-kicker,
.project-label {
  margin: 0 0 8px;
  font-family: "Courier New", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #4f714c;
}

.gateway-hero h1 {
  margin: 0;
  font-family: "Courier New", Consolas, "Liberation Mono", monospace;
  font-size: clamp(3.2rem, 11vw, 7rem);
  line-height: 0.95;
  color: #1d4f31;
}

.gateway-logo {
  display: block;
  width: min(600px, 100%);
  height: auto;
}

.gateway-description {
  max-width: 560px;
  margin: 18px 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.45;
  color: #35563d;
}

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

.project-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 22px;
  background: #ffffff;
  border: 1px solid #c8d8c8;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(29, 79, 49, 0.1);
}

.project-card-featured {
  background: #ffffff;
  border-color: #9fbf9b;
}

.project-card h2 {
  margin: 0;
  color: #17351f;
  font-size: 1.7rem;
}

.project-card p:not(.project-label) {
  margin: 10px 0 0;
  color: #48624c;
  line-height: 1.45;
}

.project-action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  color: #ffffff;
  background: #1d4f31;
  border: 1px solid #1d4f31;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.project-action:hover,
.project-action:focus-visible {
  background: #143c24;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.top-bar {
  width: 100%;
}

.top-bar h1 {
  margin: 0;
}

.instacard-brand {
  display: flex;
  align-items: center;
}

.instacard-logo {
  display: block;
  width: min(220px, 42vw);
  height: auto;
}

.asset-gallery {
  width: 100%;
  margin-top: 20px;
}

body.card-view-active .asset-gallery {
  display: none;
}

.card-picker {
  display: grid;
  gap: 12px;
}

.asset-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.asset-thumb {
  display: block;
  padding: 0;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.asset-thumb:hover,
.asset-thumb:focus-visible,
.asset-thumb.is-selected {
  border-color: #1d4f31;
}

.asset-thumb img {
  display: block;
  width: min(22vw, 180px);
  height: auto;
}

.preview-page {
  display: none;
  width: min(1100px, 100%);
  margin: 8px auto 0;
}

body.card-view-active .preview-page {
  display: block;
}

.preview-sheet {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  container-type: inline-size;
  aspect-ratio: 11 / 8.5;
  width: min(100%, calc((100vh - 190px) * 11 / 8.5));
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #d3d3d3;
  box-shadow: 0 12px 28px rgba(29, 79, 49, 0.14);
}

.preview-sheet::before,
.preview-sheet::after {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.preview-sheet::before {
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px dashed #696969;
}

.preview-sheet::after {
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px dashed #696969;
}

.preview-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.preview-panel:nth-child(1),
.preview-panel:nth-child(3) {
  border-right: 1px solid #d3d3d3;
}

.preview-panel:nth-child(1),
.preview-panel:nth-child(2) {
  border-bottom: 1px solid #d3d3d3;
}

.selected-card-image {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-panel:nth-child(1) > *,
.preview-panel:nth-child(2) > * {
  transform: rotate(180deg);
}

.brand-panel img {
  width: 60%;
  height: 45%;
  object-fit: contain;
}

.placeholder-panel,
.message-panel {
  text-align: center;
  color: #000000;
}

.placeholder-panel {
  padding: clamp(28px, 9cqw, 54px);
}

.note-lines {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: space-between;
  padding: clamp(18px, 3cqw, 28px) 0;
}

.note-lines span {
  display: block;
  width: 100%;
  border-top: 1px solid #b9b9b9;
}

.message-panel {
  position: relative;
  font-family: var(--inside-message-font-family, "InstaCard Script", "Segoe Script", "Lucida Handwriting", Arial, sans-serif);
  font-size: var(--inside-message-font-size, 20px);
  line-height: var(--inside-message-line-height, 1.35);
  font-weight: 400;
  white-space: pre-wrap;
}

.placeholder-panel p,
.message-panel p {
  margin: 0;
  max-width: calc(100% - 72px);
}

.message-panel h2 {
  position: absolute;
  top: var(--inside-message-center-y, 50%);
  left: var(--inside-message-center-x, 50%);
  width: var(--inside-message-box-width, calc(100% - 72px));
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: none;
  font: inherit;
}

.message-panel p {
  display: none;
}

.message-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.message-controls label {
  display: grid;
  gap: 4px;
  color: #1d4f31;
  font-size: 0.9rem;
  text-align: left;
}

.message-controls input {
  width: 160px;
  padding: 8px 10px;
  border: 1px solid #9fb5a5;
  border-radius: 6px;
  font: inherit;
}

.preview-action,
.choose-card {
  display: inline-block;
  margin: 14px 6px 0;
  padding: 10px 14px;
  color: #1d4f31;
  background: #ffffff;
  border: 1px solid #9fb5a5;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.download-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: #1d4f31;
  font-size: 0.95rem;
  text-align: center;
}

.preview-page {
  text-align: center;
}

.preview-action:hover,
.preview-action:focus-visible,
.choose-card:hover,
.choose-card:focus-visible {
  background: #eef7ea;
}

@media (max-width: 640px) {
  .gateway-page {
    padding: 28px 18px;
  }

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

  .instacard-logo {
    width: min(180px, 60vw);
  }

  .asset-row {
    flex-wrap: wrap;
  }

  .message-controls {
    flex-direction: column;
    align-items: center;
  }

  .asset-thumb img {
    width: min(38vw, 160px);
  }

  .preview-panel {
    padding: 10px;
  }
}
