/*
 * PMA components — plain CSS on top of tokens.css. Static pages link it directly;
 * Tailwind apps get it through tailwind.css (layer components).
 * Markup contracts are documented in design/README.md and shown in specimen.html.
 */

/* ---- Section title: the pma-t.co.jp pattern (Cormorant word, 1px rule, Japanese name) ---- */
.pma-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--pma-space-1) var(--pma-space-4);
  margin: 0 0 var(--pma-space-6);
  padding-bottom: var(--pma-space-2);
  border-bottom: 1px solid var(--pma-rule-strong);
  font-weight: var(--pma-weight-bold);
  word-break: auto-phrase;
}
.pma-section-title > [lang="en"] {
  font-family: var(--pma-font-display);
  font-weight: var(--pma-weight-display);
  letter-spacing: var(--pma-tracking-display);
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3rem);
  line-height: var(--pma-leading-display);
  text-transform: uppercase; /* SERVICES / WORKS / NEWS on pma-t.co.jp */
}
.pma-section-title > :not([lang="en"]) {
  font-size: var(--pma-text-md);
  letter-spacing: var(--pma-tracking-heading);
}

/* ---- Buttons ---- */
.pma-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pma-space-2);
  min-height: var(--pma-tap);
  padding: 0 var(--pma-space-5);
  border: 1px solid var(--pma-brand);
  border-radius: var(--pma-radius-control);
  background: var(--pma-brand);
  color: var(--pma-on-brand);
  font: inherit;
  font-weight: var(--pma-weight-bold);
  line-height: var(--pma-leading-ui);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--pma-duration) var(--pma-ease);
}
.pma-btn:hover { background: var(--pma-brand-hover); border-color: var(--pma-brand-hover); }
.pma-btn:active { box-shadow: var(--pma-shadow-press); }
.pma-btn:focus-visible { outline: none; box-shadow: var(--pma-focus-ring); }
.pma-btn[data-variant="secondary"] { background: var(--pma-brand-tint); border-color: var(--pma-brand-tint); color: var(--pma-brand); }
.pma-btn[data-variant="secondary"]:hover { border-color: var(--pma-brand); }
.pma-btn[data-variant="quiet"] { background: transparent; border-color: transparent; color: var(--pma-link); text-decoration: underline; text-underline-offset: 0.25em; }
.pma-btn[data-variant="quiet"]:hover { background: var(--pma-brand-tint); }
.pma-btn:disabled,
.pma-btn[aria-disabled="true"] {
  background: var(--pma-surface-sunk);
  border-color: var(--pma-surface-sunk);
  color: var(--pma-ink-disabled);
  cursor: not-allowed;
}

/* Round arrow button — the "VIEW ALL ⟶" circle on pma-t.co.jp */
.pma-round {
  display: inline-grid;
  place-items: center;
  inline-size: var(--pma-tap);
  block-size: var(--pma-tap);
  border: 1px solid var(--pma-ink);
  border-radius: var(--pma-radius-round);
  background: var(--pma-ink);
  color: var(--pma-paper);
  cursor: pointer;
}
.pma-round:focus-visible { outline: none; box-shadow: var(--pma-focus-ring); }
.pma-round svg { inline-size: 1.1rem; block-size: 1.1rem; }

/* ---- Fields ---- */
.pma-field { display: grid; gap: var(--pma-space-1); }
.pma-field > label { font-weight: var(--pma-weight-bold); font-size: var(--pma-text-sm); line-height: var(--pma-leading-ui); }
.pma-field .pma-hint { color: var(--pma-ink-muted); font-size: var(--pma-text-sm); line-height: var(--pma-leading-ui); margin: 0; }
.pma-input {
  inline-size: 100%;
  min-height: var(--pma-tap);
  padding: var(--pma-space-2) var(--pma-space-3);
  border: 1px solid var(--pma-rule-input);
  border-radius: var(--pma-radius-control);
  background: var(--pma-surface);
  color: var(--pma-ink);
  font: inherit;
  font-size: var(--pma-text-base); /* 16px: iOS does not zoom */
  line-height: var(--pma-leading-ui);
}
.pma-input::placeholder { color: var(--pma-ink-muted); }
.pma-input:focus-visible { outline: none; border-color: var(--pma-focus); box-shadow: 0 0 0 2px var(--pma-focus); }
.pma-input[aria-invalid="true"] { border-color: var(--pma-blocked-mark); border-width: 2px; }
.pma-field .pma-error { color: var(--pma-blocked-fg); font-size: var(--pma-text-sm); font-weight: var(--pma-weight-bold); line-height: var(--pma-leading-ui); margin: 0; }
.pma-input-unit { display: flex; align-items: center; gap: var(--pma-space-2); }
.pma-input-unit .pma-input { text-align: end; font-variant-numeric: tabular-nums; }
select.pma-input { appearance: none; padding-inline-end: 2.25rem; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 1.1rem center, right 0.75rem center; background-size: 0.35rem 0.35rem; background-repeat: no-repeat; }

/* ---- Status chip: <span class="pma-chip" data-status="ok|wait|attn|blocked"> ---- */
.pma-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.1em 0.75em;
  border-radius: var(--pma-radius-pill);
  font-size: var(--pma-text-sm);
  font-weight: var(--pma-weight-medium);
  line-height: var(--pma-leading-ui);
  white-space: nowrap;
}
.pma-chip svg { inline-size: 0.9em; block-size: 0.9em; flex: none; }
.pma-chip[data-status="ok"] { color: var(--pma-ok-fg); background: var(--pma-ok-bg); }
.pma-chip[data-status="wait"] { color: var(--pma-wait-fg); background: var(--pma-wait-bg); }
.pma-chip[data-status="attn"] { color: var(--pma-attn-fg); background: var(--pma-attn-bg); }
.pma-chip[data-status="blocked"] { color: var(--pma-blocked-fg); background: var(--pma-blocked-bg); }

