/* ============================================================
   1email.email — information page
   Concept: an airmail letter. The viewport is the envelope,
   the notice is the letter body, the postmark is the one
   orchestrated moment (a single rubber-stamp press).
   ============================================================ */

:root {
  --paper: #FBFAF6;      /* envelope paper */
  --ink: #262A33;        /* blue-black writing ink */
  --carbon: #4E4A3F;     /* carbon-copy grey */
  --postmark: #5E566E;   /* violet postmark ink */
  --red: #C8353B;        /* airmail stripe red */
  --blue: #2E5AA7;       /* airmail stripe / stamp blue */
  --frame-w: 18px;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/noto-serif-sc-sub.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("fonts/courier-prime-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain, barely there */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* airmail striped border framing the whole viewport */
.airmail-frame {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  padding: var(--frame-w);
  background: repeating-linear-gradient(
    45deg,
    var(--red) 0 14px,
    transparent 14px 28px,
    var(--blue) 28px 42px,
    transparent 42px 56px
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
}

/* the letter */
.letter {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: clamp(20px, 6vh, 60px) auto 0;
  /* top spacing as padding (not margin) so it cannot collapse with .body */
  padding: clamp(210px, 34vh, 320px) clamp(24px, 6vw, 72px) 14vh;
}

.marking {
  position: absolute;
  top: 0;
  right: clamp(24px, 6vw, 72px);
  width: 132px;
  height: 0;
}

.stamp {
  display: block;
  width: 132px;
  height: auto;
}

.postmark {
  position: absolute;
  left: -78px;
  top: 58px;
  width: 190px;
  height: auto;
  transform: rotate(-8deg);
  animation: press 0.34s cubic-bezier(0.55, 0.06, 0.68, 0.19) 0.55s backwards;
}

.stamp {
  animation: print-in 0.25s ease-out 0.05s backwards;
}

@keyframes press {
  from { transform: rotate(-13deg) scale(1.55); opacity: 0; }
  70%  { opacity: 0.8; }
  to   { transform: rotate(-8deg) scale(1); opacity: 0.85; }
}

@keyframes print-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pm-ink {
  stroke: var(--postmark);
  fill: none;
  opacity: 0.85;
}

.pm-ring {
  font-family: "Courier Prime", "Noto Serif SC", monospace;
  font-size: 8.5px;
  letter-spacing: 1.1px;
  fill: var(--postmark);
}

.pm-date {
  font-family: "Courier Prime", monospace;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  fill: var(--postmark);
}

.stamp-air {
  font-family: "Courier Prime", monospace;
  font-size: 9.5px;
  letter-spacing: 0.28em;
  fill: var(--blue);
}

.stamp-zh {
  font-family: "Noto Serif SC", serif;
  font-size: 13px;
  font-weight: 600;
  fill: var(--blue);
}

/* letter body */
.body {
  margin-top: 0;
}

h1 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.55rem, 5.2vw, 2.5rem);
  line-height: 1.62;
  letter-spacing: 0.015em;
}

.copy {
  margin: 2.1rem 0 0;
  max-width: 30em;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--carbon);
}

.signature {
  margin: 3.4rem 0 0;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--postmark);
}

::selection {
  background: rgba(46, 90, 167, 0.18);
}

/* small viewports: thinner frame, smaller marking, less top space */
@media (max-width: 560px) {
  :root { --frame-w: 12px; }

  .marking { width: 104px; }
  .stamp { width: 104px; }
  .postmark { left: -66px; top: 44px; width: 152px; }

  .copy { font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp, .postmark { animation: none; }
}

/* short viewports (landscape phones): shrink the marking so it cannot reach the text */
@media (max-height: 640px) {
  .letter { margin-top: 16px; }
  .marking { transform: scale(0.82); transform-origin: top right; }
}
