/* Arcwyrd — website shell.
 *
 * Palette is sampled from the background art so the UI sits inside the image
 * rather than on top of it: near-black ground, cool blue-grey stone, and the
 * cyan/magenta/amber practicals used sparingly as accents.
 *
 * The whole file assumes light text on a dark photograph, which is the hard
 * case for legibility. Every text surface therefore sits on either the scrim
 * or a panel, never directly on the image.
 */

:root {
  --ink:        #e8edf2;   /* body text */
  --ink-dim:    #9aa7b4;   /* secondary text */
  --ink-faint:  #6b7885;   /* hints, footer */
  --ground:     #070a0d;
  --panel:      rgba(10, 14, 19, 0.82);
  --panel-edge: rgba(150, 190, 215, 0.16);
  --field:      rgba(4, 7, 10, 0.72);
  --cyan:       #6fd8ea;
  --magenta:    #e87ab6;
  --amber:      #e8a555;
  --focus:      #6fd8ea;
}

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

html { -webkit-text-size-adjust: 100%; }

body.aw-shell {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

/* ── background ─────────────────────────────────────────────────────────── */
/* Fixed layer, not a body background: on mobile, a body background repaints
   and jumps every time the URL bar hides. */
.aw-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("../images/bg-seam.webp");
  background-size: cover;
  background-position: 58% center;   /* keeps the lit arch in frame when cropped */
  background-repeat: no-repeat;
  background-color: var(--ground);
}

/* Small viewports get the smaller rendition and the portrait crop. */
@media (max-width: 900px) and (orientation: portrait) {
  .aw-bg {
    background-image: url("../images/bg-seam-portrait.webp");
    background-position: center;
  }
}
@media (max-width: 900px) and (orientation: landscape) {
  .aw-bg { background-image: url("../images/bg-seam-1200.webp"); }
}

/* The art is already dark, but not uniformly -- the neon panels on the right
   are bright enough to ruin body text. This darkens everything and adds a
   left-weighted gradient where the content sits. */
.aw-scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(100deg,
      rgba(4, 7, 10, 0.94) 0%,
      rgba(4, 7, 10, 0.86) 38%,
      rgba(4, 7, 10, 0.66) 70%,
      rgba(4, 7, 10, 0.78) 100%),
    radial-gradient(120% 90% at 50% 0%,
      rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.55) 100%);
}

/* ── layout ─────────────────────────────────────────────────────────────── */
.aw-main {
  flex: 1;
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem) 2rem;
}

.aw-hero { max-width: 40rem; margin-bottom: clamp(2rem, 5vw, 3.25rem); }

.aw-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.75rem, 9vw, 5rem);
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.05;
  color: #fff;
  /* Faint cyan bloom, echoing the luminous line in the stone. */
  text-shadow: 0 0 28px rgba(111, 216, 234, 0.32), 0 2px 18px rgba(0, 0, 0, 0.9);
}

.aw-lede {
  margin: 0 0 1rem;
  font-size: clamp(1.125rem, 2.4vw, 1.4rem);
  line-height: 1.5;
  color: #fff;
}
.aw-body { margin: 0 0 0.9rem; color: var(--ink-dim); max-width: 38rem; }

/* ── panels ─────────────────────────────────────────────────────────────── */
.aw-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}
@media (max-width: 820px) {
  .aw-panels { grid-template-columns: minmax(0, 1fr); }
}

.aw-panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  padding: clamp(1.25rem, 3vw, 1.9rem);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.aw-panel-h {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* ── forms ──────────────────────────────────────────────────────────────── */
.aw-form { display: block; }

.aw-label {
  display: block;
  margin: 1.1rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.aw-opt { color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }

.aw-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--field);
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;   /* 16px minimum, or iOS zooms the page on focus */
}
.aw-input:focus-visible,
.aw-btn:focus-visible,
.aw-class input:focus-visible + .aw-class-body {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.aw-note {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-faint);
}
.aw-note a { color: var(--cyan); }

/* ── class picker ───────────────────────────────────────────────────────── */
.aw-classes { border: 0; padding: 0; margin: 0 0 0.5rem; }
.aw-classes .aw-label { margin-top: 0; }

.aw-class { display: block; margin-bottom: 0.5rem; cursor: pointer; }
.aw-class input { position: absolute; opacity: 0; width: 0; height: 0; }

.aw-class-body {
  display: block;
  padding: 0.7rem 0.85rem;
  background: rgba(4, 7, 10, 0.5);
  border: 1px solid var(--panel-edge);
  border-left: 3px solid transparent;
  border-radius: 2px;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.aw-class:hover .aw-class-body { background: rgba(10, 18, 24, 0.7); }
.aw-class input:checked + .aw-class-body {
  background: rgba(14, 26, 33, 0.85);
  border-left-color: var(--cyan);
  border-color: rgba(111, 216, 234, 0.4);
}

.aw-class-name {
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  margin-right: 0.5rem;
}
.aw-class-role {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}
.aw-class-blurb {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-dim);
}

