@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Song+Myung&display=swap');

:root {
  color-scheme: light;
  --paper: #f7f2e8;
  --paper-deep: #e9dfcb;
  --ink: #251f1a;
  --muted: #6f655b;
  --pepper: #b72c20;
  --pepper-dark: #7e1c16;
  --scallion: #356b4c;
  --line: #cbbca3;
  font-family: 'Gowun Dodum', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(98, 77, 49, 0.035) 1px, transparent 1px);
  background-size: 100% 32px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.masthead,
main {
  width: min(1500px, calc(100% - 48px));
  margin-inline: auto;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 390px);
  gap: 48px;
  align-items: end;
  padding: 60px 0 36px;
  border-bottom: 3px double var(--ink);
}

.date-line { margin: 0 0 8px; color: var(--scallion); font-weight: 700; }

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-family: 'Song Myung', serif;
  font-size: clamp(3.2rem, 7vw, 7.2rem);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.progress-block { padding-bottom: 8px; }
.progress-copy { display: flex; justify-content: space-between; align-items: baseline; }
.progress-copy span { color: var(--muted); }
.progress-copy strong { font-family: 'Song Myung', serif; font-size: 2.5rem; font-weight: 400; }
.progress-track { height: 12px; overflow: hidden; border: 1px solid var(--ink); background: transparent; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--pepper); transition: width 180ms ease; }
.progress-block small { display: block; margin-top: 8px; color: var(--muted); text-align: right; }

main { padding: 36px 0 80px; }

.today-panel {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) 1.3fr;
  gap: 40px;
  padding: 28px;
  color: #fffaf0;
  background: var(--pepper);
  border: 2px solid var(--pepper-dark);
  box-shadow: 8px 8px 0 var(--ink);
}

.today-heading { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; }
.today-heading p { margin-bottom: 8px; color: #f2c3b7; }
.today-heading h2 { margin-bottom: 26px; font-family: 'Song Myung', serif; font-size: clamp(2rem, 4vw, 3.6rem); font-weight: 400; line-height: 1; }
.theme-stamp { padding: 5px 13px 7px; color: var(--pepper); background: #fffaf0; border-radius: 999px; font-weight: 700; }
.today-list { display: grid; gap: 8px; }

.week-section { margin-top: 76px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 20px; }
.section-heading h2, .rules h2 { margin-bottom: 6px; font-family: 'Song Myung', serif; font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 400; }
.section-heading p { margin-bottom: 0; color: var(--muted); }
.reset-button { padding: 9px 14px; color: var(--muted); background: transparent; border: 1px solid var(--line); }
.reset-button:hover { color: var(--pepper); border-color: var(--pepper); }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(178px, 1fr)); border-top: 2px solid var(--ink); border-left: 1px solid var(--line); overflow-x: auto; }

.day-card { min-width: 178px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.2); }
.day-card.is-today { background: rgba(183, 44, 32, .08); }
.day-card > header { min-height: 108px; padding: 16px; border-bottom: 1px solid var(--line); }
.day-card > header div { display: flex; align-items: baseline; gap: 8px; }
.day-card > header span { display: grid; place-items: center; width: 32px; height: 32px; color: var(--paper); background: var(--ink); border-radius: 50%; }
.day-card.is-today > header span { background: var(--pepper); }
.day-card h3 { margin-bottom: 0; font-size: 1.15rem; }
.day-card header em { display: block; margin-top: 10px; color: var(--scallion); font-style: normal; font-weight: 700; }

.task-list { min-height: 350px; padding: 8px 16px; }
.task { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.task:last-child { border-bottom: 0; }
.task input { width: 17px; height: 17px; margin: 4px 0 0; accent-color: var(--scallion); }
.task-copy { display: grid; gap: 2px; }
.task-copy small { color: var(--pepper); font-weight: 700; }
.task-copy strong { font-size: .94rem; line-height: 1.35; }
.task-copy em { color: #f4d7cf; font-size: .9rem; font-style: normal; line-height: 1.5; }
.task.is-done .task-copy { opacity: .52; text-decoration: line-through; }
.task-detailed { padding: 14px; color: inherit; border: 1px solid rgba(255,255,255,.28); }
.task-detailed:last-child { border-bottom: 1px solid rgba(255,255,255,.28); }
.task-detailed input { accent-color: #fffaf0; }
.task-detailed .task-copy small { color: #f2c3b7; }
.task-detailed .task-copy strong { font-size: 1.05rem; }

.metrics { display: grid; gap: 12px; margin: 0; padding: 14px 10px 16px; border: 0; border-top: 1px solid var(--line); }
.metrics legend { padding: 13px 0 0; color: var(--muted); font-size: .8rem; }
.metrics label { display: grid; gap: 4px; color: var(--muted); font-size: .75rem; }
.metrics input { width: 100%; padding: 7px 5px; color: var(--ink); background: rgba(255,255,255,.45); border: 1px solid var(--line); text-align: center; }
.metrics input[aria-invalid="true"] { border-color: var(--pepper); outline-color: var(--pepper); }
.post-metrics { padding: 10px; background: rgba(255,255,255,.24); border: 1px solid var(--line); }
.post-metrics h4 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 9px; font-family: 'Song Myung', serif; font-size: .95rem; font-weight: 400; }
.post-metrics h4 small { color: var(--muted); font-family: inherit; font-size: .7rem; white-space: nowrap; }
.metric-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }

.rules { margin-top: 72px; padding-top: 28px; border-top: 3px double var(--ink); }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); }
.rule-grid p { display: grid; gap: 4px; margin: 0; padding: 20px; border-right: 1px solid var(--line); }
.rule-grid p:last-child { border-right: 0; }
.rule-grid strong { color: var(--pepper); font-family: 'Song Myung', serif; font-size: 1.5rem; font-weight: 400; }
.rule-grid span, .disclosure { color: var(--muted); }
.disclosure { margin: 14px 0 0; font-size: .9rem; }

dialog { width: min(420px, calc(100% - 32px)); padding: 0; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); box-shadow: 8px 8px 0 rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(37,31,26,.55); }
dialog form { padding: 28px; }
dialog h2 { margin-bottom: 10px; font-family: 'Song Myung', serif; font-weight: 400; }
dialog p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-actions button { padding: 8px 15px; background: transparent; border: 1px solid var(--line); }
.dialog-actions .danger { color: white; background: var(--pepper); border-color: var(--pepper); }

:focus-visible { outline: 3px solid var(--scallion); outline-offset: 3px; }

@media (max-width: 800px) {
  .masthead, main { width: min(100% - 28px, 650px); }
  .masthead { grid-template-columns: 1fr; gap: 28px; padding-top: 34px; }
  h1 { font-size: clamp(3rem, 16vw, 5rem); }
  .today-panel { grid-template-columns: 1fr; gap: 22px; padding: 22px; box-shadow: 5px 5px 0 var(--ink); }
  .theme-stamp { display: none; }
  .week-section { margin-top: 58px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .week-grid { grid-template-columns: 1fr; overflow: visible; border-left: 0; }
  .day-card { min-width: 0; border-left: 1px solid var(--line); }
  .day-card > header { min-height: 0; display: flex; justify-content: space-between; align-items: center; }
  .day-card > header em { margin-top: 0; }
  .task-list { min-height: 0; }
  .rule-grid { grid-template-columns: 1fr; }
  .rule-grid p { border-right: 0; border-bottom: 1px solid var(--line); }
  .rule-grid p:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
