/**
 * scientific.css — Tata Letak & Komponen Kalkulator Saintifik Bantukerjain.com
 * Standar Anti-AI-Slop: Task-first above the fold, zero nested card hell,
 * palet tenang kontras tinggi, tabular-nums, touch target >= 44px, zero overflow-x.
 */

.sci-page [hidden] {
  display: none !important;
}

.sci-page .wrap {
  max-width: 1080px;
  padding: 0 12px;
}

@media (min-width: 640px) {
  .sci-page .wrap {
    padding: 0 16px;
  }
}

.sci-page .breadcrumb {
  padding: 4px 0 0;
  font-size: 0.76rem;
}

.sci-page .hero {
  padding: 2px 0 8px;
}

.sci-page .hero h1 {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 1px;
}

.sci-page .hero .lead {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #475569;
  margin: 0;
}

/* ===== Task-First Workspace Grid ===== */
.sci-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 20px;
}

@media (min-width: 960px) {
  .sci-workspace {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
    gap: 20px;
  }
}

.sci-calc-card,
.sci-history-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}

@media (min-width: 640px) {
  .sci-calc-card,
  .sci-history-card {
    padding: 14px 16px;
  }
}

/* ===== 2-Row Formula Display ===== */
.sci-display {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px 10px;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.sci-display-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.sci-display-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.sci-status-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.sci-status-pill--mem {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.sci-status-pill--ans {
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
}

@media (max-width: 480px) {
  .sci-status-pill--ans {
    display: none;
  }
}

.sci-copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.sci-copy-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: #166534;
}

.sci-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.sci-copy-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.sci-copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Row 1: Formula / Expression */
.sci-row-formula {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.sci-formula-trace {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #475569;
  text-align: right;
  min-height: 1.15em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sci-expr-input {
  width: 100%;
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sci-expr-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sci-expr-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

/* Row 2: Result */
.sci-row-result {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #e2e8f0;
  min-height: 36px;
}

.sci-result-eq {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: #64748b;
  flex-shrink: 0;
}

.sci-result-value {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3.8vw, 1.9rem);
  font-weight: 800;
  line-height: 1.15;
  color: #0f172a;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-x: auto;
  max-width: 100%;
  white-space: nowrap;
}

.sci-error {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ===== Mode (DEG/RAD) & Memory Bar ===== */
.sci-mode-group {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  flex-shrink: 0;
}

.sci-mode-btn {
  min-width: 48px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sci-mode-btn + .sci-mode-btn {
  border-left: 1px solid #cbd5e1;
}

.sci-mode-btn.is-active,
.sci-mode-btn[aria-pressed="true"] {
  background: #0f172a;
  color: #ffffff;
}

.sci-toolbar {
  margin-bottom: 8px;
}

.sci-mem-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.sci-mem-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 4px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.sci-mem-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.sci-mem-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== 6x7 Scientific Keypad ===== */
.sci-keypad {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

@media (min-width: 640px) {
  .sci-keypad {
    gap: 6px;
  }
}

.sci-key {
  min-height: 44px;
  min-width: 44px;
  padding: 4px 2px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
  transition: background-color 0.1s ease, border-color 0.1s ease, transform 0.05s ease;
}

@media (min-width: 640px) {
  .sci-key {
    min-height: 46px;
    font-size: 0.94rem;
  }
}

.sci-key:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.sci-key:active {
  transform: translateY(1px);
}

.sci-key:focus-visible,
.sci-mode-btn:focus-visible,
.sci-mem-btn:focus-visible,
.sci-copy-btn:focus-visible,
.sci-history-expr:focus-visible,
.sci-history-res:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.sci-key--num {
  background: #ffffff;
  color: #0f172a;
  font-size: 1rem;
}

.sci-key--fn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #1e293b;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

@media (min-width: 640px) {
  .sci-key--fn {
    font-size: 0.86rem;
  }
}

.sci-key--fn:hover {
  background: #e2e8f0;
}

.sci-key--op {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-size: 1.05rem;
}

.sci-key--op:hover {
  background: #dbeafe;
}

.sci-key--clear {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  font-weight: 800;
}

.sci-key--clear:hover {
  background: #fee2e2;
}

.sci-key--shift.is-active,
.sci-key--shift[aria-pressed="true"] {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.sci-key--eq {
  grid-column: span 2;
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  font-size: 1.1rem;
}

.sci-key--eq:hover {
  background: #1d4ed8;
}

.sci-key--span2 {
  grid-column: span 2;
}

/* ===== Local History Panel ===== */
.sci-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 10px;
}

.sci-history-head h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.sci-history-clear {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.sci-history-clear:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.sci-history-clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sci-history-empty {
  margin: 8px 0 4px;
  font-size: 0.86rem;
  color: #475569;
  line-height: 1.5;
}

.sci-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 440px;
  overflow-y: auto;
}

.sci-history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.sci-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sci-history-mode {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
}

.sci-history-expr,
.sci-history-res {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.sci-history-expr {
  font-size: 0.82rem;
  color: #475569;
  overflow-wrap: anywhere;
}

.sci-history-res {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.sci-history-expr:hover,
.sci-history-res:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

/* ===== Below the Fold Editorial & FAQ ===== */
.sci-guide-section {
  border-top: 1px solid #e2e8f0;
  padding: 20px 0;
}

.sci-guide-section h2 {
  font-size: 1.125rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px;
}

.sci-examples-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sci-example-chip {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.sci-example-chip:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.sci-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.sci-ref-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.65;
}

.sci-ref-list code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  color: #0f172a;
}

/* ==========================================================================
   B2B Sponsorship & Partnership Slot (Strategic Placement)
   ========================================================================== */
.b2b-sponsor-slot {
  margin: 28px 0 20px;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
}

.sponsor-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sponsor-copy {
  flex: 1 1 280px;
}

.sponsor-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2563eb;
  margin-bottom: 4px;
}

.sponsor-text {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sponsor-cta {
  white-space: nowrap;
}

/* ==========================================================================
   Dual Visitor Feedback System (Two Distinct Channels)
   ========================================================================== */
.feedback-strip {
  margin: 20px 0 28px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.feedback-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.feedback-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #0f172a;
}

.feedback-card p {
  font-size: 0.85rem;
  color: #475569;
  margin: 0 0 14px;
  line-height: 1.5;
  flex: 1;
}

.feedback-btn {
  align-self: flex-start;
}

@media (max-width: 640px) {
  .feedback-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
