:root {
  --bg-0: #0b0a09;
  --bg-1: #15130f;
  --bg-2: #1a1712;
  --ink: #f4f1ea;
  --ink-dim: rgba(244, 241, 234, 0.68);
  --ink-faint: rgba(244, 241, 234, 0.55);
  --divider: rgba(244, 241, 234, 0.1);
  --accent: #b68235;
  --accent-300: #facb8d;
  --font-heading: "Cormorant Garamond", Georgia, serif;
  --font-body: "Lora", Georgia, serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
}

.frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 60% at 50% 0%, #1b1813 0%, var(--bg-0) 70%);
}

/* --- header --- */

.app-header {
  height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--divider);
  animation: fadeIn 0.25s ease both;
}

.back {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, 0.22);
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.back:active {
  background: rgba(182, 130, 53, 0.28);
  border-color: var(--accent);
}

.app-header-title {
  font-family: var(--font-heading);
  font-size: 20px;
}

.app-header-mark {
  margin-left: auto;
  width: 22px;
  height: 22px;
  color: rgba(244, 241, 234, 0.55);
}

.app-header-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- scroll body --- */

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen {
  animation: fadeIn 0.35s ease both;
}

/* --- home --- */

.screen-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: 24px 0 8px;
}

.bg-guilloche {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: fadeIn 2.4s ease 0.4s both;
}

.orbit-cw {
  transform-box: fill-box;
  animation: orbitCw 420s linear infinite;
}

.orbit-ccw {
  transform-box: fill-box;
  animation: orbitCcw 560s linear infinite;
}

.mark-orbits .orbit-cw {
  animation-duration: 110s;
}

.mark-orbits .orbit-ccw {
  animation-duration: 176s;
}

.speck {
  animation: twinkle 8s ease-in-out infinite;
}

.mark-field {
  position: relative;
  width: min(366px, 92vw);
  aspect-ratio: 1;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark-orbits {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.mark-halo {
  position: absolute;
  width: 68%;
  height: 68%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(182, 130, 53, 0.22) 0%, rgba(182, 130, 53, 0) 62%);
  animation: halo 8s ease-in-out infinite;
}

.mark-wrap {
  position: relative;
  width: 36%;
  height: 36%;
  animation: fadeIn 0.8s ease 0.2s both, sway 13s ease-in-out 1.7s infinite;
  transform-style: preserve-3d;
}

#mark-ring-outer,
#mark-ring-inner {
  stroke-dasharray: 347;
  stroke-dashoffset: 347;
  transform-origin: 60px 60px;
  transform: rotate(-90deg);
  animation: mintRing 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) 0.15s forwards;
}

#mark-ring-inner {
  stroke-dasharray: 298;
  stroke-dashoffset: 298;
}

#mark-notches line {
  opacity: 0;
  animation: mintNotch 0.22s ease forwards;
}

#mark-letter {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: mintLetter 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 1s forwards;
}

.mark-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.node-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.node {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  gap: 11px;
  animation: nodeIn 0.6s ease both;
}

.node:nth-child(1) { animation-delay: 0.5s; }
.node:nth-child(2) { animation-delay: 0.6s; }
.node:nth-child(3) { animation-delay: 0.7s; flex-direction: column; }
.node:nth-child(4) { animation-delay: 0.8s; flex-direction: column; }

.node-dot {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, 0.22);
  background: radial-gradient(circle at 50% 30%, #241e15 0%, var(--bg-1) 78%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.node:active .node-dot {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(182, 130, 53, 0.5);
}

.node-num {
  font-family: var(--font-heading);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: rgba(244, 241, 234, 0.82);
}

.node-label {
  font-family: var(--font-heading);
  font-size: 18px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  animation: fadeIn 0.8s ease 0.9s both;
}

.brand-word {
  font-family: var(--font-heading);
  font-weight: 300;
  font-size: 30px;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
}

.brand-rule {
  width: 118px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform-origin: center;
  animation: sweep 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 1s both;
}

.brand-tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-dim);
}

.home-footer {
  width: 100%;
  margin-top: auto;
  padding: 22px 22px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* --- sub-screens --- */

.screen-sub {
  padding: 22px 22px 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  text-align: justify;
  color: var(--ink-dim);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--divider);
}

/* --- partner cards --- */

