/* ============================================================
   Utilities Bunker — Roman Numeral Converter (v2.1)
   File: /assets/css/modules/convert/roman.v2.1.css
   Purpose:
   - Tool-only layout and styling for Roman Numeral Converter
   - Keeps shared UB toolkit untouched
   - Mobile-first, accessible, responsive
   ============================================================ */

:root{
  --roman-radius: 16px;
  --roman-gap: 14px;
  --roman-soft: rgba(0,0,0,.06);
  --roman-ring: rgba(249,58,19,.14);
  --roman-preview-bg: linear-gradient(180deg, var(--ub-surface-2), var(--ub-surface-1));
  --roman-code-bg: rgba(0,0,0,.04);
}

html.ub-theme-dark:root{
  --roman-soft: rgba(255,255,255,.08);
  --roman-ring: rgba(249,58,19,.18);
  --roman-code-bg: rgba(255,255,255,.06);
}

/* Header */
.roman-head{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}

.roman-title{
  margin:0;
  font-size:var(--ub-fs-5);
}

/* Layout */
.roman-hero{
  display:grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap:var(--roman-gap);
}

@media (max-width: 980px){
  .roman-hero{
    grid-template-columns: 1fr;
  }
}

.roman-panel{
  background:var(--ub-surface-2);
  border:1px solid var(--ub-border);
  border-radius:var(--roman-radius);
  padding:12px;
}

.roman-panel--display{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.roman-panel-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
}

.roman-panel-title{
  font-size:clamp(13px, 1.2vw, 14px);
  font-weight:950;
  letter-spacing:.01em;
}

.roman-panel-sub{
  font-size:12px;
  color:var(--ub-muted);
  margin-top:2px;
}

/* Mode pills */
.roman-mode-pills{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.roman-mode-pills .ub-chip{
  min-height:44px;
  padding:10px 12px;
}

.roman-mode-pills .ub-chip[aria-pressed="true"]{
  border-color:rgba(249,58,19,.55);
  box-shadow:0 0 0 4px rgba(249,58,19,.12);
}

/* Preview block */
.roman-preview{
  border:1px solid var(--ub-border);
  border-radius:18px;
  background:var(--roman-preview-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  padding:16px;
}

.roman-preview-label{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--ub-muted);
  margin-bottom:8px;
}

.roman-preview-value{
  font-family:var(--ub-mono);
  font-size:clamp(24px, 2vw + 16px, 44px);
  line-height:1.08;
  font-weight:950;
  overflow-wrap:anywhere;
  word-break:break-word;
  letter-spacing:-.02em;
}

.roman-preview-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:13px;
  line-height:1.45;
}

/* KPI tiles */
.roman-kpis{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
}

.roman-kpi{
  min-width:0;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}

.roman-kpi .k{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}

.roman-kpi .v{
  font-family:var(--ub-mono);
  font-weight:950;
  font-size:14px;
  margin-top:4px;
  overflow-wrap:anywhere;
  word-break:break-word;
}

@media (max-width: 520px){
  .roman-kpis{
    grid-template-columns:1fr;
  }
}

/* Status pill */
.roman-status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
  font-size:12px;
  font-weight:950;
  min-height:44px;
  width:max-content;
  max-width:100%;
}

.roman-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--ub-muted);
  flex:0 0 auto;
}

.roman-dot.is-ok{ background:var(--ub-success); }
.roman-dot.is-warn{ background:var(--ub-warning); }
.roman-dot.is-bad{ background:var(--ub-danger); }

/* Notes/reference card */
.roman-reference-card{
  margin-bottom:0;
}

/* Lists */
.roman-list{
  margin:0;
  padding-left:18px;
}

.roman-list li{
  margin:0 0 8px;
}

.roman-list li:last-child{
  margin-bottom:0;
}

/* Form */
.roman-form{
  margin-bottom:0;
}

.roman-form textarea{
  min-height:132px;
  resize:vertical;
  font-family:var(--ub-mono);
}

.roman-form input[type="text"]{
  font-family:var(--ub-mono);
}

.roman-sep{
  border:none;
  border-top:1px solid var(--ub-border);
  margin:14px 0;
}

.roman-options{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

.roman-checkchip{
  display:inline-flex;
  gap:8px;
  align-items:center;
}

.roman-checkchip input[type="checkbox"]{
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--ub-btn-grad-b);
}

.roman-actions{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

/* Output tuning */
.roman-out-roman{
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.3;
}

/* Work box */
.roman-work{
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.6;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.roman-work-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
}

/* Code-ish inline blocks inside content */
.roman-table-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

code{
  background:var(--roman-code-bg);
  padding:.14em .38em;
  border-radius:8px;
  font-family:var(--ub-mono);
  font-size:.95em;
}

/* FAQ */
.roman-faq-q{
  margin:12px 0 6px;
  font-size:var(--ub-fs-2);
}

.roman-faq-a{
  margin:0 0 10px;
}

/* Details enhancement */
.ub-collapsible summary{
  cursor:pointer;
  font-weight:950;
  min-height:44px;
  display:flex;
  align-items:center;
}

.ub-collapsible summary:focus{
  outline:none;
  box-shadow:0 0 0 4px var(--ub-focus);
  border-radius:12px;
}

/* Rail helpers */
.ub-btn--block{
  width:100%;
}

/* Strong focus for tool-specific chips/buttons */
.roman-mode-pills .ub-chip:focus-visible,
.roman-actions .ub-btn:focus-visible,
.roman-checkchip:focus-within{
  box-shadow:0 0 0 4px var(--roman-ring);
  border-radius:12px;
}

/* Small screens */
@media (max-width: 640px){
  .roman-preview{
    padding:14px;
  }

  .roman-preview-value{
    font-size:clamp(20px, 7vw, 32px);
  }

  .roman-actions{
    flex-direction:column;
  }

  .roman-actions .ub-btn{
    width:100%;
  }
}

/* Reduced motion safety */
@media (prefers-reduced-motion: reduce){
  .roman-mode-pills .ub-chip,
  .roman-actions .ub-btn,
  .roman-checkchip{
    transition:none !important;
  }
}