:root {
  --bg: #f5f2ea;
  --fg: #1c2733;
  --muted: #d8d2c8;
  --border: #506070;
  --accent: #8c2f39;
  --accent-soft: #6e7f80;
  --hover: #ece7de;
  --meta: #66717a;
  --line: rgba(80, 96, 112, 0.2);
  --paper-grain:
    radial-gradient(circle at 1px 1px, rgba(80, 96, 112, 0.08) 1px, transparent 0);
  --paper-lines:
    linear-gradient(to bottom, rgba(80, 96, 112, 0.06), rgba(80, 96, 112, 0.06) 1px, transparent 1px, transparent 28px);
  --offset-shadow: 6px 6px 0 0 var(--muted);
  --shell-width: min(1320px, calc(100vw - 32px));
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    var(--paper-grain),
    linear-gradient(to right, rgba(80, 96, 112, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(80, 96, 112, 0.08) 1px, transparent 1px);
  background-size: 12px 12px, 96px 96px, 96px 96px;
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.55;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  text-transform: uppercase;
}

.skip-link:focus {
  top: 12px;
}

.shell {
  width: var(--shell-width);
  margin: 0 auto;
}

.meta-line,
.section-code,
.record-badge,
.status-strip__label,
.flow-step__index,
.process-table__row--head,
.hero-ledger dt {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.portal-header {
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1)),
    var(--paper-lines),
    var(--bg);
}

.portal-header__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: end;
  padding: 20px 0 18px;
}

.portal-brand__title,
.hero__title,
.section-heading h2,
.dossier-card h3,
.document-card h3,
.review-card h3,
.notice-sheet h3,
.flow-detail h3 {
  margin: 0;
  font-family: "Playfair Display", "Times New Roman", serif;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.portal-brand__title {
  font-size: clamp(1.55rem, 2.2vw, 2.35rem);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.portal-brand__subtitle {
  margin: 6px 0 0;
  color: var(--meta);
  font-size: 1rem;
}

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.portal-nav a {
  border: 1px solid var(--border);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.32);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
}

.portal-nav a:hover,
.portal-nav a:focus-visible {
  background: var(--hover);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--muted);
}

.status-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.34);
}

.status-strip__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.status-strip__grid p {
  margin: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.status-strip__grid p:last-child {
  border-right: 0;
}

.status-strip__label {
  color: var(--meta);
}

.hero {
  padding: 28px 0 22px;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(320px, 4fr);
  gap: 20px;
}

.hero__content,
.hero__aside,
.overview-card,
.flow-list,
.flow-detail,
.document-card,
.review-card,
.notice-sheet {
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.42);
  background-image: var(--paper-lines);
}

.hero__content {
  padding: clamp(24px, 3vw, 40px);
  position: relative;
}

.hero__content .section-code,
.hero__content .hero__title,
.hero__content .hero-terminal,
.hero__content .hero__lede,
.hero__content .hero__actions,
.hero__content .hero-ledger,
.hero__aside {
  opacity: 0;
}

.hero__content::after {
  content: none;
  display: none;
}

.section-code {
  margin: 0 0 14px;
  color: var(--accent-soft);
  animation: heroReveal 0.62s cubic-bezier(0.19, 1, 0.22, 1) 0.04s forwards;
}

.hero__title {
  max-width: none;
  line-height: 1;
  animation: heroReveal 0.78s cubic-bezier(0.19, 1, 0.22, 1) 0.14s forwards;
}

.hero__title-main,
.hero__title-sub {
  display: block;
}

.hero__title-main {
  font-size: clamp(2.15rem, 4vw, 4rem);
  white-space: nowrap;
  letter-spacing: -0.03em;
  line-height: 0.94;
}

.hero__title-sub {
  margin-top: clamp(12px, 1.6vw, 22px);
  font-size: clamp(2.5rem, 4.8vw, 4.8rem);
  letter-spacing: -0.02em;
  line-height: 0.92;
}

.hero-terminal {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid rgba(80, 96, 112, 0.32);
  background:
    linear-gradient(to right, rgba(80, 96, 112, 0.05), rgba(80, 96, 112, 0)),
    rgba(245, 242, 234, 0.72);
  animation: heroReveal 0.7s cubic-bezier(0.19, 1, 0.22, 1) 0.2s forwards;
}

.hero-terminal__row,
.hero-terminal__meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.hero-terminal__row {
  border-bottom: 1px solid rgba(80, 96, 112, 0.26);
}

