:root {
  color-scheme: light;
  --paper: #F2F5F3;
  --ink: #1C2A33;
  --ledger-line: #C7D4CE;
  --seal: #B3332B;
  --muted: #5A6A72;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #141D23;
    --ink: #E6ECE9;
    --ledger-line: #33434B;
    --seal: #E0675E;
    --muted: #9AABB2;
  }
}

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

html {
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Apple SD Gothic Neo", Pretendard, "Noto Sans KR", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

a {
  color: inherit;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

button,
input,
select,
textarea {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  font: inherit;
}

button,
input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 44px;
}

button {
  background: var(--ink);
  border-radius: 6px;
  color: var(--paper);
  cursor: pointer;
  font-weight: 700;
  padding: 0.65rem 1rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
  height: 1.25rem;
  margin: 0.7rem 0.45rem 0.7rem 0;
  width: 1.25rem;
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

label {
  display: block;
  margin-block: 1rem;
  max-width: 42rem;
}

fieldset {
  border: 1px solid var(--ledger-line);
  margin: 1.5rem 0;
  max-width: 42rem;
  padding: 1rem;
}

fieldset label {
  align-items: center;
  display: flex;
  margin-block: 0.35rem;
}

img,
svg {
  height: auto;
  max-width: 100%;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
table,
form,
details,
pre {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  max-width: 12em;
  overflow-wrap: normal;
  word-break: keep-all;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.3;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.4;
}

.example-label {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

p,
li,
dd {
  max-width: 34em;
}

code,
time,
.ledger-amount,
table {
  font-variant-numeric: tabular-nums;
}

code,
pre {
  font-family: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.site-header,
.site-footer,
main {
  margin-inline: auto;
  width: 100%;
}

.phase-strip {
  border-bottom: 1px solid var(--ledger-line);
  display: grid;
  font-size: 0.78rem;
  gap: 0.2rem;
  padding: 0.5rem max(1.25rem, calc((100vw - 74rem) / 2));
}

.phase-strip p {
  margin: 0;
  max-width: none;
}

.phase-details summary {
  color: var(--muted);
}

.phase-details {
  border: 0;
  margin: 0;
  max-width: 42rem;
  padding: 0;
}

.phase-details summary {
  font-weight: 400;
}

.phase-details p {
  margin-top: 0.4rem;
}

.site-nav,
.site-footer {
  margin-inline: auto;
  max-width: 74rem;
  padding-inline: 1.25rem;
}

.site-nav {
  align-items: center;
  border-bottom: 1px solid var(--ledger-line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

main {
  max-width: 74rem;
  padding: 3rem 1.25rem 6rem;
}

main > section,
main > .home-hero,
.actions > article,
.admin-page article {
  border-top: 1px solid var(--ledger-line);
  padding-block: 2.5rem;
}

.home-hero > section:first-child,
main > section:first-child {
  border-top: 0;
}

.hero-copy > p:first-of-type {
  font-size: 1.08rem;
}

.hero-actions,
.ledger-status,
.verification-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.button {
  background: var(--ink);
  border-radius: 6px;
  color: var(--paper);
  font-weight: 700;
  padding: 0.55rem 1rem;
  text-decoration: none;
}

.member-link,
.ledger-balance,
.pending-cheers,
.need-line,
.sign-in-pending {
  color: var(--muted);
}

.actions article,
.recent-stories article {
  border-bottom: 1px solid var(--ledger-line);
  padding-block: 1.5rem;
}

.promises ol,
.tip-warnings {
  list-style: none;
  padding: 0;
}

.promises li,
.tip-warnings li {
  border-top: 1px solid var(--ledger-line);
  padding: 1rem 0 1rem 1.5rem;
}

.promises li::before {
  content: counter(list-item);
  display: inline-block;
  font-variant-numeric: tabular-nums;
  margin-left: -1.5rem;
  width: 1.5rem;
}

.not-yet-detail {
  border: 1px solid var(--ledger-line);
  padding: 1.5rem;
}

.ledger-preview {
  min-width: 0;
}

.ledger-chain {
  list-style: none;
  margin: 1.5rem 0;
  max-width: 42rem;
  padding: 0;
}

.ledger-entry {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  max-width: none;
  min-height: 4.5rem;
  padding: 0.4rem 0;
  position: relative;
}

.ledger-dot {
  background: var(--ink);
  border-radius: 50%;
  grid-column: 1;
  height: 0.62rem;
  margin-left: 0.3rem;
  margin-top: 0.52rem;
  width: 0.62rem;
}

.ledger-connector {
  border-left: 2px solid var(--ledger-line);
  height: calc(100% - 0.6rem);
  left: 0.58rem;
  position: absolute;
  top: -3.25rem;
}

.ledger-connector--broken {
  border-left-style: dashed;
}

.ledger-entry-content {
  display: grid;
  gap: 0.15rem;
  grid-column: 2;
  min-width: 0;
}

.ledger-entry-primary,
.ledger-entry-secondary {
  align-items: baseline;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.ledger-entry-primary {
  justify-content: flex-start;
  text-align: left;
}

.ledger-entry-secondary {
  justify-content: flex-end;
  text-align: right;
}

.ledger-entry-primary time,
.ledger-amount,
.ledger-fingerprint {
  white-space: nowrap;
}

.ledger-entry-kind {
  min-width: 0;
}

.ledger-fingerprint {
  color: var(--muted);
}

.ledger-empty {
  border-block: 1px solid var(--ledger-line);
  padding-block: 1rem;
}

.ledger-empty p {
  margin-bottom: 0.3rem;
}

.ledger-empty code {
  display: block;
  max-width: 34em;
}

.ledger-chain--preview .ledger-entry:last-child .ledger-connector {
  animation: draw-ledger-line 0.6s ease-out both;
  transform-origin: top;
}

@keyframes draw-ledger-line {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.verification {
  border-block: 1px solid var(--ledger-line);
  margin-block: 2.5rem;
  padding-block: 2rem;
}

.verification-heading {
  justify-content: space-between;
  max-width: 42rem;
}

.verification-stamp {
  align-items: center;
  border: 2px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  display: inline-flex;
  flex: 0 0 4rem;
  font-weight: 700;
  height: 4rem;
  justify-content: center;
  letter-spacing: 0.08em;
  width: 4rem;
}

dl {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(7rem, 0.45fr) minmax(0, 1fr);
  max-width: 42rem;
}

dt,
dd {
  border-top: 1px solid var(--ledger-line);
  margin: 0;
  padding: 0.65rem 0;
}

dt {
  color: var(--muted);
  padding-right: 1rem;
}

table {
  border-collapse: collapse;
  margin-block: 1.5rem;
  table-layout: fixed;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--ledger-line);
  max-width: none;
  overflow-wrap: anywhere;
  padding: 0.75rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.totals-table {
  max-width: 42rem;
}

.simulation {
  font: inherit;
  letter-spacing: inherit;
}

details {
  border-top: 1px solid var(--ledger-line);
  max-width: 42rem;
  padding-block: 0.5rem;
}

summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  min-height: 44px;
}

.site-footer {
  border-top: 1px solid var(--ledger-line);
  padding-block: 2rem 3rem;
}

.site-footer p {
  color: var(--muted);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

@media (max-width: 47.99rem) {
  table,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  tbody tr {
    border-top: 1px solid var(--ledger-line);
    padding-block: 0.6rem;
  }

  tbody th,
  tbody td {
    border-bottom: 0;
    padding-block: 0.3rem;
  }

  td[data-label]::before {
    color: var(--muted);
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
  }

}

@media (min-width: 60rem) {
  .phase-strip {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .home-hero {
    display: grid;
    gap: 5rem;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    padding-block: 4rem;
  }

  .home-hero > section {
    border-top: 0;
    padding-block: 0;
  }

  .actions {
    display: grid;
    gap: 3rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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