/* Siatka celów — layered on top of styles.css and kolo-zycia.css */

/* Each quadrant has a subtle accent color that hints at its meaning
   without competing with the rest of the page. Backgrounds stay close
   to paper; only the swatch + count chip carry the hue.
   --accent-glow is a faint tint of the accent (used for focus rings
   and subtle backgrounds); explicit values keep parity with the rest
   of the codebase that doesn't rely on relative color syntax. */
.quadrant[data-quadrant="haveWant"] {
  --accent: oklch(43% 0.095 153); /* forest — abundance */
  --accent-soft: oklch(94% 0.04 145 / 0.55);
  --accent-glow: oklch(43% 0.095 153 / 0.18);
  --accent-wash: oklch(43% 0.095 153 / 0.07);
}
.quadrant[data-quadrant="haveNotWant"] {
  --accent: oklch(58% 0.13 35); /* coral — release */
  --accent-soft: oklch(94% 0.04 35 / 0.5);
  --accent-glow: oklch(58% 0.13 35 / 0.18);
  --accent-wash: oklch(58% 0.13 35 / 0.07);
}
.quadrant[data-quadrant="notHaveWant"] {
  --accent: oklch(60% 0.12 70); /* sun/amber — aspiration */
  --accent-soft: oklch(94% 0.05 80 / 0.55);
  --accent-glow: oklch(60% 0.12 70 / 0.18);
  --accent-wash: oklch(60% 0.12 70 / 0.07);
}
.quadrant[data-quadrant="notHaveNotWant"] {
  --accent: oklch(50% 0.06 230); /* sky — boundary, calm */
  --accent-soft: oklch(94% 0.025 220 / 0.5);
  --accent-glow: oklch(50% 0.06 230 / 0.18);
  --accent-wash: oklch(50% 0.06 230 / 0.07);
}

/* Two-step indicator override (kolo-zycia uses 3 columns by default). */
.step-indicator-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Step 1: full grid (desktop) ---------- */

.grid-board {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.grid-corner {
  /* empty top-left of axis grid */
}

.grid-col-label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 10px;
  color: var(--ink-green);
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.18rem;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.005em;
}

.grid-row-label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-green);
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.18rem;
  font-weight: 500;
  text-align: center;
  /* Vertical text on the left side, mirroring the reference image. */
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.005em;
  padding: 14px 0;
}

.quadrant {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  padding: 18px 18px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 30px oklch(32% 0.04 125 / 0.08);
  transition:
    border-color 220ms var(--ease),
    box-shadow 220ms var(--ease),
    transform 220ms var(--ease);
}

.quadrant::before {
  /* tiny color tab on the left edge, like the focus card in koło życia */
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0.85;
}

.quadrant-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quadrant-title {
  margin: 0;
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink-green);
  letter-spacing: 0.005em;
}

