/* Christmas plans. Values from the approved design canvas (spec section 5.3). */

:root {
  --ground: #F4F1EA;
  --ink: #2A2823;
  --muted: #6B665C;
  --card: #FFFFFF;
  --line: #DDD6C8;
  --tray: #EAE5D9;
  --chip: #EFEBE2;
  --teal: #3E6B68;
  --plum: #6A4C7A;
  --clay: #B5643F;
  --sage: #7A8B6F;
  --sage-ink: #2A4D4A;
  --danger: #9B3B2E;

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Public Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.35;
}

[hidden] { display: none !important; }

a { color: var(--teal); }
a:hover { color: var(--sage-ink); }

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- Page ---------- */

.page { max-width: 1200px; margin: 0 auto; padding: 32px 40px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; flex-wrap: wrap; margin-bottom: 28px;
}

.page-title { font-family: var(--serif); font-weight: 600; font-size: 40px; margin: 0 0 6px; line-height: 1.1; }
.sub { margin: 0; color: var(--muted); font-size: 15px; }
.site-url { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.link-btn {
  background: none; border: 0; padding: 0; color: var(--teal);
  text-decoration: underline; cursor: pointer; font-size: inherit;
}
.link-btn:hover { color: var(--sage-ink); }

.layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; }

/* ---------- Planner (desktop) ---------- */

.col-heads, .day {
  display: grid; grid-template-columns: 110px repeat(3, 1fr); gap: 10px;
}
.col-heads { margin-bottom: 10px; }
.col-heads span {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.day { margin-bottom: 12px; }
.day-label { padding-top: 10px; }
.day-date { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.day-weekday { font-size: 13px; color: var(--muted); }

.tray {
  grid-column: 2 / span 3;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  background: var(--tray); border-radius: 12px; padding: 10px;
  min-height: 64px; position: relative;
}

/* Invisible slot cells behind the cards: click to add, highlight on drag. */
.zone {
  border-radius: 10px; min-height: 44px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 20px; transition: background 0.12s;
}
.zone:hover { background: rgba(255, 255, 255, 0.45); color: var(--muted); }
.zone.drop-hint { background: rgba(62, 107, 104, 0.18); outline: 2px dashed var(--teal); outline-offset: -2px; }

/* ---------- Cards ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--teal);
  border-radius: 10px; padding: 10px 12px; cursor: grab; position: relative; z-index: 1;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  min-width: 0; overflow-wrap: anywhere;
}
.card:hover { box-shadow: 0 1px 4px rgba(42, 40, 35, 0.12); }
.card.accent-plum { border-left-color: var(--plum); }
.card.accent-clay { border-left-color: var(--clay); }
.card.accent-sage { border-left-color: var(--sage); }
.card.dragging { opacity: 0.35; }

.card-title { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 0 0 4px; line-height: 1.25; }
.card-time { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.card-place { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card-link { display: inline-block; font-size: 13px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: var(--mono); font-size: 11px; background: var(--chip); padding: 2px 6px; border-radius: 4px; }

.ghost {
  position: fixed; z-index: 1000; pointer-events: none; margin: 0;
  box-shadow: 0 10px 28px rgba(42, 40, 35, 0.25); transform: rotate(1.5deg); opacity: 0.95;
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

.foot { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Options ---------- */

.options {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; position: sticky; top: 24px;
}
.options.drop-hint { outline: 2px dashed var(--sage); outline-offset: 2px; }
.options-heading { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 12px; }
.options-toggle { display: none; }
#option-list .card { margin-bottom: 10px; }
.options-empty { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

.add-option {
  width: 100%; padding: 12px; border: 1px dashed var(--sage); border-radius: 10px;
  background: transparent; color: var(--sage-ink); font-size: 15px; cursor: pointer;
}
.add-option:hover { background: rgba(122, 139, 111, 0.08); }

/* ---------- Sign-in ---------- */

.login { max-width: 420px; margin: 0 auto; padding: 64px 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin-top: 24px; display: flex; flex-direction: column; gap: 10px;
}
.login-card p { margin: 0; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
#code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; }

/* ---------- Forms ---------- */

label, legend { font-size: 13px; font-weight: 600; display: block; margin: 10px 0 4px; }
.hint { font-weight: 400; color: var(--muted); }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus { border-color: var(--teal); }

.btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--sage-ink); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: rgba(155, 59, 46, 0.08); }
.btn:disabled { opacity: 0.6; cursor: default; }

.msg { font-size: 14px; color: var(--muted); min-height: 1em; margin: 6px 0 0; }
.msg.error { color: var(--danger); }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--ground); color: var(--ink);
}
dialog::backdrop { background: rgba(42, 40, 35, 0.4); }
#card-form { padding: 20px; }
#form-title { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.people label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400;
  font-family: var(--mono); font-size: 13px; background: var(--chip);
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
}
.people input { width: auto; margin: 0; }
.form-buttons { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.spacer { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ---------- Phone ---------- */

@media (max-width: 759px) {
  .page { padding: 48px 16px 32px; }
  .page-head { margin-bottom: 16px; }
  .page-title { font-size: 28px; margin-bottom: 2px; }
  .site-url, .sub-dates, .col-heads, .options-heading, .foot { display: none; }

  .layout { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .options { order: -1; position: static; padding: 0; border-radius: 10px; }
  .options-toggle {
    display: flex; width: 100%; justify-content: space-between; align-items: center;
    background: none; border: 0; padding: 12px 14px; cursor: pointer;
  }
  .options-title { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--sage-ink); }
  .toggle-word { font-family: var(--mono); font-size: 13px; color: var(--muted); }
  .options-body { display: none; padding: 0 14px 14px; }
  .options.open .options-body { display: block; }

  .day { display: block; margin-bottom: 24px; }
  .pday-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 8px; }
  .pslot { margin-bottom: 8px; border-radius: 10px; }
  .pslot.drop-hint { outline: 2px dashed var(--teal); outline-offset: 2px; }
  .pslot-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
  }
  .pslot .card { padding: 8px 12px; margin-bottom: 8px; }
  .pslot-empty {
    width: 100%; border: 1px dashed var(--line); border-radius: 10px; background: transparent;
    padding: 8px 12px; text-align: left; color: var(--muted); font-size: 13px; cursor: pointer;
  }
  .card-time { font-size: 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 0; }
  .card-place { margin: 2px 0 0; }
}
