:root {
  color-scheme: light;
  --paper: #f1eee7;
  --ink: #262b26;
  --muted: #575b50;
  --line: #d5cfc1;
  --rust: #a14f38;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", "STSong", serif;
  --sans: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

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

body {
  margin: 0;
  min-block-size: 100vh;
  background: radial-gradient(ellipse at 53% 0%, #f9f6f0, transparent 65%);
}

button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }

.frame {
  width: min(84rem, 100% - clamp(2rem, 11vw, 10rem));
  margin-inline: auto;
  padding-block: clamp(1.4rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4.5rem);
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: clamp(1rem, 2.3vw, 1.6rem);
  margin-bottom: clamp(.75rem, 1.55vw, 1.35rem);
}

.home-link {
  display: inline-flex;
  border-radius: 50%;
}

.seal {
  display: grid;
  place-items: center;
  width: 2.6rem;
  aspect-ratio: 1;
  border: 1px solid var(--rust);
  color: var(--rust);
  border-radius: 50%;
}

.quiet-button {
  min-height: 2.6rem;
  padding: .35rem .65rem;
  margin-right: -.65rem;
  border: 0;
  color: var(--muted);
  background: none;
  font-size: .875rem;
}

.quiet-button:hover { color: var(--rust); }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-block-size: clamp(24rem, 67svh, 45rem);
  padding: clamp(2.1rem, 6.2vw, 5.9rem);
  overflow: hidden;
  border-radius: .4rem;
  color: #fffaf0;
  background: #1a212c;
  box-shadow: 0 15px 35px -25px #292b25a6;
}

.hero[data-state="mountain"] { background: #202b21; }
.hero[data-state="river"] { background: #122b2c; }

.landscape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 54%;
  animation: settle 4.8s cubic-bezier(.18, .6, .2, 1) both;
}

.hero[data-state="mist"] .landscape { object-position: 50% 35%; }

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero::before {
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, #10171dc9, #10171d47 45%, transparent 80%),
    linear-gradient(0deg, #0a121a8c, transparent 54%);
}

.hero::after {
  z-index: 1;
  inset: clamp(.55rem, 1.4vw, 1.05rem);
  border: 1px solid #f7eee340;
  border-radius: .16rem;
}

.hero-copy { position: relative; z-index: 2; }

.current {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: fit-content;
  margin: 0 0 clamp(.9rem, 2vw, 1.5rem);
  padding: .4rem .7rem .4rem .75rem;
  border: 1px solid #fef8eca6;
  border-radius: 2rem;
  background: #13191e70;
  font-size: .875rem;
  letter-spacing: .16em;
}

.current span {
  width: .37rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e8b38d;
  box-shadow: 0 0 .55rem #e8b38d6e;
}

.hero h1 {
  margin: 0;
  font: 500 clamp(3rem, 8.1vw, 8.25rem)/1.05 var(--serif);
  letter-spacing: .075em;
  text-shadow: 0 3px 28px #0a151965;
  animation: arrive .65s ease-out both;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .8rem 1.5rem;
  padding-block: 1.2rem;
  margin-top: 1rem;
  border-bottom: 1px solid var(--line);
}

.controls h2 {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}

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

.state-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  min-width: 6.5rem;
  padding: .5rem .85rem;
  border: 1px solid #c5beaf;
  border-radius: .22rem;
  color: var(--ink);
  background: #f8f4ec;
  font-size: .9rem;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}

.state-button:hover { border-color: var(--rust); }
.state-button[aria-current="true"] { border-color: #27332c; background: #27332c; color: #fffaf0; }
.state-button .motif { flex: none; width: 1.1rem; height: 1.1rem; }

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  min-block-size: clamp(29rem, 65svh, 39rem);
  border: 1px solid var(--line);
  border-radius: .4rem;
  overflow: hidden;
  background: #f9f6ef;
}

.login-art { position: relative; overflow: hidden; background: #1a212c; }
.login-art .landscape { object-position: 66% center; }
.login-art::after { content: ""; position: absolute; inset: .8rem; border: 1px solid #f7eee350; }

.login-content {
  align-self: center;
  justify-self: center;
  width: min(100%, 29rem);
  padding: clamp(1.5rem, 5vw, 4.2rem);
}

.login-content h1 { margin: 0 0 1.65rem; font: 500 clamp(2.25rem, 4.7vw, 4rem)/1.1 var(--serif); letter-spacing: .12em; }
.login-form { display: grid; gap: 1rem; }
.login-form label { display: grid; gap: .45rem; color: var(--muted); font-size: .9rem; }

.login-form input {
  min-height: 2.8rem;
  min-width: 0;
  padding: .5rem .7rem;
  border: 1px solid #c5beaf;
  border-radius: .18rem;
  background: #fffdf8;
  color: var(--ink);
  font-size: 1rem;
}

.primary-button {
  min-height: 2.85rem;
  margin-top: .35rem;
  border: 1px solid #27332c;
  border-radius: .18rem;
  background: #27332c;
  color: #fffaf0;
  letter-spacing: .1em;
  transition: background .2s;
}

.primary-button:hover { background: #3b4d41; }
.form-error { margin: 0; color: #8d3327; font-size: .9rem; }

@keyframes settle { from { transform: scale(1.041); } to { transform: scale(1); } }
@keyframes arrive { from { opacity: .5; transform: translateY(.35rem); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 42rem) {
  .hero { min-block-size: clamp(23rem, 70svh, 40rem); }
  .hero[data-state] .landscape { object-position: 61% center; }
  .hero::before { background: linear-gradient(0deg, #0a121ae0, #0a121a38 49%, transparent 76%); }
  .state-options { flex: 1 0 100%; }
  .state-button { min-width: 0; padding-inline: .25rem; }
  .login-panel { grid-template-columns: 1fr; min-block-size: 0; }
  .login-art { min-block-size: clamp(9.5rem, 26svh, 14rem); }
  .login-art .landscape { object-position: 50% 40%; }
  .login-content { padding-block: 1.6rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
