/* ==========================================================================
   Pizza Napoletana calculator — page-scoped layout.

   Everything is namespaced under .napo so contemporanea / teglia / focaccia /
   napoletana-original are untouched. Fonts, colours and the recipe-card
   styling still come from ../assets/styles.css — nothing new is invented here.
   ========================================================================== */

.napo {
  max-width: 1100px;
  margin: 0 auto;
  padding: 7rem 1.5rem 5rem;
  text-align: left;
  box-sizing: border-box;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.napo-head {
  margin-bottom: 2.25rem;
}

.napo-head h1 {
  font-size: 2rem;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.napo-tagline {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #999;
}

/* ── Two-column split: controls left, recipe right ───────────────────────── */
.napo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 960px) {
  .napo-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 3rem;
  }
}

.napo-form {
  min-width: 0;
}

/* ── Grouped controls ────────────────────────────────────────────────────── */
.napo-group {
  border: none;
  margin: 0 0 1.75rem;
  padding: 0;
  min-width: 0; /* fieldsets default to min-content and would blow out the grid */
}

.napo-group legend {
  display: block;
  width: 100%;
  padding: 0 0 0.5rem;
  margin-bottom: 1.05rem;
  border-bottom: 1px solid #ececec;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.68rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #c0392b;
}

/* The shared stylesheet references .form-grid but never defines it. */
.napo .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.25rem;
}

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

/* Grid gap owns the spacing now, so drop the stacked-list margin. */
.napo .input-group {
  margin-bottom: 0;
}

.napo .input-group label {
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
}

/* Guidance under a control — the suggested hydration band for the chosen W. */
.napo .napo-hint {
  margin: 0.35rem 0 0;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.2px;
  color: #aaa;
  transition: color 0.15s ease;
}

.napo .napo-hint.is-out {
  color: #c0392b;
}

.napo .input-control {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.napo .input-control:focus-within {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.napo .input-control input {
  padding: 0.55rem 0;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #222;
}

/* Dropdown variant — no ± buttons, so the select fills the control and
   carries its own chevron (appearance:none kills the platform one). */
.napo .input-control.is-select {
  position: relative;
}

.napo .input-control.is-select::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  margin-top: -0.3rem;
  border-right: 1.5px solid #888;
  border-bottom: 1.5px solid #888;
  transform: rotate(45deg);
  pointer-events: none;
}

.napo .input-control.is-select select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  padding: 0.55rem 2.1rem 0.55rem 0.85rem;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #222;
  cursor: pointer;
  text-overflow: ellipsis;
}

.napo .input-control button {
  color: #888;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.napo .input-control button:hover {
  background-color: #f4f4f4;
  color: #c0392b;
}

/* ── Actions row: biga toggle sits with the submit, above the results ────── */
.napo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.25rem;
}

.napo-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.napo-actions .toggle-container {
  margin-top: 0;
}

.napo .switch {
  flex-shrink: 0;
}

.napo input:checked + .slider {
  background-color: #c0392b;
}

.napo-submit {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 0.72rem 1.7rem;
  border: none;
  border-radius: 8px;
  background-color: #c0392b;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.06s ease;
}

.napo-submit:hover {
  background-color: #a02c22;
}

.napo-submit:active {
  transform: translateY(1px);
}

.napo-submit:focus-visible {
  outline: 2px solid #c0392b;
  outline-offset: 3px;
}

/* ── Results column ──────────────────────────────────────────────────────── */
.napo-results {
  min-width: 0;
}

/* Flour advisories, drawn from the existing palette. Green = fits, grey = at
   the limit but workable, red = won't hold. Never blocking. */
.napo-results .recipe-flag {
  position: relative;
  margin-top: 0.55rem;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #555;
}

.napo-results .recipe-flag::before {
  position: absolute;
  left: 0;
  top: 0;
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: bold;
}

.napo-results .recipe-flag.is-ok::before {
  content: "✓";
  color: #2e7d32;
}

.napo-results .recipe-flag.is-tight::before {
  content: "~";
  color: #999;
}

.napo-results .recipe-flag.is-warn::before {
  content: "!";
  color: #c0392b;
}

.napo-results .recipe-flag.is-warn {
  color: #8a3227;
}

/* Provenance line under the recipe note: which yeast model produced this. */
.napo-results .recipe-model {
  margin-top: 0.7rem;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.66rem;
  line-height: 1.6;
  letter-spacing: 0.2px;
  color: #aaa;
}

@media (min-width: 960px) {
  .napo-results {
    position: sticky;
    top: 6.5rem;
  }
}

/* The card is centred and width-capped for the old single-column pages;
   in this column it should simply fill the track. */
.napo-results .recipe-card,
.napo-results .calc-error {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Stacked below the form, an unbounded card leaves the table far too sparse. */
@media (max-width: 959px) {
  .napo-results .recipe-card,
  .napo-results .calc-error {
    max-width: 560px;
  }
}

@media (max-width: 600px) {
  .napo {
    padding: 6rem 1rem 4rem;
  }

  .napo-head h1 {
    font-size: 1.6rem;
  }

  /* Keep the read order: choose the biga, then act. */
  .napo-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .napo-submit {
    width: 100%;
  }
}