/* ---- Ball: <span class="pma-ball" data-ball="client|us"> — filled red dot vs navy ring ---- */
.pma-ball {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--pma-text-sm);
  font-weight: var(--pma-weight-bold);
  line-height: var(--pma-leading-ui);
}
.pma-ball::before {
  content: "";
  inline-size: 0.8rem;
  block-size: 0.8rem;
  border-radius: var(--pma-radius-round);
  flex: none;
}
.pma-ball[data-ball="client"] { color: var(--pma-ball-client-fg); }
.pma-ball[data-ball="client"]::before { background: var(--pma-ball-client-mark); }
.pma-ball[data-ball="us"] { color: var(--pma-ball-us-fg); }
.pma-ball[data-ball="us"]::before { box-shadow: inset 0 0 0 2.5px var(--pma-ball-us-mark); }

/* ---- Desk item: one thing to do, whose turn it is, by when ---- */
.pma-item {
  display: grid;
  gap: var(--pma-space-2);
  padding: var(--pma-space-4) var(--pma-space-4) var(--pma-space-4);
  border: 1px solid var(--pma-rule);
  border-radius: var(--pma-radius-media);
  background: var(--pma-surface-alt);
  color: inherit;
  text-decoration: none;
}
.pma-item[data-ball="client"] { background: var(--pma-surface); border-color: var(--pma-ink); }
.pma-item__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--pma-space-1) var(--pma-space-4); }
.pma-item__due { font-size: var(--pma-text-sm); font-weight: var(--pma-weight-bold); line-height: var(--pma-leading-ui); white-space: nowrap; }
.pma-item__title { margin: 0; word-break: auto-phrase; font-size: var(--pma-text-md); font-weight: var(--pma-weight-bold); line-height: var(--pma-leading-heading); }
.pma-item__body { margin: 0; color: var(--pma-ink-2); font-size: var(--pma-text-sm); line-height: 1.7; }
.pma-item__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pma-space-2) var(--pma-space-4); padding-top: var(--pma-space-2); border-top: 1px solid var(--pma-rule-soft); font-size: var(--pma-text-sm); color: var(--pma-ink-muted); line-height: var(--pma-leading-ui); }
a.pma-item:hover { border-color: var(--pma-brand); }
a.pma-item:focus-visible { outline: none; box-shadow: var(--pma-focus-ring); }

/* ---- Table ---- */
.pma-table-wrap { overflow-x: auto; border-top: 1px solid var(--pma-rule-strong); }
.pma-table { inline-size: 100%; border-collapse: collapse; font-size: var(--pma-text-sm); line-height: var(--pma-leading-ui); font-variant-numeric: tabular-nums; }
.pma-table th { text-align: start; font-weight: var(--pma-weight-bold); color: var(--pma-ink-2); padding: var(--pma-space-3); border-bottom: 1px solid var(--pma-rule); white-space: nowrap; }
.pma-table td { padding: var(--pma-space-3); border-bottom: 1px solid var(--pma-rule-soft); vertical-align: top; white-space: nowrap; }
.pma-table td.text { white-space: normal; min-inline-size: 12em; } /* opt-in wrapping for long text */
.pma-table tbody tr:nth-child(even) { background: var(--pma-surface-alt); }
.pma-table tbody tr[aria-selected="true"] { background: var(--pma-brand-tint); }
.pma-table .num { text-align: end; white-space: nowrap; }
.pma-table caption { caption-side: bottom; text-align: start; padding-top: var(--pma-space-2); color: var(--pma-ink-muted); font-size: var(--pma-text-sm); }

/* ---- Notice: <div class="pma-notice" data-tone="info|ok|attn|blocked" role="status"> ---- */
.pma-notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--pma-space-1) var(--pma-space-3);
  padding: var(--pma-space-4);
  border-inline-start: 4px solid var(--pma-brand);
  background: var(--pma-brand-tint);
  line-height: 1.7;
}
.pma-notice > svg { inline-size: 1.25rem; block-size: 1.25rem; margin-top: 0.2rem; color: var(--pma-brand); }
.pma-notice__title { margin: 0; word-break: auto-phrase; font-weight: var(--pma-weight-bold); }
.pma-notice__body { margin: 0; grid-column: 2; color: var(--pma-ink-2); font-size: var(--pma-text-sm); }
.pma-notice[data-tone="ok"] { border-color: var(--pma-ok-mark); background: var(--pma-ok-bg); }
.pma-notice[data-tone="ok"] > svg { color: var(--pma-ok-fg); }
.pma-notice[data-tone="attn"] { border-color: var(--pma-attn-mark); background: var(--pma-attn-bg); }
.pma-notice[data-tone="attn"] > svg { color: var(--pma-attn-fg); }
.pma-notice[data-tone="blocked"] { border-color: var(--pma-blocked-mark); background: var(--pma-blocked-bg); }
.pma-notice[data-tone="blocked"] > svg { color: var(--pma-blocked-fg); }
.pma-notice[data-tone] .pma-notice__body { color: var(--pma-ink); }

/* ---- Masthead slab with logo ---- */
.pma-masthead { background: var(--pma-slab); color: var(--pma-on-slab); }
.pma-masthead a { color: inherit; }