.partner-card {
  background: var(--bg-1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.partner-top {
  display: flex;
  align-items: center;
  gap: 15px;
}

.partner-initial {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid rgba(182, 130, 53, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 21px;
  color: var(--accent-300);
}

.partner-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.partner-name {
  font-family: var(--font-heading);
  font-size: 20px;
}

.partner-spec {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-dim);
}

.partner-rating {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.partner-rating-value {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--accent-300);
}

.partner-rating-label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.partner-bottom {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.partner-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.partner-stat span:first-child {
  font-size: 13px;
}

.partner-stat span:last-child {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.partner-handle {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-300);
  border: 1px solid rgba(182, 130, 53, 0.5);
  padding: 8px 14px;
}

/* --- catalog / ledger --- */

.ledger-panel {
  margin: 0;
  border: 1px solid var(--divider);
  padding: 26px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: linear-gradient(180deg, #191610 0%, var(--bg-1) 100%);
}

.ledger-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 18px;
}

.ledger-title {
  font-family: var(--font-heading);
  font-size: 24px;
  letter-spacing: 0.08em;
}

.ledger-updated {
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.ledger-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ledger-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ledger-group-num {
  font-family: var(--font-heading);
  font-size: 12px;
  color: var(--accent-300);
}

.ledger-group-name {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.ledger-group-rule {
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.ledger-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}

.ledger-row-name {
  font-size: 13.5px;
  white-space: nowrap;
}

.ledger-row-dots {
  flex: 1;
  border-bottom: 1px dotted rgba(244, 241, 234, 0.28);
  transform: translateY(-3px);
}

.ledger-row-rate {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--accent-300);
  white-space: nowrap;
}

.ledger-row-by {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 6px;
}

.ledger-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}

.ledger-foot-note {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-dim);
}

/* --- faq --- */

.faq-item {
  background: var(--bg-1);
}

.faq-question {
  width: 100%;
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 19px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.faq-num {
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--accent-300);
  flex: none;
  padding-top: 3px;
}

.faq-q-text {
  font-family: var(--font-heading);
  font-size: 18px;
  line-height: 1.35;
  flex: 1;
}

.faq-chevron {
  flex: none;
  padding-top: 4px;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.faq-item.open .faq-answer {
  max-height: 260px;
}

.faq-answer p {
  margin: 0;
  padding: 0 20px 22px 47px;
  font-size: 12.5px;
  line-height: 1.75;
  text-align: justify;
  color: var(--ink-dim);
}

/* --- chat screen --- */

.screen-chat {
  align-items: center;
  text-align: center;
  padding-top: 40px;
}

.chat-mark {
  width: 84px;
  height: 84px;
  display: block;
}

.chat-mark svg {
  width: 100%;
  height: 100%;
}

.chat-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 27px;
  font-weight: 400;
  line-height: 1.25;
}

.chat-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 30ch;
}

.chat-stats {
  width: 100%;
}

.stat-row {
  background: var(--bg-1);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}

.stat-row span:first-child {
  color: var(--ink-dim);
}

.status {
  margin: 0;
  font-size: 13px;
  color: var(--ink-dim);
  min-height: 1.2em;
}

.cta {
  width: 100%;
  appearance: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-300);
  padding: 16px 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.cta:active {
  background: rgba(182, 130, 53, 0.3);
}

.empty-note {
  font-size: 12px;
  color: var(--ink-dim);
}

/* --- home indicator --- */

.home-indicator {
  flex: none;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-indicator span {
  width: 128px;
  height: 4px;
  border-radius: 2px;
  background: rgba(244, 241, 234, 0.22);
}

/* --- animations --- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nodeIn {
  from { opacity: 0; filter: blur(3px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes sweep {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes halo {
  0%, 100% { opacity: 0.26; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.07); }
}

@keyframes orbitCw {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes orbitCcw {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.85; }
}

@keyframes sway {
  0%, 100% { transform: perspective(620px) rotateY(0deg) rotateX(0deg) scale(1); }
  22% { transform: perspective(620px) rotateY(5.5deg) rotateX(-2.6deg) scale(1.012); }
  48% { transform: perspective(620px) rotateY(0deg) rotateX(3deg) scale(1); }
  74% { transform: perspective(620px) rotateY(-5.5deg) rotateX(-1.8deg) scale(1.012); }
}

@keyframes mintRing {
  to { stroke-dashoffset: 0; }
}

@keyframes mintNotch {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mintLetter {
  0% { opacity: 0; transform: scale(1.5); }
  55% { opacity: 0; transform: scale(1.16); }
  100% { opacity: 1; transform: scale(1); }
}