.quadrant-count {
  margin-left: auto;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.quadrant-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.item-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-list:empty {
  margin: 0;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 28px;
  align-items: center;
  gap: 4px;
  padding: 7px 8px 7px 12px;
  background: oklch(98% 0.012 96 / 0.7);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.94rem;
  color: var(--ink);
  word-break: break-word;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
  animation: item-in 280ms var(--ease);
}

@keyframes item-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.item-row:hover {
  border-color: var(--accent);
  background: var(--paper);
}

.item-text {
  line-height: 1.4;
}

.item-remove {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.item-remove svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.item-remove:hover,
.item-remove:focus-visible {
  background: oklch(92% 0.03 32);
  color: oklch(45% 0.13 32);
  outline: none;
}

.add-item-form {
  margin-top: auto;
  padding-top: 6px;
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 6px;
  align-items: center;
}

.add-item-form input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.add-item-form input::placeholder {
  color: oklch(60% 0.02 130);
  font-size: 0.85rem;
}

.add-item-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-item-form button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: var(--paper);
  cursor: pointer;
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.add-item-form button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.add-item-form button:hover,
.add-item-form button:focus-visible {
  transform: translateY(-1px);
  outline: none;
  filter: brightness(0.95);
}

/* ---------- Mobile mini-map (hidden on desktop) ---------- */

.grid-minimap {
  display: none;
}

/* ---------- Step 1: switcher tabs (mobile only) ---------- */

.quadrant-switcher {
  display: none;
}

/* ---------- Step 2: result view ---------- */

.result-grid {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap: 28px;
  align-items: start;
}

.result-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-board-result {
  /* Slightly tighter on the result page; quadrants are read-only. */
  gap: 10px;
}

.grid-board-result .quadrant {
  min-height: 200px;
  cursor: pointer;
}

.grid-board-result .quadrant:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.grid-board-result .add-item-form {
  display: none;
}

.grid-board-result .item-row {
  cursor: inherit;
  grid-template-columns: 1fr; /* no remove button column */
}

.grid-board-result .item-remove {
  display: none;
}

.grid-board-result .quadrant-hint {
  display: none;
}

.grid-board-result .item-list:empty::after {
  content: "Nic tu nie wpisałeś.";
  display: block;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

.grid-caption {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .result-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* Phone — switch the editing surface to focus mode.
   Mini-map at top stays as the spatial map; only the focused
   quadrant card shows below it. */
@media (max-width: 720px) {
  .grid-minimap {
    display: grid;
    grid-template-columns: minmax(46px, auto) 1fr 1fr;
    grid-template-rows: auto 1fr 1fr;
    gap: 8px;
    margin: 0 0 22px;
    padding: 14px 14px 16px;
    background: oklch(98% 0.012 96 / 0.85);
    border: 1px solid var(--line);
    border-radius: 16px;
  }

  .grid-minimap-corner {
    /* empty corner */
  }

  .grid-minimap-col-label {
    grid-row: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
    color: var(--ink-green);
    font-family: Georgia, Times New Roman, serif;
    font-size: 0.92rem;
    text-align: center;
    line-height: 1.15;
  }

  .grid-minimap-row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-green);
    font-family: Georgia, Times New Roman, serif;
    font-size: 0.84rem;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    line-height: 1.1;
  }

  .grid-minimap-cell {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    aspect-ratio: 1.4 / 1;
    min-height: 56px;
    display: grid;
    place-items: center;
    font: inherit;
    color: var(--accent, var(--ink-green));
    cursor: pointer;
    transition:
      border-color 180ms var(--ease),
      background 180ms var(--ease),
      transform 180ms var(--ease);
  }

  .grid-minimap-cell[data-mini-q="haveWant"] {
    --accent: oklch(43% 0.095 153);
    --accent-wash: oklch(43% 0.095 153 / 0.08);
  }
  .grid-minimap-cell[data-mini-q="haveNotWant"] {
    --accent: oklch(58% 0.13 35);
    --accent-wash: oklch(58% 0.13 35 / 0.08);
  }
  .grid-minimap-cell[data-mini-q="notHaveWant"] {
    --accent: oklch(60% 0.12 70);
    --accent-wash: oklch(60% 0.12 70 / 0.08);
  }
  .grid-minimap-cell[data-mini-q="notHaveNotWant"] {
    --accent: oklch(50% 0.06 230);
    --accent-wash: oklch(50% 0.06 230 / 0.08);
  }

  .grid-minimap-cell.is-focused {
    border-color: var(--accent);
    border-width: 2px;
    background: var(--accent-wash);
  }

  .grid-minimap-count {
    font-family: Georgia, Times New Roman, serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent);
  }

  /* Hide the desktop axis labels on the main board, since the mini-map carries them. */
  .grid-board > .grid-corner,
  .grid-board > .grid-col-label,
  .grid-board > .grid-row-label {
    display: none;
  }

  /* Stack the board: only the focused quadrant is visible. Others hidden. */
  .grid-board {
    display: block;
  }

  .grid-board > .quadrant {
    display: none;
  }

  .grid-board > .quadrant.is-focused {
    display: flex;
    min-height: 320px;
  }

  /* Switcher chips — quick way to hop between quadrants without scrolling. */
  .quadrant-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    justify-content: center;
  }

  .quadrant-switcher button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 180ms var(--ease);
  }

  .quadrant-switcher button .swatch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
  }

  .quadrant-switcher button[data-switch-q="haveWant"] {
    --accent: oklch(43% 0.095 153);
    --accent-wash: oklch(43% 0.095 153 / 0.06);
  }
  .quadrant-switcher button[data-switch-q="haveNotWant"] {
    --accent: oklch(58% 0.13 35);
    --accent-wash: oklch(58% 0.13 35 / 0.06);
  }
  .quadrant-switcher button[data-switch-q="notHaveWant"] {
    --accent: oklch(60% 0.12 70);
    --accent-wash: oklch(60% 0.12 70 / 0.06);
  }
  .quadrant-switcher button[data-switch-q="notHaveNotWant"] {
    --accent: oklch(50% 0.06 230);
    --accent-wash: oklch(50% 0.06 230 / 0.06);
  }

  .quadrant-switcher button.is-active {
    border-color: var(--accent);
    color: var(--ink-green);
    background: var(--accent-wash);
    font-weight: 560;
  }

  /* On the result step, keep the 2x2 layout but smaller and read-only.
     Hide axis labels there too — caption above explains the structure. */
  .grid-board-result {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .grid-board-result > .grid-corner,
  .grid-board-result > .grid-col-label,
  .grid-board-result > .grid-row-label {
    display: none;
  }

  .grid-board-result > .quadrant {
    display: flex;
    min-height: 160px;
    padding: 14px 14px 12px;
  }

  .grid-board-result .quadrant-title {
    font-size: 0.96rem;
  }

  .grid-board-result .quadrant-hint {
    display: none;
  }

  .grid-board-result .item-row {
    font-size: 0.84rem;
    padding: 5px 8px 5px 10px;
  }
}

