/*
 * Copyright (c) 2026 by Gabriele Proietti Mattia <pm.gabriele@gmail.com>.
 *
 * All Rights Reserved.
 */

/*
 * What the parts of the settings that talk to the author add on top of styles.css (the report form,
 * the ideas and the reports, the author's links), written with the tokens of design-system.css and
 * never with values of its own. They are made of the app's own pieces (the fold, the card, the chip,
 * the field, the list and its stagger, the skeleton); what moves is the rows' entrance, the
 * skeleton and the form that opens, all of it stopped by the one prefers-reduced-motion block at the
 * end of styles.css. The tests read this file with the others: a rule written twice anywhere, a
 * token used and not defined, a design system token written again, all fail.
 */

.apps-form { display: flex; flex-direction: column; gap: var(--space-3); }
.apps-form .field { margin-bottom: 0; }

/* the form that opens under "Proponi un'idea" arrives the way the rows of a list do */
.apps-reveal { animation: rise var(--dur) var(--ease-out) both; }

.apps-textarea { min-height: 120px; padding: var(--space-3) var(--space-4); resize: vertical; }

.apps-counter { align-self: flex-end; }
.apps-counter[hidden] { display: none; }

.apps-ok {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-body-sm);
}

.apps-need { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.apps-need[hidden] { display: none; }

.apps-thanks { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) 0; text-align: center; }
.apps-thanks__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--space-8);
  height: var(--space-8);
  border-radius: var(--radius-circle);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-h4);
}
.apps-thanks__title { font-size: var(--fs-h4); font-weight: var(--fw-semibold); }

.apps-idea, .apps-report { display: flex; flex-direction: column; gap: var(--space-2); }
.apps-idea__head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.apps-idea__title { min-width: 0; font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.apps-idea__body { overflow-wrap: anywhere; white-space: pre-wrap; }
.apps-idea__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.apps-idea__votes { font-size: var(--fs-caption); color: var(--text-muted); }

.apps-pill {
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-caption);
}
.apps-pill--state { background: var(--accent-soft); color: var(--accent); }

.apps-thread { display: flex; flex-direction: column; gap: var(--space-2); }
.apps-msg {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.apps-msg--author { background: var(--accent-soft); }
.apps-msg__who { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-caption); color: var(--text-muted); }
.apps-msg__name { font-weight: var(--fw-medium); }
.apps-msg__body { font-size: var(--fs-body-sm); overflow-wrap: anywhere; white-space: pre-wrap; }

.apps-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) 0;
  color: var(--link);
  text-decoration: none;
}
.apps-link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-md); }
.apps-link__icon { flex: none; display: flex; align-items: center; justify-content: center; width: var(--space-6); height: var(--space-6); }
.apps-link__glyph { width: 100%; height: 100%; }
.apps-link__text { display: flex; flex-direction: column; min-width: 0; }
.apps-link__title { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.apps-link__description { font-size: var(--fs-caption); color: var(--text-muted); overflow-wrap: anywhere; }

/* the parts the app can be opened on (?open=) land clear of the fixed topbar, not under it */
#pro, #fold-web-access, #fold-feedback, #fold-ideas, #fold-reports {
  scroll-margin-top: calc(var(--topbar-height) + env(safe-area-inset-top) + var(--space-3));
}

/* the desktop bar is 64px tall rather than --topbar-height (styles.css says why) */
@media (min-width: 960px) {
  html.has-side #pro, html.has-side #fold-web-access, html.has-side #fold-feedback,
  html.has-side #fold-ideas, html.has-side #fold-reports { scroll-margin-top: calc(64px + var(--space-3)); }
}
