/* Tiamo Via. One world: a present wrapped in harlequin paper, tied with a wine ribbon,
   with a handwritten tag and a heart seal. */

@font-face {
  font-family: "Prata";
  src: url("/assets/fonts/Prata-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Old Standard";
  src: url("/assets/fonts/OldStandard-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Old Standard";
  src: url("/assets/fonts/OldStandard-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Marck Script";
  src: url("/assets/fonts/MarckScript-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --cream: #fbf6ee;
  --powder: #c4d6e7;
  --dusty: #8ea7c6;
  --wine: #5c0f1b;
  --wine-deep: #420a13;
  --heart: #a61e2e;
  --gold: #a8844a;
  --ink: #3b1a16;
  --ink-soft: #6b4a43;

  --display: "Prata", "Bodoni 72", Didot, Georgia, serif;
  --text: "Old Standard", "Old Standard TT", Georgia, serif;
  --hand: "Marck Script", "Snell Roundhand", cursive;

  --tile-w: 56px;
  --tile-h: 88px;
  --ribbon: clamp(24px, 2.8vw, 38px);
  --knot-y: clamp(58px, 12vh, 112px);
  --notch: 14px;
  --lift: 0 16px 24px -14px rgba(66, 10, 19, 0.5), 0 2px 5px rgba(66, 10, 19, 0.14);

  /* The paper: one exact tile. A powder diamond on cream, gold four-point dots where four diamonds meet. */
  --harlequin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='88' viewBox='0 0 56 88'%3E%3Crect width='56' height='88' fill='%23fbf6ee'/%3E%3Cpath d='M28 0L56 44L28 88L0 44Z' fill='%23c4d6e7'/%3E%3Cg fill='%23a8844a'%3E%3Cpath d='M28-3.4L28.9-.9L31.4 0L28.9.9L28 3.4L27.1.9L24.6 0L27.1-.9Z'/%3E%3Cpath d='M28 84.6L28.9 87.1L31.4 88L28.9 88.9L28 91.4L27.1 88.9L24.6 88L27.1 87.1Z'/%3E%3Cpath d='M0 40.6L.9 43.1L3.4 44L.9 44.9L0 47.4L-.9 44.9L-3.4 44L-.9 43.1Z'/%3E%3Cpath d='M56 40.6L56.9 43.1L59.4 44L56.9 44.9L56 47.4L55.1 44.9L52.6 44L55.1 43.1Z'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--cream);
  scrollbar-color: var(--dusty) var(--cream);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  background-color: var(--cream);
  background-image: var(--harlequin);
  background-size: var(--tile-w) var(--tile-h);
  /* A column of diamond centres runs under the ribbon. */
  background-position: 50% 0;
}

::selection {
  background: var(--wine);
  color: var(--cream);
}

:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 3px;
}

a {
  color: var(--wine);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* ---------------------------------------------------------------- the ribbon */

/* The ribbon lies on the paper and never reaches past its edges, even while it slides off. */
.ribbons {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.ribbon {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  transition: transform 720ms cubic-bezier(0.16, 1, 0.3, 1), opacity 480ms ease-out;
}
/* Flat wine with a darker woven edge on each side. */
.ribbon-v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--ribbon);
  margin-left: calc(var(--ribbon) / -2);
  background: linear-gradient(90deg, var(--wine-deep) 0 2px, var(--wine) 2px calc(100% - 2px), var(--wine-deep) calc(100% - 2px));
}
.ribbon-h {
  left: 0;
  right: 0;
  top: var(--knot-y);
  height: var(--ribbon);
  margin-top: calc(var(--ribbon) / -2);
  background: linear-gradient(180deg, var(--wine-deep) 0 2px, var(--wine) 2px calc(100% - 2px), var(--wine-deep) calc(100% - 2px));
}
/* The bow where the ribbons cross. */
.bow {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: var(--knot-y);
  width: calc(var(--ribbon) * 4.6);
  height: auto;
  transform: translate(-50%, -42%);
  filter: drop-shadow(0 6px 6px rgba(66, 10, 19, 0.35));
  transition: transform 720ms cubic-bezier(0.16, 1, 0.3, 1), opacity 420ms ease-out;
}

/* ---------------------------------------------------------------- notched frames */

/* Every paper part has the corners of a gift tag: cut inwards in a quarter circle. An element
   inset by --d inside its frame keeps the same arcs by cutting with the radius grown by --d. */
.notched,
.frame,
.frame::before,
.frame::after,
.frame > .frame-in {
  --nr: calc(var(--notch) + var(--d, 0px));
  --nc: calc(-1 * var(--d, 0px));
  --ne: calc(100% + var(--d, 0px));
  -webkit-mask:
    radial-gradient(circle at var(--nc) var(--nc), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) top left / 51% 51% no-repeat,
    radial-gradient(circle at var(--ne) var(--nc), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) top right / 51% 51% no-repeat,
    radial-gradient(circle at var(--nc) var(--ne), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) bottom left / 51% 51% no-repeat,
    radial-gradient(circle at var(--ne) var(--ne), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) bottom right / 51% 51% no-repeat;
  mask:
    radial-gradient(circle at var(--nc) var(--nc), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) top left / 51% 51% no-repeat,
    radial-gradient(circle at var(--ne) var(--nc), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) top right / 51% 51% no-repeat,
    radial-gradient(circle at var(--nc) var(--ne), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) bottom left / 51% 51% no-repeat,
    radial-gradient(circle at var(--ne) var(--ne), transparent var(--nr), #000 calc(var(--nr) + 0.5px)) bottom right / 51% 51% no-repeat;
}

/* A framed card: a wine outer rule, cream, a thin wine inner rule, cream. */
.frame {
  position: relative;
  padding: 7px;
  background: var(--wine);
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
}
.frame::before {
  --d: 1.5px;
  inset: 1.5px;
  background: var(--cream);
}
.frame::after {
  --d: 6px;
  inset: 6px;
  background: var(--wine);
}
.frame > .frame-in {
  --d: 7px;
  position: relative;
  z-index: 1;
  background: var(--cream);
}
/* Blue and cream awning stripes: tissue showing round the edges of a card or tag. */
.lined {
  position: relative;
}
.lined::before,
.tag-wrap.lined::after {
  content: "";
  position: absolute;
  inset: -10px;
  background: repeating-linear-gradient(90deg, var(--powder) 0 22px, var(--cream) 22px 44px);
  box-shadow: inset 0 0 0 1px rgba(92, 15, 27, 0.18);
  transform: rotate(1.4deg);
}
.lined > * {
  position: relative;
}
/* On a tag the string uses ::before, so the tissue goes in ::after, below the string. */
.tag-wrap.lined::after {
  inset: 24px -10px -10px;
  z-index: -1;
}
.tag-wrap.lined::before {
  top: -8px;
  right: auto;
  bottom: auto;
  left: 50%;
  background: var(--gold);
  box-shadow: none;
  transform: none;
}
/* Masks clip an element's own shadow, so the shadow is cast by the holder around it. */
.holder {
  filter: drop-shadow(0 14px 14px rgba(66, 10, 19, 0.28)) drop-shadow(0 2px 2px rgba(66, 10, 19, 0.16));
}

/* ---------------------------------------------------------------- the present */

.gift {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  padding: calc(var(--knot-y) + 8px) 16px clamp(2.5rem, 6vw, 4rem);
}

/* The tag hangs from the knot on a gold string and swings once when the page opens. */
.tag-wrap {
  position: relative;
  width: min(100%, 30rem);
  padding-top: 34px;
  transform: rotate(-2deg);
  transform-origin: 50% -8px;
  animation: swing 1700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.tag-wrap::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: -8px;
  width: 1.5px;
  height: 52px;
  margin-left: -0.75px;
  background: var(--gold);
}
@keyframes swing {
  0% { transform: rotate(-11deg); }
  28% { transform: rotate(6deg); }
  52% { transform: rotate(-4deg); }
  74% { transform: rotate(0.5deg); }
  100% { transform: rotate(-2deg); }
}
.tag .frame-in {
  padding: 2rem 1.4rem 1rem;
  text-align: center;
}
/* The punched hole and its eyelet, where the string goes through. */
.eyelet {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0.85rem;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cream) 0 3px, var(--gold) 3.5px 5px, var(--wine) 5.5px 6.5px, transparent 7px);
}

.hand {
  margin: 0;
  font-family: var(--hand);
  font-size: clamp(3.2rem, 7vw, 4.8rem);
  font-weight: 400;
  line-height: 1.02;
  white-space: nowrap;
  color: var(--wine);
}
.line {
  margin: 0.5rem 0 0;
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.3;
  color: var(--ink);
}
.line [lang="ru"] {
  display: block;
  margin-top: 0.2rem;
  font-style: normal;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- the card of notes */

.card-wrap {
  position: relative;
  width: min(100%, 36rem);
  margin-top: clamp(1.1rem, 3vh, 2rem);
  padding-bottom: 3.4rem;
}
.card .frame-in {
  padding: 0.8rem clamp(1.1rem, 4vw, 2rem) 2.6rem;
}
.notes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.note {
  display: grid;
  grid-template-columns: max-content minmax(1.5rem, 1fr) max-content;
  column-gap: 0.7rem;
  align-items: baseline;
  padding: 0.7rem 0 0.75rem;
}
.note + .note {
  border-top: 1px solid rgba(92, 15, 27, 0.22);
}
.place,
.km {
  font-family: var(--display);
  font-size: 1.38rem;
  line-height: 1.15;
  color: var(--wine);
}
.km {
  font-family: var(--text);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}
/* Leader dots, whole dots only. */
.lead {
  align-self: end;
  height: 0.5em;
  margin-bottom: 0.32em;
  background-image: radial-gradient(circle, var(--wine) 0 1.2px, transparent 1.6px);
  background-size: 0.55rem 0.5em;
  background-repeat: space no-repeat;
  background-position: left bottom;
  opacity: 0.55;
}
.what {
  grid-column: 1 / -1;
  margin-top: 0.2rem;
  font-style: italic;
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--ink);
}
.gloss {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- the seal: the one way in */

.seal {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  width: 8rem;
  margin-left: -4rem;
  text-decoration: none;
  color: var(--wine);
}
.seal svg {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  filter: drop-shadow(0 6px 6px rgba(66, 10, 19, 0.3));
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.seal .seal-heart {
  transition: fill 200ms ease-out;
}
.seal-label {
  padding: 0.15rem 0.7rem 0.25rem;
  background: var(--cream);
  box-shadow: 0 6px 10px -6px rgba(66, 10, 19, 0.35);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.1;
  text-align: center;
}
.seal-label small {
  display: block;
  font-style: normal;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.seal:focus-visible {
  outline: none;
}
.seal:focus-visible svg {
  outline: 2px solid var(--wine);
  outline-offset: 4px;
}
.seal:active svg {
  transform: translateY(1px) scale(0.98);
}
@media (hover: hover) {
  .seal:hover svg {
    transform: translateY(-3px) rotate(-6deg);
  }
  .seal:hover .seal-heart {
    fill: var(--wine);
  }
}

/* ---------------------------------------------------------------- the way back */

.back {
  position: relative;
  z-index: 3;
  margin: 0 auto;
  padding: 0 16px 2.5rem;
  text-align: center;
}
.back a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem 0.5rem;
  background: var(--cream);
  font-style: italic;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: var(--lift);
}
.back a small {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
@media (hover: hover) {
  .back a:hover {
    text-decoration: underline;
  }
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 40rem) {
  :root {
    --tile-w: 44px;
    --tile-h: 69px;
    --notch: 11px;
    --knot-y: 80px;
  }
  .tag .frame-in {
    padding: 2.2rem 1.1rem 1.25rem;
  }
  .place,
  .km {
    font-size: 1.28rem;
  }
  .note {
    padding: 0.55rem 0 0.6rem;
  }
  .lined::before {
    inset: -7px;
    transform: rotate(0.8deg);
  }
  .card .frame-in {
    padding-bottom: 3.1rem;
  }
  .seal svg {
    width: 70px;
    height: 70px;
  }
  .hand {
    font-size: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag-wrap {
    animation: none;
  }
  .ribbon,
  .bow,
  .seal svg {
    transition: none;
  }
}

/* Text kept for assistive technology. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