@media (max-width: 480px) {
  .quadrant-switcher button {
    font-size: 0.74rem;
    padding: 6px 10px;
  }

  .grid-minimap {
    padding: 10px 10px 12px;
  }

  .grid-minimap-col-label {
    font-size: 0.78rem;
  }

  .grid-minimap-row-label {
    font-size: 0.74rem;
  }
}

/* ===============================================================
   Notebook frame: one paper sheet with cross axes
   The 4 quadrants share a single bounded sheet split by a centered
   "+" axis instead of reading as 4 separate cards. Step 1 (full
   grid) and step 2 (result preview) share this look.
   =============================================================== */

:root {
  --notatnik-axis: oklch(48% 0.06 145 / 0.7);
}

.grid-board {
  gap: 0;
  /* Asymmetric padding so the cross sits at the visual center —
     extra bottom compensates the col-label row above; extra right
     compensates the row-label column to the left. */
  padding: 28px 56px 66px 18px;
  background: var(--paper);
  border: 1px solid oklch(85% 0.02 130);
  border-radius: 12px;
  box-shadow:
    0 1px 0 oklch(100% 0 0 / 0.5) inset,
    0 14px 40px oklch(35% 0.05 130 / 0.06);
}

.grid-col-label {
  padding-top: 4px;
  padding-bottom: 14px;
}

.quadrant {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 24px 26px 22px;
}

.quadrant:hover {
  transform: none;
  box-shadow: none;
}

/* Drop the per-quadrant accent strip — the page is one piece. */
.quadrant::before {
  display: none;
}

/* Cross axes — borders between cells form the X/Y dividers. */
.quadrant[data-quadrant="haveWant"] {
  border-right: 1.5px solid var(--notatnik-axis);
  border-bottom: 1.5px solid var(--notatnik-axis);
}
.quadrant[data-quadrant="haveNotWant"] {
  border-bottom: 1.5px solid var(--notatnik-axis);
}
.quadrant[data-quadrant="notHaveWant"] {
  border-right: 1.5px solid var(--notatnik-axis);
}

/* Result grid keeps the same paper frame; tighter inner padding. */
.grid-board-result .quadrant {
  padding: 20px 22px 18px;
}

.grid-board-result .quadrant:hover {
  border-color: var(--notatnik-axis);
  transform: none;
}

/* ---------- Mobile (≤720px) ---------- */

@media (max-width: 720px) {
  /* Step 1 focus mode: only one quadrant visible at a time, so the
     cross-axis borders would just dangle. Hide them. */
  .grid-board:not(.grid-board-result) > .quadrant {
    border: none;
  }

  /* Reset the asymmetric label-compensation padding on the focus-mode
     main board — there are no labels here on mobile to compensate for. */
  .grid-board:not(.grid-board-result) {
    padding: 18px;
  }

  /* Step 2 result preview: re-assert grid (the .grid-board { display: block }
     rule above forces block for focus mode), keep the 2×2 with cross axes. */
  .grid-board-result {
    display: grid;
    padding: 14px;
  }
}