/* ── buttons ────────────────────────────────────────────────────────────── */
.aw-btn {
  display: inline-block;
  width: 100%;
  margin-top: 1.4rem;
  padding: 0.75rem 1.25rem;
  background: rgba(111, 216, 234, 0.08);
  border: 1px solid rgba(111, 216, 234, 0.45);
  border-radius: 2px;
  color: var(--cyan);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.aw-btn:hover { background: rgba(111, 216, 234, 0.18); color: #fff; }

.aw-btn-primary {
  background: rgba(232, 122, 182, 0.1);
  border-color: rgba(232, 122, 182, 0.5);
  color: var(--magenta);
}
.aw-btn-primary:hover { background: rgba(232, 122, 182, 0.2); color: #fff; }

/* ── messages, errors, footer ───────────────────────────────────────────── */
.aw-messages { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.aw-msg {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  background: rgba(10, 14, 19, 0.85);
  border-left: 3px solid var(--cyan);
  border-radius: 2px;
  font-size: 0.9rem;
}

.aw-errors { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.aw-errors li {
  font-size: 0.84rem;
  color: var(--magenta);
  padding: 0.2rem 0;
}

.aw-telnet { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--panel-edge); }

.aw-footer {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 2rem;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
.aw-footer a { color: var(--ink-faint); text-decoration: none; }
.aw-footer a:hover { color: var(--cyan); }
.aw-footer span { margin: 0 0.5rem; }

.aw-back { display: inline-block; margin-top: 1.25rem; font-size: 0.85rem; color: var(--cyan); }

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

/* ── character screen ───────────────────────────────────────────────────── */

.aw-hero-tight { margin-bottom: clamp(0.9rem, 2vw, 1.4rem); }
.aw-title-sm { font-size: clamp(1.75rem, 4.5vw, 2.5rem); margin-bottom: 0.5rem; }

/* Creation panel is the wider of the two: it holds three pieces of art. */
.aw-panels-chars { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 900px) {
  .aw-panels-chars { grid-template-columns: minmax(0, 1fr); }
}

/* ── class cards ────────────────────────────────────────────────────────── */
/* One class per row: portrait on the left, everything else in a column to its
   right. Flex rather than grid because the text is a single wrapper element --
   there is no second track to fill, and flex makes the "image is a fixed-width
   strip, text takes the rest" relationship explicit.

   The card's height is driven by the portrait, not by the text. Name and role
   share a line and the blurb sits under them, so the whole description fits
   beside a 104px image instead of pushing the card taller. */
.aw-class-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.aw-class-card { margin-bottom: 0; }

.aw-class-card .aw-class-body {
  display: flex;
  align-items: stretch;
  min-height: 104px;
  padding: 0;
  overflow: hidden;
  border-left-width: 1px;   /* card uses a full border, not the left bar */
}

.aw-class-art {
  flex: 0 0 78px;
  width: 78px;
  align-self: stretch;
  height: auto;
  object-fit: cover;
  /* Portraits are head-high; bias upward so the crop keeps the face. */
  object-position: 50% 16%;
  /* Unselected art sits back; selecting brings it forward. */
  filter: grayscale(0.5) brightness(0.68);
  transition: filter 140ms ease;
}
.aw-class:hover .aw-class-art { filter: grayscale(0.15) brightness(0.9); }
.aw-class input:checked + .aw-class-body .aw-class-art { filter: none; }

.aw-class-text {
  flex: 1 1 auto;
  min-width: 0;              /* lets long words wrap instead of widening the row */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.8rem;
}

.aw-class-card .aw-class-head { display: flex; align-items: baseline; gap: 0.5rem; }
.aw-class-card .aw-class-name { display: inline; margin-right: 0; }
.aw-class-card .aw-class-role { display: inline; }
.aw-class-card .aw-class-blurb {
  display: block;
  margin-top: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-dim);
}

.aw-class input:checked + .aw-class-body {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 26px rgba(111, 216, 234, 0.16);
}

/* Very narrow: a slimmer strip, and the blurb gets the space instead. */
@media (max-width: 420px) {
  .aw-class-art { flex-basis: 62px; width: 62px; }
  .aw-class-text { padding: 0.45rem 0.6rem; }
  .aw-class-card .aw-class-blurb { font-size: 0.74rem; }
}

/* ── existing characters ────────────────────────────────────────────────── */
.aw-charlist { list-style: none; margin: 0; padding: 0; }
.aw-charitem { margin-bottom: 0.6rem; }

.aw-charlink {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.75rem 0.55rem 0.55rem;
  background: rgba(4, 7, 10, 0.5);
  border: 1px solid var(--panel-edge);
  border-left: 3px solid transparent;
  border-radius: 2px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.aw-charlink:hover {
  background: rgba(14, 26, 33, 0.85);
  border-left-color: var(--cyan);
  border-color: rgba(111, 216, 234, 0.4);
  color: var(--ink);
}
.aw-charlink:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.aw-charface {
  width: 54px;
  height: 72px;
  object-fit: cover;
  object-position: 50% 22%;   /* portraits are head-high; bias upward */
  border-radius: 2px;
  display: block;
}
.aw-charface-blank { background: rgba(150, 190, 215, 0.1); }

.aw-chartext { display: block; min-width: 0; }
.aw-charname {
  display: block;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  overflow-wrap: anywhere;
}
.aw-charclass {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}
.aw-charenter {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  white-space: nowrap;
}

/* Logout must be a POST (Django 5 removed GET logout), but it should still
   read as one of the footer links rather than a button. */
.aw-logout { display: inline; margin: 0; }
.aw-logout button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink-faint);
  letter-spacing: inherit;
  cursor: pointer;
}
.aw-logout button:hover { color: var(--cyan); }
.aw-logout button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
