@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Serif+Display:ital@0;1&display=swap");

:root {
  --paper: #f3f0e9;
  --paper-deep: #eae5da;
  --ink: #063a2c;
  --ink-soft: #2c4a41;
  --red: #c7473c;
  --brass: #a67a36;
  --line: rgba(6, 58, 44, 0.16);
  --font-display: "DM Serif Display", Georgia, serif;
  --font-ui: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 51% 35%, rgba(255, 255, 255, 0.7), transparent 45%),
    var(--paper);
  font-family: var(--font-ui);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.32;
  filter: url("#noise");
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

.paper {
  position: fixed;
  inset: -4rem;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(6, 58, 44, 0.095) 1px),
    linear-gradient(transparent calc(100% - 1px), rgba(6, 58, 44, 0.075) 1px);
  background-size: 74px 74px;
  mask-image: linear-gradient(90deg, #000 0, transparent 28%, transparent 70%, #000 100%);
  animation: ledger-drift 26s linear infinite;
}

.paper::before,
.paper::after {
  position: absolute;
  top: -10%;
  bottom: -10%;
  width: 1px;
  content: "";
  background: rgba(199, 71, 60, 0.28);
}

.paper::before {
  left: 7.5rem;
}

.paper::after {
  right: 17.5rem;
}

.page {
  display: flex;
  width: min(100% - 7rem, 1360px);
  min-height: 100svh;
  margin: 0 auto;
  flex-direction: column;
}

.header {
  display: flex;
  padding: 2.25rem 0 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1;
  letter-spacing: 0.055em;
}

.brand i {
  width: 3.25rem;
  height: 2px;
  margin-top: 0.75rem;
  background: var(--red);
  transform-origin: left;
  animation: line-in 1s 0.15s both cubic-bezier(0.65, 0, 0.35, 1);
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  padding: clamp(2.5rem, 7vh, 5.4rem) 10% 3rem;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.fountain-pen {
  position: absolute;
  top: 0.25rem;
  right: -4rem;
  z-index: 0;
  width: clamp(18rem, 29vw, 26rem);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 1.5rem 1.25rem rgba(20, 32, 27, 0.12));
  transform: rotate(-1deg);
  animation: pen-in 1.1s 0.2s both cubic-bezier(0.22, 1, 0.36, 1);
}

.copy,
.countdown,
.started {
  position: relative;
  z-index: 1;
}

.copy {
  max-width: 68rem;
  animation: rise-in 900ms 100ms both cubic-bezier(0.22, 1, 0.36, 1);
}

h1 {
  max-width: 64rem;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 7.2vw, 7.25rem);
  font-weight: 400;
  line-height: 0.91;
  letter-spacing: -0.045em;
}

.signature {
  position: relative;
  display: inline-block;
}

.signature::after {
  position: absolute;
  right: 2%;
  bottom: -0.03em;
  left: 4%;
  height: 0.07em;
  content: "";
  background: var(--red);
  border-radius: 100%;
  transform: rotate(-1.3deg) scaleX(0);
  transform-origin: left;
  animation: line-in 900ms 700ms both cubic-bezier(0.65, 0, 0.35, 1);
}

.period {
  color: var(--red);
}

.copy p {
  margin: clamp(2rem, 4vh, 3rem) 0 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.48;
}

.copy strong {
  font-weight: 500;
}

.countdown {
  display: grid;
  width: min(100%, 66rem);
  margin: clamp(3.25rem, 7vh, 5.75rem) auto 0;
  grid-template-columns: minmax(7rem, 1fr) minmax(2.5rem, 0.55fr) minmax(7rem, 1fr) minmax(2.5rem, 0.55fr) minmax(7rem, 1fr) minmax(2.5rem, 0.55fr) minmax(8.5rem, 1.25fr);
  align-items: center;
  animation: rise-in 900ms 300ms both cubic-bezier(0.22, 1, 0.36, 1);
}

