/* Journal section blocks that live on the paper. */

.sheet {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 12px);
  height: 100%;
  padding-bottom: calc(var(--pf, 1) * 20px);
  overflow: hidden;
}

/* Routines on the left, Today + Tomorrow on the right. */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--pf, 1) * 10px) calc(var(--pf, 1) * 22px);
  flex: 1;
  min-height: 0;
}

/* Pinned to the bottom margin of the page, directly under Projects. */
.columns--bottom {
  flex: 0 0 auto;
  padding: calc(var(--pf, 1) * 18px) 0 calc(var(--pf, 1) * 22px);
}

.columns__col {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 12px);
  min-height: 0;
}

.columns__col .section {
  min-height: 0;
}

.columns__col--rule {
  padding-right: calc(var(--pf, 1) * 18px);
  border-right: 1px solid var(--paper-edge);
}

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(var(--pf, 1) * 12px);
  padding-bottom: calc(var(--pf, 1) * 8px);
  border-bottom: 2px solid var(--paper-edge);
}

.sheet__date {
  font-family: var(--font-head);
  font-size: calc(var(--pf, 1) * 26px);
  margin: 0;
}

.sheet__weekday {
  font-size: calc(var(--pf, 1) * 13px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.section {
  position: relative;
}

/* Future Me grows to fill the page down to Projects instead of leaving
   empty space; Projects then sits right below it, just above Routine. */
.section--futureme {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: calc(var(--pf, 1) * 18px);
}

.section--projects {
  flex: none;
}

.section__head {
  display: flex;
  align-items: center;
  gap: calc(var(--pf, 1) * 8px);
  margin-bottom: calc(var(--pf, 1) * 6px);
}

.section__title {
  font-family: var(--font-head);
  font-size: calc(var(--pf, 1) * 15px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.section__count {
  font-size: calc(var(--pf, 1) * 12px);
  color: var(--ink-faint);
}

.section__spacer {
  flex: 1;
}

.section__action {
  font: inherit;
  font-size: calc(var(--pf, 1) * 12px);
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: calc(var(--pf, 1) * 2px) calc(var(--pf, 1) * 8px);
  cursor: pointer;
}

.section__action:hover {
  border-color: var(--paper-edge);
  color: var(--ink);
}

.section__action[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Future Me ------------------------------------------------ */
.futureme {
  display: flex;
  flex: 1;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  gap: calc(var(--pf, 1) * 16px);
  padding: calc(var(--pf, 1) * 22px) calc(var(--pf, 1) * 22px);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--paper-edge);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
}

.futureme:hover {
  border-color: var(--accent);
}

.futureme__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 23px);
  color: var(--ink-soft);
  line-height: 1.4;
  overflow: hidden;
}

.futureme.is-done {
  border-left-color: var(--done);
}

.futureme__seal {
  align-self: flex-start;
  flex: none;
  font-size: calc(var(--pf, 1) * 11px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--done);
  white-space: nowrap;
}

/* ---- Generic rows --------------------------------------------- */
.rows {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--line-height);
  padding: 0 2px;
}

.row:hover {
  background: rgba(0, 0, 0, 0.035);
}

.row__num {
  flex: none;
  width: calc(var(--pf, 1) * 14px);
  font-size: calc(var(--pf, 1) * 11px);
  color: var(--ink-faint);
  text-align: right;
}

.row__text {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 21px);
  line-height: calc(var(--line-height) - 2px);
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 0 2px;
}

.row__text:focus {
  outline: none;
  box-shadow: 0 1px 0 var(--accent);
}

.row__text::placeholder {
  font-family: var(--font-body);
  font-size: calc(var(--pf, 1) * 16px);
  color: var(--ink-faint);
}

.row.is-done .row__text {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.row__del {
  font: inherit;
  font-size: calc(var(--pf, 1) * 14px);
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  padding: 2px 4px;
}

.row:hover .row__del {
  opacity: 1;
}

.row__del:hover {
  color: var(--danger);
}

/* Hand-drawn checkbox */
.check {
  flex: none;
  width: calc(var(--pf, 1) * 18px);
  height: calc(var(--pf, 1) * 18px);
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink-soft);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--done);
  font-size: calc(var(--pf, 1) * 13px);
  line-height: 1;
}

.check[aria-checked="true"]::after {
  content: "\2713";
}

.check[disabled] {
  cursor: default;
}

.check--sm {
  width: calc(var(--pf, 1) * 15px);
  height: calc(var(--pf, 1) * 15px);
  font-size: calc(var(--pf, 1) * 11px);
}

/* ---- Projects -------------------------------------------------- */
.projects {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 8px);
}

/* Three project slots, stacked; the milestones live in a pop-up. */
.project-slots {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 10px);
}

.project-slot {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: calc(var(--pf, 1) * 16px);
  min-width: 0;
  padding: calc(var(--pf, 1) * 10px) calc(var(--pf, 1) * 12px);
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.24);
}

.project-slot:hover {
  border-color: var(--accent);
}

.project-slot.is-done {
  border-left-color: var(--done);
  background: rgba(77, 122, 78, 0.1);
}

