/* ============================================
   Printing Press Calculator Pro
   Editorial / Refined Aesthetic
   ============================================ */

:root {
  /* Paper-inspired palette */
  --paper: #f6f1e7;
  --paper-deep: #ede5d3;
  --ink: #1a1612;
  --ink-soft: #2d2820;
  --muted: #6b6356;
  --line: #d9d1bf;
  --line-soft: #e8e1cf;
  
  /* Accent palette */
  --accent: #b8341d;
  --accent-deep: #8a2614;
  --accent-soft: #f5e1da;
  --gold: #b8923a;
  --gold-soft: #f3e7c8;
  --green: #3a6b4c;
  --green-soft: #d8e8dd;
  --blue: #2e4a6b;
  --blue-soft: #d8e2ed;
  
  /* Spacing & sizing */
  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(26, 22, 18, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 22, 18, 0.06);
  --shadow-lg: 0 8px 24px rgba(26, 22, 18, 0.08);
  
  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Hind Siliguri', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Subtle grain overlay for paper texture */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  background-image: 
    radial-gradient(circle at 25% 25%, var(--ink) 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, var(--ink) 1px, transparent 1px);
  background-size: 4px 4px, 6px 6px;
  mix-blend-mode: multiply;
}

/* ===== HEADER ===== */
.app-header {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 24px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid var(--ink);
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 48px;
  height: 48px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -1px;
  border-radius: 2px;
  font-feature-settings: "ss01";
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variation-settings: "opsz" 96;
}

.brand h1 .italic {
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 144;
}

.brand .subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== NAVIGATION TABS ===== */
.tabs-nav {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: relative;
  z-index: 2;
  scrollbar-width: thin;
}

.tabs-nav::-webkit-scrollbar { height: 4px; }
.tabs-nav::-webkit-scrollbar-thumb { background: var(--line); }

.tab {
  background: transparent;
  border: none;
  padding: 16px 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s ease;
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--ink);
  font-weight: 600;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.tab-icon {
  font-size: 14px;
  opacity: 0.6;
}

.tab.active .tab-icon {
  opacity: 1;
  color: var(--accent);
}

/* ===== PANELS ===== */
.panel {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 24px;
  display: none;
  position: relative;
  z-index: 2;
}

.panel.active {
  display: block;
  animation: panelFade 0.3s ease;
}

@keyframes panelFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== MODE SWITCHER (Calculator) ===== */
.mode-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 24px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 6px;
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 14px 18px;
  cursor: pointer;
  font-family: var(--font-body);
  border-radius: var(--radius);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.mode-btn strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.mode-btn span {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-btn:hover { background: rgba(255, 255, 255, 0.4); }

.mode-btn.active {
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.mode-btn.active strong { color: var(--accent); }

/* ===== GRID LAYOUTS ===== */
.grid-calc {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }

@media (max-width: 1100px) {
  .grid-calc { grid-template-columns: 1fr; }
  .result-pane { position: relative; }
}

@media (max-width: 700px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .mode-switcher { grid-template-columns: 1fr; }
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.step-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  background: var(--paper-deep);
  border-radius: 2px;
}

.card-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-toolbar .card-title {
  border: none;
  padding: 0;
  margin: 0;
}

/* ===== FORM ELEMENTS ===== */
.field { margin-bottom: 0; }

label {
  display: block;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26, 22, 18, 0.06);
}

input[type="number"] {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6356' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.actions-field {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.ghost-soft {
  background: var(--paper-deep);
  color: var(--ink);
  border-color: transparent;
}
.btn.ghost-soft:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn.danger {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.danger:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn.small {
  padding: 6px 11px;
  font-size: 12px;
}

.btn.icon-only {
  padding: 6px 8px;
  min-width: auto;
}

/* ===== INFO STRIPS ===== */
.info-strip {
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 2px;
  margin-bottom: 16px;
  color: var(--ink-soft);
}

.info-strip.success {
  background: var(--green-soft);
  border-color: var(--green);
}

.info-strip strong {
  color: var(--ink);
  font-weight: 600;
}
