:root {
  color-scheme: light dark;
  --paper: #ece4d3;
  --paper-deep: #ddd2bd;
  --ink: #191816;
  --muted: #686259;
  --rule: rgba(25, 24, 22, 0.16);
  --minor: rgba(25, 24, 22, 0.055);
  --major: rgba(25, 24, 22, 0.13);
  --mark: #a6472f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171714;
    --paper-deep: #20201b;
    --ink: #e8e0cf;
    --muted: #9f998c;
    --rule: rgba(232, 224, 207, 0.18);
    --minor: rgba(232, 224, 207, 0.055);
    --major: rgba(232, 224, 207, 0.15);
    --mark: #d66c4d;
  }

  body {
    background:
      radial-gradient(circle at 13% 7%, rgba(214, 108, 77, 0.035), transparent 28rem),
      var(--paper);
  }

  .grid-sheet {
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.24);
  }
}

* {
  box-sizing: border-box;
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 7%, rgba(255, 255, 255, 0.18), transparent 28rem),
    var(--paper);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
  text-rendering: optimizeLegibility;
}

.sheet {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(16rem, 30vw);
  gap: clamp(2rem, 5vw, 5.5rem);
  align-items: stretch;
  width: 100%;
  height: 100svh;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

.grid-sheet {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper-deep);
  box-shadow: 0 1.5rem 4rem rgba(31, 25, 16, 0.07);
}

.grid-sheet::before {
  content: "";
  position: absolute;
  inset: 1.5rem 0 0 1.5rem;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, var(--minor) 5px 6px),
    repeating-linear-gradient(0deg, transparent 0 5px, var(--minor) 5px 6px),
    repeating-linear-gradient(90deg, transparent 0 29px, var(--major) 29px 30px),
    repeating-linear-gradient(0deg, transparent 0 29px, var(--major) 29px 30px),
    var(--paper);
}

.grid-sheet::after {
  content: "";
  position: absolute;
  top: calc(1.5rem - 3px);
  left: calc(1.5rem - 3px);
  width: 6px;
  height: 6px;
  background: var(--mark);
}

.ruler-x,
.ruler-y {
  position: absolute;
  z-index: 1;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.02em;
  user-select: none;
}

.ruler-x {
  top: 0.48rem;
  left: 1.7rem;
  right: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.ruler-y {
  top: 1.75rem;
  bottom: 0.5rem;
  left: 0.48rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ruler-y span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.title-block {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  align-self: stretch;
  padding: 1.5rem 0;
}

.eyebrow {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin: 0 0 2.8rem;
  color: var(--muted);
  font-size: clamp(0.69rem, 0.72vw, 0.78rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  background: var(--mark);
}

h1 {
  max-width: 7ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.6rem, 8.6vw, 9.5rem);
  font-weight: 400;
  line-height: 0.78;
  letter-spacing: -0.07em;
}

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

.rule {
  width: 100%;
  margin: clamp(2.5rem, 6vh, 5rem) 0 1rem;
  border: 0;
  border-top: 1px solid var(--rule);
}

.coordinate {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .sheet {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(14rem, 38svh) auto;
    gap: 0;
    height: auto;
    min-height: 100svh;
    padding: 0;
  }

  .grid-sheet {
    border-width: 0 0 1px;
    box-shadow: none;
  }

  .title-block {
    min-height: 62svh;
    padding: 2.1rem 1.45rem max(2rem, env(safe-area-inset-bottom));
    justify-content: flex-start;
  }

  .eyebrow {
    margin-bottom: 2.3rem;
    font-size: 0.75rem;
  }

  h1 {
    font-size: clamp(4.8rem, 25vw, 7rem);
    line-height: 0.8;
  }

  .rule {
    margin-top: 0;
  }

  .title-block > div {
    margin-top: auto;
  }

  .coordinate {
    font-size: 0.72rem;
  }

  .ruler-x,
  .ruler-y {
    font-size: 0.64rem;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .sheet {
    grid-template-rows: minmax(11rem, 31svh) auto;
  }

  .title-block {
    min-height: 69svh;
    padding-top: 1.5rem;
  }

  .eyebrow {
    margin-bottom: 1.4rem;
  }

  h1 {
    font-size: clamp(4.25rem, 21vw, 6rem);
  }

  .ruler-y span:nth-child(2),
  .ruler-y span:nth-child(4) {
    display: none;
  }
}

@media (min-width: 721px) and (max-height: 520px) {
  body {
    overflow: auto;
  }

  .sheet {
    min-height: 30rem;
    height: 30rem;
    margin: 0;
  }
}
