/* Nations directory and nation pages */
.nations__intro { padding-top: clamp(7rem, 16vh, 10rem); }
.nations__body { padding: 1rem 0 5rem; }

.nations-toolbar { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.nations-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.nations-tab { display: inline-flex; align-items: center; gap: .5em; padding: .5em 1em; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 600 .9rem var(--font-body); cursor: pointer; transition: border-color .2s, color .2s; }
.nations-tab span { font-size: .8rem; padding: .05em .5em; border-radius: 5px; background: rgba(255, 255, 255, .06); }
.nations-tab:hover { color: var(--text); border-color: rgba(246, 237, 214, .3); }
.nations-tab.is-active { background: var(--cream); color: var(--navy-deep); border-color: var(--navy-deep); box-shadow: 0 3px 0 var(--navy-deep); }
.nations-tab.is-active span { background: rgba(3, 16, 36, .12); }
.nations-search { display: flex; align-items: center; gap: .5rem; padding: 0 .9rem; height: 42px; min-width: min(280px, 100%); border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.nations-search:focus-within { border-color: var(--cream); }
.nations-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }

.nations-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.nation-card[hidden] { display: none; }
.nation-card__link { position: relative; display: flex; align-items: center; gap: 1rem; height: 100%; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s, transform .2s; overflow: hidden; }
.nation-card__link::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .5; }
.nation-card.is-founded .nation-card__link::before { opacity: 1; }
.nation-card__link:hover { border-color: rgba(246, 237, 214, .3); transform: translateY(-2px); }
.nation-card__flag { flex: none; width: auto; height: 40px; max-width: 104px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 3px 8px rgba(0, 0, 0, .35); }
.nation-card__body { flex: 1; min-width: 0; }
.nation-card__name { margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nation-card__meta { margin: .1rem 0 0; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nation-badge { flex: none; display: inline-block; padding: .2em .65em; border-radius: 5px; font-size: .75rem; font-weight: 600; }
.nation-badge--available { background: rgba(255, 255, 255, .06); color: var(--muted); }
.nation-badge--public { background: rgba(95, 210, 138, .15); color: #7fe0a3; }
.nation-badge--private { background: rgba(217, 168, 64, .16); color: var(--gold-light); }

.nations-empty { text-align: center; padding: 4rem 1rem; }
.nations-empty--inline { padding: 2rem 0; }

/* Nation page */
.nation-hero { position: relative; padding: clamp(7rem, 15vh, 9rem) 0 2.5rem; overflow: hidden;
  background:
    radial-gradient(ellipse 55% 80% at 75% 45%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 70% at 30% 40%, rgba(13, 37, 80, .85), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(246, 237, 214, .035) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(246, 237, 214, .035) 47px 48px); }
.nation-hero::after { content: ''; position: absolute; inset: auto 0 0; height: 35%; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.nation-hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; }
.nation-hero__back { display: inline-block; margin-bottom: 1.2rem; color: var(--muted); font-size: .9rem; }
.nation-hero__back:hover { color: var(--cream); }
.nation-hero__flag { width: 120px; height: auto; border-radius: 6px; margin-bottom: 1rem; box-shadow: 0 0 0 2px var(--cream), 0 4px 0 2px var(--navy-deep), 0 12px 28px rgba(0, 0, 0, .45); }
.nation-hero__name { font-size: clamp(2.2rem, 5.5vw, 3.6rem); margin-bottom: .3em; overflow-wrap: anywhere; }
.nation-hero__motto { font-style: italic; color: #cfd4df; font-size: 1.1rem; margin-bottom: 1rem; }
.nation-hero__shape { width: clamp(180px, 26vw, 300px); filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .5)); }
.nation-hero__shape img { width: 100%; height: auto; }

.nation__body, .nation__offline { padding: 1rem 0 5rem; }
.nation__offline { padding-top: 8rem; }
.nation-stats { list-style: none; margin: 0 0 2.5rem; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.nation-stats li { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.nation-stats span { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.nation-stats strong { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; color: var(--cream); overflow-wrap: anywhere; }

.nation__columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2.5rem; align-items: start; }
.nation__heading { font-family: var(--font-display); font-weight: 400; color: var(--cream); font-size: 1.4rem; margin: 0 0 1rem; }
.nation__main .nation__heading:not(:first-child) { margin-top: 2.5rem; }
.nation__description { white-space: pre-line; color: #cfd4df; }
.nation__side { display: flex; flex-direction: column; gap: 1rem; }
.nation-panel { padding: 1.3rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.nation-panel h3 { font-size: 1.05rem; }
.nation-panel__cmd { display: block; padding: .6em .8em; margin-top: .3rem; overflow-wrap: anywhere; }

.nation-members { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.nation-member { display: flex; align-items: center; gap: .8rem; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.nation-member strong { display: block; margin-bottom: .2rem; }
.nation-member .tag { font-size: .75rem; }
.nation-member__frame { flex: none; width: 56px; height: 56px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; border: 2px solid var(--cream); box-shadow: 0 3px 0 var(--navy-deep); background: linear-gradient(180deg, var(--navy), var(--navy-deep)); }
.nation-member__frame img { width: 90%; height: 90%; object-fit: contain; }

@media (max-width: 820px) {
  .nation-hero__inner { grid-template-columns: 1fr; }
  .nation-hero__shape { display: none; }
  .nation__columns { grid-template-columns: 1fr; }
}
/* HyGlobe v1 additions (D-257): relations, avatar fallback, missing flag */
.nation-relations { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .4rem; }
.nation-relations a { color: var(--cream); }
.tag--ally { color: #f19ec2; }
.tag--enemy { color: #ff8a80; }
.nation-member__frame.is-initial { display: grid; place-items: center; font-family: var(--font-display); color: var(--cream); font-size: 1.6rem; }
span.nation-card__flag { display: block; width: 96px; height: 64px; border-radius: 4px; background: var(--accent, #333); opacity: .5; }
