*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh;
  background: #12352b;
  background-image: radial-gradient(ellipse at 50% 0%, #1b4a3c 0%, #12352b 60%);
  color: #f3eddf;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  overflow-x: hidden;
}
button, a { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #e9d38c; outline-offset: 4px; }

.viewer { max-width: 940px; margin: 0 auto; padding: 3.5rem 1.5rem 3rem; display: flex; flex-direction: column; align-items: center; gap: 2rem; }

.postcard {
  width: 100%;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  background: #f5efe2; color: #22382f;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .35);
  padding: 1.1rem;
}
.postcard.back-only { grid-template-columns: minmax(0, 1fr); max-width: 460px; }

.scene { overflow: hidden; background: #c9d7c4; }
.scene img { display: block; width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; user-select: none; }
.scene.settling img { animation: settle .9s ease-out; }
@keyframes settle {
  from { opacity: .35; transform: scale(1.04); }
  to { opacity: 1; transform: scale(1); }
}

.reverse {
  padding: .6rem 1rem .6rem 1.8rem;
  border-left: 1px solid #d6cdb8;
  margin-left: 1.1rem;
  display: flex; flex-direction: column;
}
.back-only .reverse { border-left: 0; margin-left: 0; padding: 1rem; }
.stamp-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.6rem; }
.postmark {
  margin: 0; font-size: .74rem; letter-spacing: .22em; text-transform: uppercase; color: #6f7f72;
  border: 1px solid #b7b29d; border-radius: 50%; padding: .9rem .7rem; transform: rotate(-8deg);
}
.stamp {
  width: 52px; height: 62px; flex: none;
  background:
    radial-gradient(circle at 50% 70%, #2f6b4f 0 30%, transparent 31%),
    linear-gradient(#cfe3d0, #e8f0e2);
  border: 3px dotted #f5efe2; outline: 1px solid #b7b29d;
}
.heading { margin: 0 0 .9rem; font-weight: 400; font-size: clamp(1.35rem, 2.6vw, 1.85rem); line-height: 1.2; font-style: italic; }
.caption { margin: 0 0 1.4rem; font-size: 1.02rem; line-height: 1.6; min-height: 3.2em; }
.grow {
  align-self: flex-start; background: none; border: 0; border-bottom: 1px solid #22382f;
  padding: .45rem 0; min-height: 44px; cursor: pointer; font-style: italic; font-size: 1rem;
}
.grow:hover { color: #2f6b4f; border-bottom-color: #2f6b4f; }
.home { text-underline-offset: 4px; display: inline-block; padding: .3rem 0; }

.address-lines { font-style: normal; margin-top: auto; padding-top: 1.6rem; display: flex; flex-direction: column; }
.address-lines a {
  display: block; padding: .5rem 0 .25rem; min-height: 32px;
  border-bottom: 1px solid #c9c0aa; text-decoration: none; font-size: .95rem; overflow-wrap: anywhere;
}
.write-back { font-style: italic; font-size: .85rem; color: #4a5d53; }
.address-lines a:hover { color: #2f6b4f; text-decoration: underline; text-underline-offset: 3px; }

.rack { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.card {
  background: #f5efe2; color: #22382f; border: 0; padding: 6px 6px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  transform: rotate(-2deg); transition: transform .4s ease;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
}
.card:nth-child(even) { transform: rotate(2deg); }
.card img { display: block; width: 76px; height: 76px; }
.card:hover { transform: translateY(-3px) rotate(0); }
.card[aria-pressed="true"] { outline: 2px solid #e9d38c; outline-offset: 3px; transform: translateY(-4px) rotate(0); }

@media (max-width: 720px) {
  .viewer { padding: 1.4rem 1rem 2.5rem; gap: 1.5rem; }
  .postcard { grid-template-columns: minmax(0, 1fr); padding: .8rem; }
  .reverse { border-left: 0; margin-left: 0; border-top: 1px solid #d6cdb8; margin-top: .9rem; padding: 1rem .3rem .2rem; }
  .stamp-row { margin-bottom: 1rem; }
  .rack { gap: .6rem; }
  .card img { width: 58px; height: 58px; }
  .card { font-size: .68rem; }
}
@media (max-width: 360px) {
  .rack { gap: .45rem; flex-wrap: nowrap; }
  .card { padding: 4px 4px 3px; font-size: .6rem; letter-spacing: .04em; }
  .card img { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