.hero-terminal__label,
.hero-terminal__meta span {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--meta);
}

.hero-terminal__typing,
.hero-terminal__meta strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-terminal__typing {
  min-height: 1.4em;
  color: var(--fg);
}

.hero-terminal__cursor {
  width: 9px;
  height: 1.1em;
  background: var(--accent);
  animation: terminalCursorBlink 1s steps(1, end) infinite;
}

.hero-terminal__meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-terminal__meta p {
  margin: 0;
  display: grid;
  gap: 6px;
  padding-right: 10px;
  border-right: 1px solid rgba(80, 96, 112, 0.22);
}

.hero-terminal__meta p:last-child {
  border-right: 0;
  padding-right: 0;
}

.hero__lede {
  margin: 22px 0 0;
  max-width: 62ch;
  font-size: 1.05rem;
  animation: heroReveal 0.72s cubic-bezier(0.19, 1, 0.22, 1) 0.3s forwards;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  animation: heroReveal 0.68s cubic-bezier(0.19, 1, 0.22, 1) 0.4s forwards;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button:hover,
.button:focus-visible {
  background: var(--hover);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 var(--muted);
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.button--primary:hover,
.button--primary:focus-visible {
  background: color-mix(in srgb, var(--accent) 88%, black 12%);
  box-shadow: 4px 4px 0 0 rgba(140, 47, 57, 0.25);
}

.hero-ledger {
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  animation: heroReveal 0.74s cubic-bezier(0.19, 1, 0.22, 1) 0.5s forwards;
}

.hero-ledger div {
  padding: 12px 12px 10px;
  border: 1px solid rgba(80, 96, 112, 0.35);
  background: rgba(245, 242, 234, 0.8);
  opacity: 0;
  transform: translateY(12px);
  animation: heroReveal 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.hero-ledger div:nth-child(1) {
  animation-delay: 0.5s;
}

.hero-ledger div:nth-child(2) {
  animation-delay: 0.58s;
}

.hero-ledger div:nth-child(3) {
  animation-delay: 0.66s;
}

.hero-ledger dt {
  color: var(--meta);
}

.hero-ledger dd {
  margin: 10px 0 4px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
}

.hero-ledger span {
  color: var(--meta);
  font-size: 0.92rem;
}

.hero__aside {
  padding: 14px;
  transform: translate(18px, 10px);
  animation: heroRevealSide 0.84s cubic-bezier(0.19, 1, 0.22, 1) 0.26s forwards;
}

.dossier-card {
  display: grid;
  gap: 16px;
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.16)),
    var(--paper-lines),
    var(--bg);
  box-shadow: var(--offset-shadow);
  position: relative;
  overflow: hidden;
}

.dossier-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), rgba(140, 47, 57, 0.08));
  transform: scaleX(0);
  transform-origin: left center;
  animation: heroScanLine 0.9s cubic-bezier(0.19, 1, 0.22, 1) 0.62s forwards;
}

.dossier-card__header,
.dossier-card__footer {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.record-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(140, 47, 57, 0.08);
}

.dossier-card__block {
  padding-top: 14px;
  border-top: 1px solid rgba(80, 96, 112, 0.28);
}

.dossier-card__block h3 {
  font-size: 1.55rem;
}

.dossier-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.dossier-list li + li {
  margin-top: 8px;
}

.dossier-card__footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(80, 96, 112, 0.28);
}

.dossier-card__footer p {
  margin: 0;
  display: grid;
  gap: 6px;
}

.dossier-card__footer span {
  color: var(--meta);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 12px;
}

.overview-card,
.document-card,
.review-card,
.notice-sheet {
  padding: 18px;
}

.overview-card h3,
.document-card h3,
.review-card h3,
.notice-sheet h3 {
  font-size: 1.7rem;
  margin-top: 10px;
}

.section {
  padding: 34px 0 48px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.section-summary {
  margin: 0;
  color: var(--meta);
}

.flow-layout {
  display: grid;
  grid-template-columns: minmax(300px, 4fr) minmax(0, 8fr);
  gap: 16px;
  padding-top: 18px;
}

.flow-list {
  display: grid;
}

.flow-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 15px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  color: var(--fg);
}

.flow-step:last-child {
  border-bottom: 0;
}

.flow-step:hover,
.flow-step:focus-visible {
  background: var(--hover);
}

