@charset "utf-8";

@font-face {
  font-family: "SerifKO";
  src: url("fonts/serif-ko.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SerifJA";
  src: url("fonts/serif-ja.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SerifZH";
  src: url("fonts/serif-zh.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #11110f;
  --muted: #777771;
  --line: #e4e4df;
  --paper: #fff;
  --canvas: #f0f0ed;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --serif: "SerifKO", AppleMyungjo, Batang, serif;
}

html[lang="ja"] {
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --serif: "SerifJA", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

html[lang="zh"] {
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: "SerifZH", "Songti SC", STSong, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button {
  color: inherit;
  font: inherit;
}

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

.gnb,
.app {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  background: var(--paper);
}

.gnb {
  position: sticky;
  z-index: 10;
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
}

.gnb[hidden] {
  display: none;
}

.gnb__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  margin-inline: 20px;
  border-bottom: 1px solid var(--line);
}

.gnb__brand,
.gnb__language,
.eyebrow,
.reader__counter,
.reader-nav__button,
.continue-button {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
}

.gnb__brand {
  white-space: nowrap;
}

.gnb__language {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  margin-right: -12px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: right;
}

.gnb__language-arrow {
  flex: 0 0 auto;
  width: 8px;
  height: 5px;
  overflow: visible;
}

.gnb__language-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.15;
}

.app {
  min-height: 100svh;
}

.app--reader {
  min-height: calc(100svh - 58px - env(safe-area-inset-top, 0px));
}

.language-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: max(62px, env(safe-area-inset-top, 0px)) 20px max(18px, env(safe-area-inset-bottom, 0px));
}

.language-screen__intro {
  grid-row: 1;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 10px;
}

.language-screen h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -.03em;
}

.language-screen__mark {
  display: block;
  width: min(248px, 72vw);
  height: auto;
  margin: 28px 0 0 3px;
}

.language-screen__controls {
  grid-row: 3;
}

.language-options {
  border-top: 1px solid var(--line);
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 49px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.language-option__check {
  width: 14px;
  color: var(--ink);
  font-size: 10px;
  text-align: center;
}

.language-option.is-selected span:first-child {
  font-weight: 600;
}

.continue-button {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.continue-button:disabled {
  border-color: #bdbdb8;
  color: #9b9b96;
  cursor: default;
}

.continue-button:not(:disabled):active {
  background: var(--ink);
  color: var(--paper);
}

.reader {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 58px - env(safe-area-inset-top, 0px));
  padding: 20px 20px max(14px, env(safe-area-inset-bottom, 0px));
}

.reader__counter {
  margin: 0;
  color: var(--muted);
  letter-spacing: .02em;
}

.reader__content {
  padding-top: clamp(54px, 10svh, 86px);
}

.reader__content h1 {
  max-width: 430px;
  margin: 0;
  font-size: clamp(20px, 5.8vw, 28px);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.42;
  text-wrap: balance;
  white-space: pre-line;
}

.reader__body {
  max-width: 460px;
  margin-top: clamp(56px, 10svh, 88px);
}

.reader__body p {
  margin: 0 0 1.05em;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -.015em;
  line-height: 1.72;
  white-space: pre-line;
}

html[lang="zh"] .reader__body p,
html[lang="ja"] .reader__body p {
  margin-bottom: .62em;
}

html[lang="ja"] .reader__body p {
  line-break: strict;
  text-wrap: pretty;
  word-break: auto-phrase;
}

.reader__body p:last-child {
  margin-bottom: 0;
}

.reader__signature {
  margin: .5em 0 1.05em;
}

.reader__signature:last-child {
  margin-bottom: 0;
}

.reader__signature img {
  display: block;
  width: min(174px, 52vw);
  height: auto;
}

.reader__signature figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
}

.reader-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  margin-top: auto;
  padding-top: 56px;
}

.reader-nav > span {
  display: block;
  width: 100%;
  min-height: 56px;
  border-block: 1px solid var(--line);
}

.reader-nav__button {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 0 4px;
  border: 0;
  border-block: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(17, 17, 15, .08);
}

.reader-nav__button--previous {
  justify-content: flex-start;
}

.reader-nav__button--next {
  justify-content: flex-end;
}

.reader-nav__arrow {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  overflow: visible;
}

.reader-nav__arrow path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.reader-nav__number {
  line-height: 1;
}

.error-screen {
  display: grid;
  place-content: center;
  gap: 24px;
  min-height: 100svh;
  padding: 24px;
  text-align: center;
}

.error-screen p {
  margin: 0;
  font-size: 14px;
}

.error-screen button {
  min-width: 120px;
  min-height: 44px;
  border: 1px solid var(--ink);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

@media (min-width: 521px) {
  .gnb,
  .app {
    border-inline: 1px solid #e7e7e2;
  }

  .reader__content h1 {
    font-size: 25px;
  }

  .reader__body p {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .app {
    animation: appear .22s ease-out;
  }

  @keyframes appear {
    from { opacity: .3; }
    to { opacity: 1; }
  }
}
