/* TernaryCalc — web port styles. The calculator's pixel dimensions are
 * driven entirely by inline styles emitted from app.js (mirroring the iOS
 * CalculatorMetrics.fit math); this stylesheet just handles the chrome:
 * fonts, fullscreen background, settings layout, and tap states. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-family: 'Comfortaa', system-ui, -apple-system, sans-serif;
  background: #88ACA2;
}

body {
  /* iOS PWA: extend behind notch / home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Calc screen: a positioned canvas inside which app.js places the calc and
 * info button at absolute coordinates (so resize repaints recompute the
 * exact same positions iOS would). */
.screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Buttons reset — keypad keys bring their own background/border via inline
 * styles set by the renderer. */
button {
  font: inherit;
  color: inherit;
  border: none;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
}

/* Subtle press feedback on interactive controls. */
.key:active,
.info-btn:active,
.picker-cell:active {
  filter: brightness(0.92);
}

.calculator.non-interactive {
  pointer-events: none;
}

/* Decimal point sits absolutely positioned inside its row; its inner SVG
 * needs flex-centering so the small ring lands in the middle of its frame. */
.dec-point {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
 * Settings screen — fixed cream-on-black palette, independent
 * of the active calc theme.
 * ============================================================ */

.settings-screen {
  width: 100%;
  height: 100%;
  background: #000;
  color: #ECD9AF;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-screen.wide {
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.settings-screen.wide .settings-left,
.settings-screen.wide .settings-right {
  flex: 1 1 0;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-screen.wide .settings-left {
  display: flex;
  flex-direction: column;
}

.settings-screen.wide .preview-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.settings-screen.wide .controls-pane {
  flex: 0 0 auto;
}

.settings-screen.wide .settings-divider {
  width: 1px;
  background: rgba(236, 217, 175, 0.15);
}

.calc-preview {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.picker-group {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.picker-label {
  font-size: 16px;
  text-align: center;
}

.picker {
  display: flex;
  flex-direction: row;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.picker-cell {
  flex: 1 1 0;
  padding: 8px 0;
  text-align: center;
  font-size: 14px;
  background: rgba(236, 217, 175, 0.08);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s ease-out;
}

.picker-cell.selected {
  background: rgba(236, 217, 175, 0.25);
}

/* ============================================================
 * Info pane — the in-app documentation, with section headings
 * and inline calculator glyphs (see the InfoText port in app.js).
 * ============================================================ */

.info-pane {
  padding: 24px;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

.info-pane h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.info-heading {
  font-size: 17px;
  font-weight: 700;
  opacity: 0.7;
  /* Roughly one extra body line of air above a section. */
  margin: 34px 0 0 0;
}

.info-par {
  font-size: 17px;
  line-height: 1.5;
  opacity: 0.7;
  margin: 0;
  /* Preserve the key-name line break and the double space after glyphs. */
  white-space: pre-wrap;
}

.info-key-name {
  font-weight: 700;
}

/* iOS: superscripts at 0.62× raised 0.38em of the body size; 0.38/0.62 em
 * expressed in the superscript's own font size. */
.info-sup {
  font-size: 0.62em;
  vertical-align: 0.61em;
}

/* Comfortaa ships no italic face and the synthetic oblique looks off, so
 * emphasis renders in the font's real bold weight (matching iOS). */
.info-emph {
  font-weight: 700;
}

.info-par a {
  color: inherit;
  text-decoration: underline;
}

/* Inline glyphs are sized to the font's ascender and sit on the baseline,
 * so glyph lines and text-only lines share the same line height. */
.info-glyph {
  vertical-align: baseline;
}
