/* Project ATLAS - Site #10: Régua Online (Portuguese) */
:root {
  --bg-primary: #0a0f1d;
  --bg-surface: #111827;
  --bg-card: #1f293d;
  --border-subtle: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-blue-hover: #0284c7;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Header */
header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.25rem;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent-blue);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

nav a:hover {
  color: var(--accent-blue);
}

/* Tool Section */
.tool-section {
  padding: 3rem 0;
  background: radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 60%);
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Ruler Controls Toolbar */
.ruler-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.unit-switch {
  display: inline-flex;
  background: #090e1a;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.3rem;
}

.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unit-btn.active {
  background: var(--accent-blue);
  color: #032030;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-secondary {
  background: var(--bg-card);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  border-color: var(--accent-blue);
}

.btn-calibrate {
  background: var(--accent-amber);
  color: #451a03;
  font-weight: 700;
}

.btn-calibrate:hover {
  background: #fbbf24;
}

/* The Ruler Canvas Area */
.ruler-container {
  width: 100%;
  height: 140px;
  background: #fdfbf7;
  border: 2px solid #cbd5e1;
  border-radius: 0.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 10px 15px -3px rgba(0,0,0,0.3);
  cursor: crosshair;
  user-select: none;
}

canvas#ruler-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Measurement Info Box */
.measure-readout {
  margin-top: 1.5rem;
  background: #090e1a;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.readout-item {
  text-align: center;
}

.readout-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-blue);
}

.readout-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Calibration Modal / Drawer */
.calibration-box {
  margin-top: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.75rem;
  display: none;
}

.calibration-card-target {
  /* Standard Credit Card ratio: 85.60mm x 53.98mm = 1.5858 */
  width: 323px; /* default starting pixels */
  height: 204px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  margin: 1.5rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  position: relative;
  transition: width 0.1s ease, height 0.1s ease;
}

.calibration-slider-wrap {
  max-width: 500px;
  margin: 1rem auto;
  text-align: center;
}

.slider-calib {
  width: 100%;
  accent-color: var(--accent-amber);
  height: 8px;
  background: #090e1a;
  border-radius: 4px;
}

/* Editorial Section */
.content-section {
  padding: 4rem 0;
}

.editorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  padding: 2.5rem;
  margin-bottom: 2.5rem;
}

.editorial-card h2 {
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 1.25rem;
}

.editorial-card h3 {
  font-size: 1.3rem;
  color: var(--accent-blue);
  margin: 1.75rem 0 0.75rem;
}

.editorial-card p, .editorial-card li {
  color: #cbd5e1;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.editorial-card ul, .editorial-card ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.feature-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.feature-box h4 {
  color: #fff;
  margin-bottom: 0.5rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 3rem 0;
  margin-top: auto;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent-blue);
}