.flow-step.is-active {
  background: rgba(140, 47, 57, 0.07);
}

.flow-step__index {
  color: var(--accent);
}

.flow-step__body {
  display: grid;
  gap: 4px;
}

.flow-step__body strong {
  font-size: 0.98rem;
}

.flow-step__body span {
  color: var(--meta);
  font-size: 0.92rem;
}

.flow-detail {
  padding: 22px;
  box-shadow: var(--offset-shadow);
}

.flow-detail__header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.flow-detail__header h3 {
  margin-top: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

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

.flow-detail__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 18px;
}

.flow-detail__actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 18px;
}

.flow-detail__enter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #f5f2ea;
  font-family: "Inter", "Noto Sans SC", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.flow-detail__enter-button:hover,
.flow-detail__enter-button:focus-visible {
  background: #762730;
  color: #f5f2ea;
  transform: translate(-2px, -2px);
}

.flow-detail__grid section {
  padding: 14px;
  border: 1px solid rgba(80, 96, 112, 0.35);
  background: rgba(245, 242, 234, 0.82);
}

.flow-detail__grid h4 {
  margin: 0 0 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.flow-detail__grid ul {
  margin: 0;
  padding-left: 18px;
}

.document-grid,
.review-grid,
.notes-layout {
  display: grid;
  gap: 16px;
  padding-top: 18px;
}

.document-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.review-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.notes-layout {
  grid-template-columns: 1.2fr 1fr 1fr;
}

.document-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.document-card ul,
.portal-footer ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.document-card li + li,
.portal-footer li + li {
  margin-top: 6px;
}

.process-table {
  margin-top: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.42);
}

.process-table__row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1.4fr 1fr;
}

.process-table__row > span {
  padding: 13px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.process-table__row > span:last-child {
  border-right: 0;
}

.process-table__row:last-child > span {
  border-bottom: 0;
}

.process-table__row--head {
  background: rgba(80, 96, 112, 0.08);
}

.section--notes {
  padding-bottom: 42px;
}

.portal-footer {
  border-top: 1px solid var(--border);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.08)),
    var(--paper-lines),
    var(--bg);
}

.portal-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  padding: 20px 0 28px;
}

.portal-footer__grid > div {
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.34);
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroRevealSide {
  from {
    opacity: 0;
    transform: translate(18px, 10px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes heroGridIn {
  from {
    opacity: 0;
    transform: translate(12px, 12px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes heroScanLine {
  from {
    transform: scaleX(0);
    opacity: 0.4;
  }

  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes terminalCursorBlink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 1120px) {
  .hero__grid,
  .flow-layout,
  .document-grid,
  .review-grid,
  .notes-layout,
  .portal-footer__grid {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    grid-template-columns: 1fr;
  }

  .flow-detail__grid {
    grid-template-columns: 1fr;
  }

  .flow-detail__actions {
    justify-content: stretch;
  }

  .flow-detail__enter-button {
    width: 100%;
  }

  .process-table__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .portal-header__inner {
    grid-template-columns: 1fr;
  }

  .portal-nav {
    justify-content: flex-start;
  }

  .status-strip__grid,
  .hero-ledger {
    grid-template-columns: 1fr;
  }

  .status-strip__grid p {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .status-strip__grid p:last-child {
    border-bottom: 0;
  }

  .hero__content,
  .flow-detail,
  .overview-card,
  .document-card,
  .review-card,
  .notice-sheet {
    padding: 16px;
  }

  .hero__title {
    max-width: none;
  }

  .hero__title-main {
    white-space: normal;
  }

  .hero-terminal__row,
  .hero-terminal__meta {
    grid-template-columns: 1fr;
  }

  .hero-terminal__cursor {
    display: none;
  }

  .hero-terminal__meta p {
    padding-right: 0;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(80, 96, 112, 0.18);
  }

  .hero-terminal__meta p:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .button {
    width: 100%;
  }

  .hero__actions {
    flex-direction: column;
  }

  .process-table__row {
    grid-template-columns: 1fr;
  }

  .process-table__row > span {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .hero__content .section-code,
  .hero__content .hero__title,
  .hero__content .hero-terminal,
  .hero__content .hero__lede,
  .hero__content .hero__actions,
  .hero__content .hero-ledger,
  .hero-ledger div,
  .hero__aside,
  .hero__content::after {
    opacity: 1;
    transform: none;
  }

  .hero__content::after {
    display: none !important;
  }
}
