/* RatioForge — calculator widget styles for pages built on site.css
   (the ratio/platform calculator pages). Loaded next to site.css; adds the
   calculator-only tokens and component rules. RatioForge.html keeps its own
   inlined copy of these rules — a change here must be mirrored there. */

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius-input: 8px;
  --focus-ring: var(--accent);
  --ring-width: 2px;
  --ring: 0 0 0 var(--ring-width) var(--surface), 0 0 0 calc(var(--ring-width) + 2px) var(--focus-ring);
  --ease-out: cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --preview-fill: #EEF1F4;
  --preview-stroke: #1F8A8A;
  --preview-dim: #5A6675;
}
[data-theme="dark"] {
  --preview-fill: #1B242D;
  --preview-stroke: #2BB3B3;
  --preview-dim: #9AA7B4;
}

/* Widget container — same max width as the main calculator page */
.rf-calc { max-width: 640px; margin: 0 auto 8px; }
/* :where() keeps specificity at 0,0,1 so the mono-font class rules below still win */
:where(.rf-calc) button, :where(.rf-calc) input { font-family: inherit; }

/* Card */
.rf-card { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); padding: 24px; display: flex; flex-direction: column; gap: 20px; }

/* Dimension inputs */
.rf-dims { display: flex; flex-direction: column; gap: 16px; }
.rf-dims-row { display: flex; align-items: flex-end; gap: 12px; }
.rf-field { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.rf-label { font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.rf-box { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; height: 48px; transition: border-color 120ms var(--ease-out); }
.rf-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.rf-input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--font-mono); font-size: 20px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
.rf-unit { font-family: var(--font-mono); font-size: 14px; color: var(--muted); margin-left: 8px; }
.rf-times { font-family: var(--font-mono); font-size: 20px; color: var(--muted); padding-bottom: 12px; }

/* Switch */
.rf-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); border: none; background: none; padding: 0; }
.rf-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background 120ms var(--ease-out); flex: none; }
.rf-switch[aria-pressed="true"] .rf-track { background: var(--accent); }
.rf-switch:focus-visible .rf-track { box-shadow: var(--ring); }
.rf-switch:focus-visible { outline: none; box-shadow: none; }
.rf-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left 120ms var(--ease-out); }
.rf-switch[aria-pressed="true"] .rf-knob { left: 18px; }

/* Ratio pills */
.rf-ratios { display: flex; flex-direction: column; gap: 8px; }
.rf-ratios > .rf-label { color: var(--muted); }
.rf-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.rf-pill { font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: -0.01em; padding: 7px 14px; border-radius: 8px; cursor: pointer; background: var(--surface); color: var(--text); border: 1px solid var(--border); transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out), color 120ms var(--ease-out); }
.rf-pill:hover { border-color: var(--border-strong); }
.rf-pill[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); border-color: var(--accent); }
/* Common-resolution shortcuts — quieter than the ratio pills */
.rf-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rf-chip { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: -0.01em; padding: 5px 10px; border-radius: 8px; cursor: pointer; background: transparent; color: var(--muted); border: 1px solid var(--border); transition: color 120ms var(--ease-out), border-color 120ms var(--ease-out), background 120ms var(--ease-out); }
.rf-chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg); }

/* Controls row */
.rf-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rf-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.rf-seg-btn { font-family: var(--font-mono); font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: 6px; cursor: pointer; border: none; background: transparent; color: var(--muted); transition: background 120ms var(--ease-out), color 120ms var(--ease-out); }
.rf-seg-btn[aria-checked="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(22,32,44,0.10); }
.rf-actions { display: flex; gap: 8px; }
.rf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 6px 12px; font-size: 13px; font-weight: 500; line-height: 1; border-radius: 8px; cursor: pointer; transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out), color 120ms var(--ease-out); }
.rf-btn.ghost { background: transparent; color: var(--muted); border: 1px solid transparent; }
.rf-btn.ghost:hover { color: var(--text); background: var(--bg); }
.rf-btn.primary { background: var(--accent); color: var(--text-on-accent); border: 1px solid var(--accent); }
.rf-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Proportion preview */
.rf-preview-wrap { border-top: 1px solid var(--border); padding-top: 16px; }
.rf-preview { display: flex; align-items: center; justify-content: center; min-height: 246px; padding: 28px 56px; }
.rf-preview-inner { position: relative; }
.rf-rect { background: var(--preview-fill); border: 1.5px solid var(--preview-stroke); border-radius: 4px; transition: width 180ms var(--ease-out), height 180ms var(--ease-out); }
.rf-rect.has-image { background-color: transparent; background-size: cover; background-position: center; background-repeat: no-repeat; }
.rf-dim { position: absolute; font-family: var(--font-mono); font-size: 13px; color: var(--preview-dim); background: var(--surface); padding: 0 6px; white-space: nowrap; }
.rf-dim-top { top: -10px; left: 50%; transform: translateX(-50%); }
.rf-dim-left { left: -10px; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); }
.rf-ratio-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--accent); }

/* Dropzone */
.rf-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 84px; padding: 16px; border-radius: 8px; border: 1.5px dashed var(--border-strong); background: var(--bg); color: var(--muted); cursor: pointer; text-align: center; transition: border-color 120ms var(--ease-out), background 120ms var(--ease-out), color 120ms var(--ease-out); }
.rf-dropzone.over { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }
.rf-dropzone .hint { font-size: 13px; }

/* FAQ accordion (markup shared with the main calculator page; behaviour in site.js) */
.rf-faq { border-top: 1px solid var(--border); }
.rf-faq-row { border-bottom: 1px solid var(--border); }
.rf-faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 8px; background: transparent; border: none; cursor: pointer; text-align: left; font-size: 16px; font-weight: 500; color: var(--text); border-radius: 8px; }
.rf-chevron { flex: none; color: var(--muted); transition: transform 180ms var(--ease-out); }
.rf-faq-q[aria-expanded="true"] .rf-chevron { transform: rotate(180deg); }
.rf-faq-a { padding: 0 8px 16px; font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 60ch; }
.rf-faq-a[hidden] { display: none; }
