/* ==========================================
   Fonts
   ========================================== */

@font-face {
  font-family: "Times";
  src: url("../fonts/times.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica Neue";
  src: url("../fonts/HelveticaNeueRoman.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica Neue";
  src: url("../fonts/HelveticaNeueMedium.otf") format("opentype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --background: #000;
  --primary: #fff;
  --secondary: rgb(255 255 255 / 0.6);
  --color-bg: var(--background);
  --color-paper: #e2dfd2;
  --color-text-primary: var(--primary);
  --color-text-dark: #1a1a1a;
  --font-serif: "Times", serif;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  --content-max-width: 72rem;
  --space-outer: clamp(1.5rem, 4vw, 3.5rem);
  --clock-roll-duration: 380ms;
  --contact-gap: 36px;
  --color-selection: #637471;
  --letter-max-width: 600px;
}

/* ==========================================
   Base / Type
   ========================================== */

::selection {
  background: transparent;
  color: var(--color-selection);
}

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

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h4 {
  font-family: var(--font-sans);
  font-weight: 400;
  margin: 0;
}

h1 {
  font-size: 64px;
  line-height: 88px;
  letter-spacing: -2px;
  margin-bottom: 16px;
}

h4 {
  font-size: 24px;
  line-height: 32px;
  letter-spacing: 0px;
}

.copy {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0px;
  margin: 0px;
}

.copy-large {
  font-size: 18px;
  line-height: 22px;
}

.gray {
  color: var(--secondary);
}

/* ==========================================
   Shared Layout
   ========================================== */

.content-frame {
  width: min(var(--content-max-width), calc(100% - (var(--space-outer) * 2)));
  margin: 0 auto;
}

/* ==========================================
   Header
   ========================================== */

.site-header {
  position: relative;
  z-index: 25;
  padding: 48px;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: inline-block;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: default;
  user-select: none;
}

.site-brand-name {
  margin: 0;
  font: inherit;
  line-height: 1;
  font-weight: inherit;
  font-size: 0;
}

.brand-char {
  display: inline-block;
  white-space: pre;
  vertical-align: baseline;
  font-size: 20px;
  line-height: 1;
}

.brand-char--visible {
  opacity: 1;
  margin-left: 0;
}

.site-brand-name .brand-char--visible:nth-child(10) {
  margin-left: 2px;
}

.brand-char--hidden {
  opacity: 0;
  margin-left: -0.48em;
}

.site-brand:hover .brand-char--hidden,
.site-brand:focus-visible .brand-char--hidden {
  opacity: 1;
  margin-left: 0;
}

.site-brand:focus-visible {
  outline: 1px solid var(--secondary);
  outline-offset: 6px;
}

.navigation-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.navigation-link-roller {
  position: relative;
  display: block;
  height: 1.1em;
  overflow: hidden;
  line-height: 1.1;
}

.navigation-link-line {
  display: block;
  color: var(--primary);
}

.navigation-link-line--alt {
  position: absolute;
  top: -100%;
  left: 0;
  color: var(--secondary);
}

.navigation-link-line--reset {
  position: absolute;
  top: -200%;
  left: 0;
  color: var(--primary);
}

.navigation-link:focus-visible {
  outline: 1px solid var(--secondary);
  outline-offset: 6px;
}

/* ==========================================
   Letter
   ========================================== */

.letter-stage {
  position: relative;
  z-index: 10;
  padding-top: 44px;
  padding-bottom: 0;
}

.letter {
  --letter-rotation: 1deg;
  --letter-min-height-ratio: 852 / 600;
  width: 100%;
  max-width: var(--letter-max-width);
  min-height: calc(var(--letter-max-width) * var(--letter-min-height-ratio));
  margin: 0 auto;
  padding: 40px 40px 80px;
  background: var(--color-paper) url('../images/paper.png') center / cover no-repeat;
  color: var(--color-text-dark);
  box-shadow:
    0 1px 4px rgba(0,0,0,0.08),
    0 4px 16px rgba(0,0,0,0.06);
  transform: rotate(var(--letter-rotation));
  transform-origin: center bottom;
  opacity: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.letter ::selection {
  background: transparent;
  color: var(--color-selection);
}

.letter-title {
  margin: 0;
  padding: 40px 0;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.5px;
  font-variant-caps: normal;
  font-feature-settings: "smcp" 0, "c2sc" 0;
  text-transform: none;
}

.letter-text {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  text-transform: none;
  font-variant-caps: normal;
  font-feature-settings: "smcp" 0, "c2sc" 0;
}

.letter-text--date {
  padding-bottom: 40px;
  text-align: right;
}

.letter-text--close {
  margin-top: 2.4rem;
}

.signature {
  margin: auto 0 0;
}

.signature-draw {
  display: inline-block;
  width: auto;
  max-height: 50px;
  height: auto;
  vertical-align: top;
  opacity: 1;
  clip-path: inset(0 0 0 0);
}

/* ==========================================
   Contact
   ========================================== */

.contact {
  position: relative;
  z-index: 60;
  margin-top: var(--contact-gap);
  min-height: 100vh;
  padding: 192px 0 48px;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}

.contact-inner {
  max-width: var(--letter-max-width, 600px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.contact-intro .copy {
  margin-top: 0;
}

.contact-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  gap: 24px 96px;
  margin-top: 96px;
  align-items: baseline;
  line-height: 1.2;
  flex: 1;
  min-height: 0;
  align-content: stretch;
}

.contact-grid > :nth-child(5) {
  grid-column: 2;
}

.contact-grid > :nth-child(6),
.contact-grid > :nth-child(7) {
  align-self: end;
  white-space: nowrap;
  padding-top: 72px;
  display: flex;
  align-items: flex-end;
}

.email-copy {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.email-copy-roller {
  position: relative;
  display: block;
  height: 1.3em;
  overflow: hidden;
  line-height: 1.3;
}

.email-copy-line {
  display: block;
  color: var(--primary);
}

.email-copy-line--hover {
  position: absolute;
  top: -100%;
  left: 0;
  color: var(--secondary);
}

.email-copy-line--hover-exit {
  position: absolute;
  top: -200%;
  left: 0;
}

.email-copy-line--copied {
  position: absolute;
  top: -300%;
  left: 0;
}

.email-copy-line--copied-exit {
  position: absolute;
  top: -400%;
  left: 0;
}

.email-copy:focus-visible {
  outline: 1px solid var(--secondary);
  outline-offset: 6px;
}

.contact-grid a {
  display: inline-block;
  cursor: pointer;
}

.contact-grid a:focus-visible {
  outline: 1px solid var(--secondary);
  outline-offset: 6px;
}

.contact-link-roller {
  position: relative;
  display: block;
  height: 1.1em;
  overflow: hidden;
  line-height: 1.1;
}

.contact-link-line {
  display: block;
  color: var(--primary);
}

.contact-link-line--alt {
  position: absolute;
  top: -100%;
  left: 0;
  color: var(--secondary);
}

.contact-link-line--reset {
  position: absolute;
  top: -200%;
  left: 0;
  color: var(--primary);
}

/* ==========================================
   Footer Time
   ========================================== */

.site-clock {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-variant-numeric: tabular-nums;
}

.site-clock-track {
  display: inline-flex;
}

.site-clock-zone {
  letter-spacing: 0.1em;
}

.clock-cell {
  position: relative;
  display: inline-block;
  min-width: 0.62em;
  height: 20px;
  overflow: hidden;
  line-height: 20px;
  vertical-align: top;
}

.clock-cell--space {
  min-width: 0.35em;
}

.clock-cell--separator {
  min-width: 0.34em;
}

.clock-glyph {
  display: block;
}

.clock-glyph--next {
  position: absolute;
  top: -100%;
  left: 0;
}

/* ==========================================
   Utilities
   ========================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================
   Breakpoints
   ========================================== */

@media (max-width: 704px) {
  .contact {
    margin-top: 0;
    padding-bottom: 24px;
  }

  .contact-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto auto 1fr;
    column-gap: 24px;
    row-gap: 24px;
    max-width: none;
    margin-top: 48px;
    align-items: start;
    align-content: start;
  }

  .contact-grid > :nth-child(1),
  .contact-grid > :nth-child(2),
  .contact-grid > :nth-child(3),
  .contact-grid > :nth-child(4),
  .contact-grid > :nth-child(5) {
    grid-column: 1 / -1;
  }

  .contact-grid > :nth-child(3) {
    margin-top: 24px;
  }

  .contact-grid > :nth-child(6) {
    justify-self: start;
    padding-top: 24px;
  }

  .contact-grid > :nth-child(7) {
    justify-self: end;
    padding-top: 24px;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 24px;
  }

  .letter-stage {
    padding-top: 24px;
    padding-bottom: 0;
  }

  :root {
    --letter-max-width: 550px;
  }

  .contact {
    --contact-gap: 0px;
    padding-top: 96px;
  }

  .letter-title {
    padding: 24px 0;
    margin: 0;
    font-size: 24px;
    line-height: 1.05;
  }

  .letter-text--date {
    padding-bottom: 28px;
  }

  .letter-text--close {
    margin-top: 1.8rem;
  }

  .signature {
    margin: 0;
    padding-top: 24px;
  }

  .signature-draw {
    max-height: 42px;
  }
}

@media (max-width: 648px) {
  :root {
    --letter-max-width: 500px;
  }
}

@media (max-width: 546px) {
  :root {
    --space-outer: 16px;
  }

  .site-header {
    padding: 16px;
  }

  .letter-stage {
    padding-left: 16px;
    padding-right: 16px;
  }

  .letter {
    --letter-rotation: 0deg;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    height: auto;
    padding: 48px 24px;
  }

  .letter-title {
    padding-top: 0px;
  }
}
