:root {
  --ink: #16241f;
  --ink-soft: #2c4038;
  --mist: #e8efe9;
  --paper: #f4f7f4;
  --sand: #d9c4a0;
  --gold: #b8923a;
  --teal: #1f5c56;
  --teal-deep: #0f2e2b;
  --line: rgba(22, 36, 31, 0.12);
  --shadow: 0 18px 50px rgba(15, 46, 43, 0.18);
  --radius: 18px;
  --font-display: "Noto Serif SC", "Newsreader", Georgia, serif;
  --font-body: "Noto Sans SC", "Helvetica Neue", sans-serif;
  --max: 1080px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--paper);
  line-height: 1.65;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(184, 146, 58, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 45% at 85% 20%, rgba(31, 92, 86, 0.18), transparent 50%),
    linear-gradient(180deg, #dfece6 0%, var(--paper) 42%, #eef3ee 100%);
}

.horizon {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 18vh;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(31, 92, 86, 0.35), transparent);
  transform: scaleX(0.96);
  animation: horizon-breathe 8s ease-in-out infinite;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@keyframes horizon-breathe {
  0%, 100% { opacity: 0.45; transform: scaleX(0.94); }
  50% { opacity: 0.85; transform: scaleX(1); }
}

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

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 10vw, 6.5rem) 1.5rem 2.5rem;
  text-align: center;
  animation: rise 0.9s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--teal-deep);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.lede {
  max-width: 28em;
  margin: 1rem auto 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  opacity: 0.88;
}

.north-star {
  max-width: 22em;
  margin: 1.25rem auto 0;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--teal-deep);
  line-height: 1.5;
}

.charter {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background: rgba(15, 46, 43, 0.04);
  border: 1px solid var(--line);
  text-align: left;
  animation: rise 1s 0.16s ease both;
}

.charter-north {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--teal-deep);
}

.charter-layers {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.charter-layers li {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.charter-k {
  display: inline-block;
  min-width: 4.5em;
  margin-right: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--gold);
}

.progress-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.75rem;
  text-align: left;
  animation: rise 1.1s 0.15s ease both;
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 8;
}

.ring-track {
  stroke: rgba(31, 92, 86, 0.12);
}

.ring-fill {
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.8s ease;
}

.progress-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  align-items: baseline;
  gap: 0.15rem;
  font-family: var(--font-display);
  color: var(--teal-deep);
}

#count-current {
  font-size: 2rem;
  font-weight: 700;
}

.progress-sep,
#count-goal {
  font-size: 1rem;
  opacity: 0.65;
}

.progress-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--teal-deep);
}

.progress-hint {
  margin: 0.35rem 0 0;
  max-width: 16em;
  color: var(--ink-soft);
  font-size: 0.95rem;
  opacity: 0.8;
}

.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.site-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  animation: rise 1s 0.18s ease both;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.45);
}

.site-nav a[aria-current="page"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #f7fbf9;
}

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

.principle-list {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
}

.gov-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  animation: rise 1s 0.2s ease both;
}

.gov-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.gov-chip {
  display: grid;
  gap: 0.1rem;
  min-width: 4.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: rgba(31, 92, 86, 0.06);
}

.gov-chip .k {
  font-size: 0.72rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

.gov-chip .v {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--teal-deep);
}

.gov-chip.warn {
  background: rgba(184, 146, 58, 0.18);
}

.gov-chip.warn .v {
  color: #8a6a1f;
}

.gov-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  animation: rise 1s 0.25s ease both;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 86, 0.35);
}

.filter-chip[aria-selected="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #f7fbf9;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.status-filter select,
.modal-body select,
.modal-body input,
.modal-body textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.status-filter select {
  width: auto;
  min-width: 8.5rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--mist);
}

.btn-primary:hover {
  background: var(--teal-deep);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.75rem;
  animation: rise 1s 0.35s ease both;
}

.stat-card {
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
}

.stat-card .name {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.8;
}

.stat-card .num {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--teal-deep);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.55s ease both;
}

.item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.item-expired {
  border-color: rgba(184, 146, 58, 0.55);
  background: rgba(255, 248, 230, 0.7);
}

.lane-dormant,
.lane-archived {
  opacity: 0.78;
}

.tag-warn {
  background: rgba(184, 146, 58, 0.22) !important;
  color: #7a5c14 !important;
}

.tag-origin-self {
  background: rgba(31, 92, 86, 0.14) !important;
  color: var(--teal-deep) !important;
}

.tag-origin-borrowed {
  background: rgba(61, 90, 128, 0.14) !important;
  color: #3d5a80 !important;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.form-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.form-hint.warn {
  color: #8a6a1f;
  opacity: 1;
}

.modal-wide {
  width: min(560px, 100%);
}

.modal-panel.modal-wide {
  width: min(560px, 100%);
}

.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.review-item {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.review-item h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.review-item p {
  margin: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.review-item.reviewed {
  opacity: 0.65;
  border-color: rgba(31, 92, 86, 0.35);
}

.item-index {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  min-width: 2ch;
  padding-top: 0.15rem;
}

.item-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(31, 92, 86, 0.08);
  color: var(--ink-soft);
}

.tag-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.item-note {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  opacity: 0.9;
}

.item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.item-date {
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.65;
  white-space: nowrap;
}

.item-actions {
  display: flex;
  gap: 0.35rem;
}

.item-actions button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 3.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  opacity: 0.8;
}

.footer code {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: rgba(31, 92, 86, 0.08);
}

.footer-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
}

.modal::backdrop {
  background: rgba(15, 46, 43, 0.45);
  backdrop-filter: blur(4px);
}

.modal-panel {
  width: min(440px, 100%);
  margin: auto;
  border-radius: 22px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.35s ease both;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.icon-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-body {
  display: grid;
  gap: 0.9rem;
  padding: 1.15rem 1.25rem;
}

.modal-body label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.modal-footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .progress-block {
    flex-direction: column;
    text-align: center;
  }

  .progress-hint {
    max-width: none;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: auto 1fr;
  }

  .item-side {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}