.project-slot--empty {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(var(--pf, 1) * 5px);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border-left-color: var(--paper-edge);
  border-style: dashed;
  background: transparent;
}

.project-slot--empty[disabled] {
  cursor: default;
  opacity: 0.5;
}

.project-slot__main {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 5px);
  min-width: 0;
  height: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* Right column: the single next milestone to focus on for this project. */
.project-slot__upcoming {
  display: flex;
  align-items: center;
  gap: calc(var(--pf, 1) * 10px);
  min-width: 0;
  padding-left: calc(var(--pf, 1) * 14px);
  border-left: 1px solid var(--paper-edge);
}

.project-slot__upcoming-text {
  min-width: 0;
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 17px);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-slot__name {
  font-family: var(--font-head);
  font-size: calc(var(--pf, 1) * 17px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-slot--empty .project-slot__name {
  color: var(--ink-faint);
}

.project-slot__meta {
  font-size: calc(var(--pf, 1) * 12px);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.project__progress {
  height: calc(var(--pf, 1) * 4px);
  border-radius: 4px;
  background: var(--paper-edge);
  overflow: hidden;
}

.project__bar {
  display: block;
  height: 100%;
  background: var(--accent);
}

.milestones {
  margin: calc(var(--pf, 1) * 4px) 0 calc(var(--pf, 1) * 8px);
  padding: 0 0 0 calc(var(--pf, 1) * 4px);
  list-style: none;
  display: flex;
  flex-direction: column;
}

.row--backlog .section__action {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
}

.row--backlog:hover .section__action,
.row--backlog:focus-within .section__action {
  opacity: 1;
}

.row--backlog .section__action[disabled] {
  opacity: 0;
}

.project-detail__foot {
  display: flex;
  align-items: center;
  gap: calc(var(--pf, 1) * 8px);
  padding-top: calc(var(--pf, 1) * 8px);
  border-top: 1px solid var(--paper-edge);
}

.milestone {
  display: flex;
  align-items: center;
  gap: calc(var(--pf, 1) * 7px);
  height: var(--line-height);
}

.milestone__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 17px);
  line-height: calc(var(--line-height) - 2px);
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 0 2px;
}

.milestone__text:focus {
  outline: none;
  box-shadow: 0 1px 0 var(--accent);
}

.milestone.is-done .milestone__text {
  color: var(--ink-faint);
  text-decoration: line-through;
}

/* ---- Right page: notes + journal ------------------------------- */
.writing {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.writing__area {
  flex: 1;
  width: 100%;
  min-height: calc(var(--line-height) * 4);
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 21px);
  line-height: var(--line-height);
  color: var(--ink);
  background: transparent;
  border: none;
  resize: none;
  padding: 0 2px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.writing__area:focus {
  outline: none;
}

.writing__area::placeholder {
  font-family: var(--font-body);
  font-size: calc(var(--pf, 1) * 17px);
  color: var(--ink-faint);
}

.journal-sheet {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 12px);
  height: 100%;
  padding-bottom: calc(var(--pf, 1) * 20px);
  overflow: hidden;
}

.journal-sheet .section {
  display: flex;
  flex-direction: column;
}

.journal-sheet .section--notes {
  flex: 0 0 38%;
  min-height: 0;
}

.journal-sheet .section--journal {
  flex: 1;
  min-height: 0;
}

/* ---- Reflections (milestone completion entries) ---------------- */
.reflections {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pf, 1) * 6px);
  max-height: 22%;
  overflow: auto;
}

.reflection {
  border-left: 3px solid var(--accent-2);
  padding: calc(var(--pf, 1) * 4px) calc(var(--pf, 1) * 10px);
  background: rgba(0, 0, 0, 0.03);
  border-radius: 0 4px 4px 0;
}

.reflection__meta {
  font-size: calc(var(--pf, 1) * 11px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.reflection__body {
  font-family: var(--font-hand);
  font-size: calc(var(--pf, 1) * 15px);
  white-space: pre-wrap;
}

/* ---- Share preview --------------------------------------------- */
.share {
  display: flex;
  justify-content: center;
}

.share__canvas {
  max-width: 100%;
  max-height: 56vh;
  cursor: pointer;
  border: 1px solid var(--paper-edge);
  border-radius: 4px;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
}

/* ---- Year book ------------------------------------------------- */
.yearbook__filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.yearbook__filters .field {
  margin: 0;
}

.yearbook__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow: auto;
}

.yb-entry {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--paper-edge);
  border-radius: 5px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.25);
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}

.yb-entry:hover {
  border-color: var(--accent);
}

.yb-entry__date {
  flex: none;
  width: 108px;
  font-family: var(--font-head);
  font-size: 14px;
}

.yb-entry__preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yb-entry__stats {
  flex: none;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---- Theme manager --------------------------------------------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.theme-card {
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.theme-card.is-active {
  outline: 2px solid var(--accent);
}

.theme-card__swatch {
  height: 68px;
  display: flex;
}

.theme-card__swatch span {
  flex: 1;
}

.theme-card__meta {
  padding: 6px 8px;
}

.theme-card__name {
  font-family: var(--font-head);
  font-size: 14px;
}

.theme-card__author {
  font-size: 11px;
  color: var(--ink-faint);
}
