/* ═══════════════════════════════════════════════════════════════════════════
   layout.css — Responsive Layout System
   Kmisetas · Single Page Application
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Global Reset ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body Base ─────────────────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: var(--font-system);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  background: #0a0a0f;
  color: var(--text-primary);

  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background Canvas (particle/noise layer drawn by JS) ──────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
  width: 100%;
  height: 100%;
}

/* ── App Shell ─────────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: var(--z-content);

  /* Clear the floating nav (52px) + gap (16px top) + extra breathing room */
  padding-top: 84px;

  /* Centered content column */
  max-width: 1200px;
  margin: 0 auto;

  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 60px;
}

/* ── App Header ────────────────────────────────────────────────────────────── */
.app-header {
  text-align: center;
  margin-bottom: var(--space-8);
  padding: var(--space-8) 0 var(--space-6);
}

.app-title {
  font-size: clamp(var(--text-2xl), 5vw, var(--text-3xl));
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: var(--space-2);

  /* Subtle text gradient */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 1.0)   0%,
    rgba(255, 255, 255, 0.75) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
          background-clip: text;
}

.app-subtitle {
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* ── Section Titles ────────────────────────────────────────────────────────── */
.section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ── Main Grid Layout ──────────────────────────────────────────────────────── */

/* Mobile-first: single column */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* Left column: calculator panel (tall/prominent) */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Right column: group order + finishes stacked */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Desktop: 2-column grid ────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    align-items: start;
  }

  /* Calculator card fills full height of its column */
  .left-column {
    position: sticky;
    top: 84px; /* sticky below nav */
  }
}

/* ── Wide Desktop: give calculator more room ───────────────────────────────── */
@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 5fr 4fr;
  }
}

/* ── Calculator Card ───────────────────────────────────────────────────────── */
.calculator-card {
  padding: var(--space-6);
}

/* ── Group Order Card ──────────────────────────────────────────────────────── */
.group-order-card {
  padding: var(--space-6);
}

/* ── Finishes Grid Container ───────────────────────────────────────────────── */
.finishes-grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 480px) and (max-width: 767px) {
  .finishes-grid-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .finishes-grid-container {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Modal Root ────────────────────────────────────────────────────────────── */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal-root:not(:empty) {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.60);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

/* ── Utility Helpers ───────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }

.mt-2   { margin-top: var(--space-2); }
.mt-4   { margin-top: var(--space-4); }
.mt-6   { margin-top: var(--space-6); }

.w-full { width: 100%; }

/* ── Print: minimal ink ────────────────────────────────────────────────────── */
@media print {
  #bg-canvas,
  #mesh-bg,
  #nav { display: none; }

  body {
    background: #fff;
    color: #000;
  }

  .glass,
  .glass-card {
    backdrop-filter: none;
    background: #f5f5f5;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