.time-unit {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.number {
  display: inline-block;
  min-width: 2ch;
  font-family: var(--font-display);
  font-size: clamp(4.3rem, 7vw, 7.25rem);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 0.9;
  text-align: center;
  transform-origin: 50% 70%;
}

.number.tick {
  animation: number-tick 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.label {
  margin-top: 1.25rem;
  color: #1b2f29;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.27em;
  text-transform: uppercase;
}

.rail {
  position: relative;
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 28%, var(--line) 72%, transparent);
}

.rail::before {
  position: absolute;
  top: -3.5rem;
  bottom: -3.5rem;
  left: 50%;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, rgba(166, 122, 54, 0.42), transparent);
}

.rail i {
  position: absolute;
  top: -0.22rem;
  left: 50%;
  width: 0.46rem;
  height: 0.46rem;
  background: var(--brass);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(166, 122, 54, 0.08);
  transform: translateX(-50%);
}

.seconds-unit {
  width: clamp(8.8rem, 13vw, 12rem);
  height: clamp(8.8rem, 13vw, 12rem);
  justify-self: center;
  justify-content: center;
}

.seconds-unit .number {
  font-size: clamp(4rem, 6vw, 6.5rem);
}

.seconds-unit .label {
  margin-top: 0.8rem;
}

.orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(166, 122, 54, 0.44);
  border-radius: 50%;
}

.orbit::before {
  position: absolute;
  inset: -1px;
  content: "";
  border-radius: inherit;
  background: conic-gradient(var(--red) 0deg, var(--red) 30deg, transparent 30deg);
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
  transform: rotate(var(--seconds-angle, 0deg));
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.orbit i {
  position: absolute;
  top: 50%;
  right: -0.25rem;
  width: 0.48rem;
  height: 0.48rem;
  background: var(--brass);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(54, 38, 13, 0.35);
  transform: translateY(-50%);
}

.started {
  margin: 4rem auto;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  text-align: center;
}

.footer {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0 2rem;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  text-align: center;
}

.footer span {
  width: min(18vw, 12rem);
  height: 1px;
  background: var(--line);
}

.footer p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.footer a {
  color: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-decoration-color: rgba(44, 74, 65, 0.38);
  text-underline-offset: 0.18em;
}

a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 0.35rem;
}

@keyframes ledger-drift {
  to { transform: translate3d(74px, 74px, 0); }
}

@keyframes line-in {
  to { transform: rotate(-1.3deg) scaleX(1); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(1.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pen-in {
  from { opacity: 0; transform: translate3d(2.5rem, -2rem, 0) rotate(2deg); }
  to { opacity: 1; transform: translate3d(0, 0, 0) rotate(-1deg); }
}

@keyframes number-tick {
  0% { opacity: 0; filter: blur(8px); transform: translateY(-0.18em) rotateX(-25deg); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0) rotateX(0); }
}

@media (max-width: 900px) {
  .page { width: min(100% - 3rem, 760px); }
  .hero { padding-right: 0; padding-left: 0; }
  .fountain-pen { display: none; }
  .countdown {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }
  .rail { display: none; }
  .seconds-unit { width: auto; height: auto; }
  .orbit { inset: -1.1rem -0.5rem; }
}

@media (max-width: 600px) {
  .page { width: calc(100% - 2rem); }
  .header { padding-top: 1.4rem; }
  .brand { font-size: 1.1rem; }
  .brand i { width: 2.25rem; margin-top: 0.55rem; }
  .hero { padding-top: 3.5rem; justify-content: flex-start; }
  h1 { font-size: clamp(3.5rem, 17vw, 5rem); line-height: 0.94; }
  .copy p { margin-top: 2rem; font-size: 1.08rem; }
  .countdown {
    margin-top: 4.5rem;
    grid-template-columns: repeat(2, 1fr);
    gap: 3.5rem 1.5rem;
  }
  .number { font-size: clamp(4rem, 22vw, 5.8rem); }
  .seconds-unit .number { font-size: clamp(4rem, 22vw, 5.8rem); }
  .orbit { inset: -1.25rem 0; }
  .footer { margin-top: 2.5rem; padding-bottom: 1.4rem; }
  .footer span { width: 10vw; }
  .paper::before { left: 3.5rem; }
  .paper::after { right: 4.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
