/* public/CSS/common.css
   Classes used on two or more pages: layout, boxes with title bars, leather
   buttons, forms, notices, ledgers (lists of rows), costs and figures.
   Loaded by every page (game, public and admin), after style.css. */

.container {
  width: 100%;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 14px;
  padding-left: 14px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  flex: none;
  color: var(--icon-color);
  vertical-align: -4px;
}

.muted { color: var(--muted-text); }
.positive { color: var(--positive-text); }
.negative { color: var(--negative-text); }
.small-text { font-size: 0.95rem; }

/* Page title: the heading of a page with its short line under it. */
.page-title {
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--box-border);
  margin-bottom: 14px;
}

.page-title p {
  margin-top: 4px;
  color: var(--muted-text);
  font-style: italic;
}

/* Boxes: the bordered blocks of every page, each with a tan title bar. */
/* The dove beside a player at peace with you (README decision 151). */
.peace-dove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--peace-dove);
  vertical-align: -4px;
}

/* A box that warns (enemies coming: the town page and the Army tab): a
   leather-red title bar with an icon and a countdown on its right. */
.panel.warning-panel {
  border-color: var(--damage-panel-border);
}

.panel-heading.warning-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  border-bottom-color: var(--damage-panel-border);
  background-image: linear-gradient(var(--damage-heading-top), var(--damage-heading-bottom));
  color: var(--damage-heading-text);
}

.warning-heading .icon,
.warning-heading h2 {
  color: var(--damage-heading-text);
}

.warning-heading-time {
  margin-left: auto;
  font-size: 0.95rem;
  font-weight: 400;
}

.panel {
  margin: 0 0 14px;
  padding: 12px 14px 14px;
  border: 1px solid var(--box-border);
  border-radius: 2px;
  background-color: var(--box-background);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 3px rgba(60, 35, 10, 0.15);
}

.panel-heading {
  margin: -12px -14px 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--box-border);
  background-image: linear-gradient(var(--box-heading-top), var(--box-heading-bottom));
  font-size: 1.2rem;
}

/* The boxes that fold away (on the town page and the building pages): a
   <details class="panel fold"> whose title bar is its <summary>; open unless
   the player folded it before (public/JS/fold-memory.js remembers it). The
   chevron in the title bar points down while open, to the side while folded. */
.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary h2 {
  font-size: inherit;
}

.fold:not([open]) > summary {
  margin-bottom: -14px;
  border-bottom: 0;
}

.fold:not([open]) .fold-mark {
  transform: rotate(-90deg);
}

.panel > p + p,
.panel > p + .button-row,
.panel > .ledger + p,
.panel > p + .ledger {
  margin-top: 10px;
}

/* Buttons: tooled leather with a dark edge. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--button-border);
  border-radius: 4px;
  background-image: linear-gradient(var(--secondary-button-top), var(--secondary-button-bottom));
  color: var(--secondary-button-text);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 0 rgba(0, 0, 0, 0.3);
}

.button:hover {
  color: var(--secondary-button-text);
  filter: brightness(1.12);
}

.button:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button-primary {
  background-image: linear-gradient(var(--primary-button-top), var(--primary-button-bottom));
  color: var(--primary-button-text);
}

.button-primary:hover {
  color: var(--primary-button-text);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.5);
}

.button .icon {
  color: inherit;
}

.button-small {
  min-height: 36px;
  padding: 4px 12px;
  font-size: 1rem;
}

.button-full {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row form {
  margin: 0;
}

/* Forms */
.form {
  display: grid;
  gap: 14px;
}

.field-hint {
  margin: -2px 0 6px;
  color: var(--muted-text);
  font-size: 0.95rem;
  font-style: italic;
}

.field-error {
  margin-top: 4px;
  color: var(--negative-text);
  font-size: 0.95rem;
}

.field-invalid input {
  border-color: var(--notice-error-border);
}

/* Notices after an action: a note pinned on the sheet. */
.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--box-border);
  border-left: 5px solid var(--notice-success-border);
  border-radius: 2px;
  background-color: var(--box-background);
}

.notice-error {
  border-left-color: var(--notice-error-border);
}

/* Ledger: rows with a name on the left and values on the right, striped. */
.ledger {
  margin: 0 -14px;
  list-style: none;
}

.ledger > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--sheet-inner-border);
}

.ledger > li:nth-child(even) {
  background-color: var(--row-alternate);
}

.ledger > li:last-child {
  border-bottom: 0;
}

.ledger-name {
  font-size: 1.15rem;
}

a.ledger-name {
  font-weight: 700;
  text-decoration: none;
}

a.ledger-name:hover {
  text-decoration: underline;
}

.ledger-value {
  margin-left: auto;
  text-align: right;
}

/* Costs: the resources an action needs. */
.cost-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  list-style: none;
}

.cost-list li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cost-list .cost-short,
.cost-list .cost-short .icon {
  color: var(--negative-text);
}

/* The scale under a drag bar and the live line that follows it */
.slider-scale {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.slider-readout {
  margin-top: 6px;
  font-size: 1.1rem;
}

.slider-readout strong {
  font-weight: 700;
  font-size: 1.35rem;
}

/* A construction in progress */
.construction {
  color: var(--construction-text);
  font-style: italic;
}

/* A drag bar with its number box beside it, where the exact number can be
   typed (public/JS/bar-box.js). */
.bar-with-box {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  align-items: center;
}

/* Small figures shown side by side */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.figure {
  padding: 8px 10px;
  border: 1px solid var(--box-border);
  border-radius: 2px;
  background-color: var(--figure-background);
}

.figure-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-text);
  font-size: 0.95rem;
}

.figure-value {
  font-weight: 700;
  font-size: 1.45rem;
}

/* The small centred sheet of the account pages and the admin sign-in. */
.form-page {
  max-width: 460px;
  margin-right: auto;
  margin-left: auto;
  padding: 22px 18px;
}

.form-page .panel {
  width: 100%;
}

.form-page h1 {
  font-size: 2.4rem;
}

.form-page .form {
  margin-top: 16px;
}
