/* ──────────────────────────────────────────────────────────────
   material.css — ONE material, three depths.

     ground  →  no shadow, no border          (the page)
     surface →  hairline + one soft shadow    (.glass-card)
     raised  →  white + 1px shadow            (buttons, active tab)

   A card never contains another card. Anything grouped inside a
   card is a recess (.glass-recess): a sunken fill plus a hairline.
   Every fill is flat — depth comes from blur, hairlines and
   shadow only.
   ────────────────────────────────────────────────────────────── */

/* ── Surface ─────────────────────────────────────────────────── */
.glass-card {
  background: var(--material);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raise);
}

/* Heavier surface for sheets that sit over content. */
.glass-heavy {
  background: var(--material-strong);
  backdrop-filter: blur(40px) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(40px) saturate(var(--saturate));
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

/* A card that is itself a link. Border and shadow move, not scale. */
.glass-card--link {
  transition: box-shadow 0.22s var(--ease-out-std),
    border-color 0.22s var(--ease-out-std),
    transform var(--duration-press) var(--ease-std);
  cursor: pointer;
}

.glass-card--link:hover {
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-float);
  transform: translateY(-1px);
}

/* A card is a big thing to shrink: 1.5% is a press, 3% is a glitch. */
.glass-card--link:active {
  transform: scale(0.985);
}

/* Liturgical emphasis: a single gold hairline, never a gold fill. */
.glass-card--sacred {
  border-color: var(--gold-hairline);
}

/* ── Recess: grouping INSIDE a card ─────────────────────────── */
.glass-recess {
  background: var(--recess);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-md);
}

.glass-recess--plain {
  background: var(--recess);
  border-radius: var(--radius-sm);
}

/* Hairline divider. The only rule on the page. */
.hairline {
  border-color: var(--hairline);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.glass-button {
  --btn-bg: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--btn-bg);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--radius-md);
  padding: 0.625rem 1.125rem;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 590;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-hair);
  transition: background-color 0.16s var(--ease-out-std),
    transform var(--duration-press) var(--ease-std);
  -webkit-appearance: none;
  appearance: none;
}

.glass-button:hover {
  background: var(--color-accent-hover);
  color: var(--on-accent);
}

/* The iOS press: the control gives under the finger. A 1px nudge
   downward reads as a wobble on a wide button; a 3% squeeze reads
   as a press at every width. */
.glass-button:active {
  transform: scale(0.97);
}

.glass-button:disabled,
.glass-button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Quiet variant: the material with a hairline. Default for
   secondary actions, back links and anything repeated in a list. */
.glass-button--quiet {
  background: var(--material-strong);
  color: var(--color-ink);
  border: 0.5px solid var(--hairline);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
}

.glass-button--quiet:hover {
  background: var(--material-strong);
  color: var(--color-ink);
  border-color: var(--hairline-strong);
}

/* Text-only action. No chevrons, no underline until hover. */
.glass-button--bare {
  background: none;
  color: var(--color-accent);
  border: 0;
  box-shadow: none;
  padding: 0.375rem 0.25rem;
  font-weight: 560;
}

.glass-button--bare:hover {
  background: none;
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Quietest action: an ink-3 word that only colours on hover. For
   repeated row actions, where an accent-coloured link would shout. */
.glass-button--subtle {
  background: none;
  color: var(--color-ink-3);
  border: 0;
  box-shadow: none;
  padding: 0.375rem 0.25rem;
  font-weight: 500;
}

.glass-button--subtle:hover {
  background: none;
  color: var(--color-rubric);
  text-decoration: underline;
}

.glass-button--danger {
  background: var(--material-strong);
  color: var(--color-rubric);
  border: 0.5px solid color-mix(in oklab, var(--color-rubric) 28%, transparent);
}

.glass-button--danger:hover {
  background: color-mix(in oklab, var(--color-rubric) 8%, var(--material-strong));
  color: var(--color-rubric);
}

.glass-button--block {
  width: 100%;
}

.glass-button--small {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-meta);
}

.glass-button--large {
  padding: 0.875rem 1.5rem;
}

/* ── Fields ──────────────────────────────────────────────────── */
.glass-input,
.glass-select,
.glass-textarea {
  width: 100%;
  background: var(--material-field);
  color: var(--color-ink);
  border: 0.5px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 0.16s var(--ease-out-std),
    box-shadow 0.16s var(--ease-out-std);
  -webkit-appearance: none;
  appearance: none;
}

.glass-textarea {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.55;
}

.glass-select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238a8277' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.glass-input:focus,
.glass-select:focus,
.glass-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-accent) 18%, transparent);
}

.glass-input::placeholder,
.glass-textarea::placeholder {
  color: var(--color-ink-3);
}

.glass-input.is-invalid,
.glass-textarea.is-invalid {
  border-color: var(--color-rubric);
}

.glass-input.is-valid,
.glass-textarea.is-valid {
  border-color: color-mix(in oklab, var(--color-affirm) 55%, transparent);
}

.glass-field > label,
.glass-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--color-ink-2);
}

.glass-field + .glass-field {
  margin-top: 1rem;
}

/* Inside a grid the gap does the spacing. */
:where(.grid) > .glass-field + .glass-field {
  margin-top: 0;
}

.glass-hint {
  margin-top: 0.375rem;
  font-size: var(--text-meta);
  color: var(--color-ink-3);
}

/* The one thing wrong with this field, said where the field is. The sibling
   of .glass-hint — same place, same size — in rubric ink. A form says what to
   fix next to the box that needs fixing, never in a banner over the top. */
.glass-error {
  margin-top: 0.375rem;
  font-size: var(--text-meta);
  color: var(--color-rubric);
}

/* Checkbox / radio accent */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-accent);
}
