/* style.css — Glass Calc look */

/* Override ui theme vars */
:root {
  --accent: #f5a524;
  --accent-2: #f7b84b;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --bg: transparent;
  --surface: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.6);
  --radius: 24px;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #10121a;
}

/* Full-bleed photo background */
.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

/* Dark gradient overlay */
.grad-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.35) 0%, rgba(10, 12, 20, 0.6) 100%);
}

/* Glass calculator card */
.calc-card {
  width: min(360px, 92vw);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  padding: 24px 20px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92vh;
}

/* Pending context line */
#sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.65);
  text-align: right;
  min-height: 22px;
  letter-spacing: 0.02em;
}

/* Display */
#display {
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
  line-height: 1.15;
  color: #fff;
  transition: color 100ms ease, opacity 100ms ease;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  padding-bottom: 4px;
}

/* While typing entry, dim display */
.calc-card.typing #display {
  opacity: 0.82;
}

.calc-card.result #display {
  opacity: 1;
}

/* History drawer */
.history {
  max-height: 0;
  overflow-y: auto;
  transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.history.open {
  max-height: 180px;
}

.history::-webkit-scrollbar {
  width: 4px;
}

.history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.hist-item {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 80ms ease;
  user-select: none;
}

.hist-item:last-child {
  border-bottom: none;
}

.hist-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.hist-item .hist-expr {
  font-variant-numeric: tabular-nums;
}

.hist-item .hist-result {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Keypad grid */
.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 4px;
}

/* Key buttons */
.key {
  aspect-ratio: 1;
  font-size: 24px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 80ms ease, background 80ms ease, box-shadow 80ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  outline: none;
  user-select: none;
}

.key:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.18);
}

/* Operator keys tinted with accent */
.key.op {
  background: rgba(245, 165, 36, 0.5);
  border-color: rgba(255, 205, 120, 0.8);
  color: #241500;
  font-weight: 700;
}

.key.op:active {
  background: rgba(245, 165, 36, 0.72);
}

/* Equals — solid accent */
#k-eq {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(245, 165, 36, 0.35);
}

#k-eq:active {
  background: #d18f1c;
  transform: scale(0.94);
}

/* Utility keys (AC, ±, %, ⌫) slightly muted */
.key.util {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
}

.key.util:active {
  background: rgba(255, 255, 255, 0.14);
}

/* History toggle button looks like a clock/ghost */
#k-hist {
  font-size: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

#k-hist.active {
  background: rgba(245, 165, 36, 0.5);
  border-color: rgba(255, 205, 120, 0.8);
  color: #241500;
}

/* Small screens: keep card comfortable */
@media (max-height: 700px) {
  .calc-card {
    padding: 16px 16px 14px;
    gap: 8px;
  }
  .key {
    font-size: 20px;
  }
  #display {
    font-size: clamp(30px, 9vw, 48px);
  }
}
