:root {
  font-family: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  color: #463b38;
  background: #f7f3ed;
  line-height: 1.55;
  font-synthesis: none;
  --paper: #fffefa;
  --ink: #463b38;
  --muted: #7c6e68;
  --rose: #934f5b;
  --rose-dark: #713b46;
  --line: #e7ded4;
  --blush: #f3e5e3;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 95% 0%, #efdfd950, transparent 45%), #f7f3ed; }
button, input, textarea, select { font: inherit; }
button, .file-button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button { border: 1px solid transparent; background: var(--rose); color: #fffefa; border-radius: 12px; padding: 11px 18px; font-size: .88rem; font-weight: 650; transition: background .18s, box-shadow .18s; }
button:hover { background: var(--rose-dark); }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .file-button:focus-within { outline: 3px solid #ac6978; outline-offset: 3px; }
.quiet { background: transparent; color: var(--rose); padding: 7px 10px; }
.quiet:hover { background: var(--blush); }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif; font-weight: 400; color: var(--ink); }
h1 { line-height: 1.08; letter-spacing: -.035em; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.2; letter-spacing: -.03em; margin-bottom: 12px; }
h3 { font-size: 1.55rem; line-height: 1.25; margin-bottom: 12px; }
h4 { font-size: .9rem; }
em { color: var(--rose); font-weight: 400; }
.eyebrow { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .19em; color: var(--rose); margin-bottom: 12px; }
.muted, small, time, .hint { color: var(--muted); }
.hint { font-size: .78rem; margin: 0; }
.shell { width: min(1140px, 100%); margin: auto; padding: 28px 36px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: 0 6px 24px #6c514207; }
form, label { display: grid; gap: 8px; }
form { gap: 20px; }
label { font-size: .82rem; font-weight: 550; }
input, textarea, select { width: 100%; min-width: 0; background: #fffefa; border: 1px solid #dbd0c6; border-radius: 10px; padding: 12px; color: var(--ink); font-size: .92rem; font-weight: 400; }
input::placeholder, textarea::placeholder { color: #968981; }
textarea { resize: vertical; min-height: 110px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; min-width: 0; padding: 16px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: .74rem; }
.error { color: #aa263d; font-size: .85rem; }
.error:empty { display: none; }
/* The welcome screen is a personal note beside a simple entrance. */
body:has(#login-view:not([hidden])) .shell { min-height: 100svh; display: grid; align-items: center; }
.login { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: clamp(36px, 7vw, 100px); padding: 40px 0; }
.login-story { padding: 10px 0; }
.pair-mark { display: flex; align-items: center; margin-bottom: 36px; }
.pair-mark span { width: 48px; height: 48px; border: 1px solid #bc9a95; background: #eddfd9; color: #7c5155; border-radius: 50%; display: grid; place-items: center; font: italic 1.2rem Georgia, serif; }
.pair-mark span + span { margin-left: -12px; background: #f6eee6; border-color: #c8b69d; color: #7d715b; }
.login h1 { font-size: clamp(2.9rem, 5.5vw, 4.6rem); margin: 20px 0 26px; }
.login-intro { color: var(--muted); font-size: 1rem; line-height: 1.9; }
.story-signature { display: flex; align-items: center; gap: 12px; color: #8b746b; font-size: .75rem; margin-top: 40px; }
.story-signature span { font-size: 1.5rem; color: var(--rose); }
.login-access { padding: clamp(26px, 4vw, 44px); box-shadow: 0 20px 70px #6042360a; position: relative; }
.login-access::before { content: ''; position: absolute; width: 40px; height: 4px; border-radius: 10px; background: #ba8790; top: -2px; left: 44px; }
.login-access h2 { font-size: 2.2rem; }
.login-access > .muted { font-size: .86rem; margin-bottom: 28px; }
.login-access form button { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; margin-top: 5px; }
.login-note { text-align: center; color: var(--muted); font-size: .7rem; margin: 24px 0 0; }
/* Shared navigation. */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand .eyebrow { margin-bottom: 4px; font-size: .6rem; }
.brand h1 { font-size: clamp(1.6rem, 3vw, 2rem); margin: 0; }
.pair-mark.small { margin: 0; }
.pair-mark.small span { width: 35px; height: 35px; font-size: .95rem; }
.pair-mark.small span + span { margin-left: -9px; }
.user { display: flex; align-items: center; gap: 16px; }
.user-label { font-size: .78rem; color: var(--muted); }
.user-label strong { color: var(--ink); font-weight: 600; text-transform: capitalize; }
nav { display: flex; gap: 6px; padding: 8px; background: #eee7df; width: fit-content; border: 1px solid #e7ded4; border-radius: 15px; margin: 28px 0 36px; }
nav button { display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 150px; background: transparent; color: #7c6e68; border-radius: 10px; padding: 10px 22px; }
nav button:hover { background: #f6f0e9; }
nav button.active { background: var(--paper); color: var(--rose-dark); border-color: #e6dbcf; box-shadow: 0 2px 5px #5e46390a; }
nav button span { font-size: 1.3rem; line-height: 1; }
.section-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 0 30px; }
.section-intro .muted { font-size: .88rem; margin: 0; }
.section-intro .eyebrow { margin-bottom: 10px; }
.intro-flower { color: #b58d75; font-size: 5rem; line-height: 1; padding-right: 18px; font-family: Georgia, serif; }
/* The album. */
.moments-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 36px; align-items: start; }
.composer-column { position: sticky; top: 24px; min-width: 0; }
.composer .eyebrow { margin-bottom: 8px; }
.composer h3 { margin: 0; }
.composer textarea { min-height: 140px; background: #fcfaf6; }
.composer .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.composer .actions > button { flex: 1 0 100%; margin-top: 4px; }
.file-button { flex: 1; border: 1px dashed #d7c7bd; border-radius: 10px; padding: 10px 8px; color: #82675e; text-align: center; font-size: .78rem; background: #faf6f0; }
.file-button:hover { background: #f3eae0; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; }
.composer-note { text-align: center; font-size: .72rem; color: #8b7c73; margin: 16px 20px; line-height: 1.7; }
.post-link { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; background: #fcfaf6; }
.post-link input, .post-link select { padding: 9px; font-size: .83rem; }
#photo-preview img { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; }
.album-column { min-width: 0; }
.album-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.album-heading h3 { font-size: 1.45rem; margin: 0; }
.count-badge { font-size: .69rem; color: #85746b; background: #ede5db; padding: 4px 10px; border-radius: 20px; }
.feed { display: grid; gap: 24px; }
.post { padding: 0; overflow: hidden; }
.photo { aspect-ratio: 4/3; background: #eee6dd; display: grid; place-items: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.post-message { font-size: 1.05rem; line-height: 1.75; margin: 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid #f0e9e0; font-size: .73rem; }
.post footer strong { color: var(--rose-dark); font-weight: 600; text-transform: capitalize; }
.post-event { border-top: 1px solid #f0e9e0; padding: 10px 18px; background: #fbf8f2; font-size: .75rem; }
.post-event p { margin: 4px 6px; }
.post-event .quiet { font-size: .73rem; }
.empty { border: 1px dashed #d7c8bd; border-radius: 20px; text-align: center; padding: 55px 28px; color: var(--muted); background: #fffefa66; }
.empty > span { font-size: 2.5rem; color: #b78e91; }
.empty h3 { font-size: 1.4rem; margin: 12px 0; }
.empty p { font-size: .85rem; max-width: 280px; margin: auto; }
/* Calendar controls and legends. */
.calendar-toolbar { margin-bottom: 20px; }
.calendar-top, .calendar-controls, .view-switch, .detail-actions, .calendar-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.calendar-top { justify-content: space-between; margin-bottom: 6px; }
.calendar-top h2 { font-size: 1.7rem; margin: 0; }
.calendar-controls { margin: 22px 0; }
.calendar-controls > .quiet { background: #f5efe7; }
.calendar-controls label { margin-left: auto; font-size: .72rem; }
.calendar-controls input { padding: 8px 10px; font-size: .83rem; }
.view-switch { width: fit-content; border-radius: 10px; background: #f1ebe3; padding: 4px; gap: 3px; }
.view-switch button { color: #7b6c63; background: transparent; padding: 7px 18px; font-size: .78rem; border-radius: 7px; }
.view-switch button:hover { background: #e9dfd4; }
.view-switch .active { background: var(--paper); color: var(--rose-dark); box-shadow: 0 2px 5px #5e463912; }
.calendar-bottom { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
#cal-title { font-size: 1.5rem; margin: 0 auto 0 0; text-transform: capitalize; }
#cal-refresh { font-size: .74rem; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .66rem; color: var(--muted); }
.calendar-legend span { display: flex; align-items: center; gap: 5px; }
.calendar-legend span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #b6818b; }
.calendar-legend .legend-routine::before { background: #6e947c; }
.calendar-legend .legend-reminder::before { background: #c29b50; }
.month-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border: 1px solid var(--line); background: var(--paper); border-radius: 18px; overflow: hidden; }
.day-name { text-align: center; padding: 12px 6px; color: var(--muted); background: #f2ede5; font-size: .7rem; }
.day-cell { min-height: 128px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); padding: 7px; min-width: 0; }
.day-cell:nth-child(7n) { border-right: 0; }
.day-number { display: block; padding: 3px; width: 29px; height: 29px; border-radius: 50%; font-size: .8rem; margin-bottom: 6px; }
.outside { background: #f6f2ec; }
.outside .day-number { color: #a49890; }
.today { background: #fdf4f0; }
.today .day-number { background: var(--rose); color: #fff; }
.cal-event { display: block; width: 100%; text-align: left; padding: 5px 7px; border-radius: 6px; border-left: 2px solid #b6818b; margin: 4px 0; background: #f4e5e8; color: #723c49; font-size: .73rem; line-height: 1.5; overflow-wrap: anywhere; }
.cal-event:hover { background: #ebd4d9; }
.cal-event.routine { background: #e6eee7; color: #3b6149; border-left-color: #6e947c; }
.cal-event.routine:hover { background: #d5e4d9; }
.cal-event.reminder { background: #f8eed9; color: #775a26; border-left-color: #c29b50; }
.cal-event.reminder:hover { background: #f0e1c0; }
.cal-event.completed { opacity: .6; text-decoration: line-through; }
.year-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.year-grid .card { padding: 18px; }
.year-grid .card > button { font: 1.25rem Georgia,serif; text-transform: capitalize; margin-bottom: 8px; }
.mini { border: 0; border-radius: 0; }
.mini .day-cell { min-height: 34px; padding: 0; text-align: center; border: 0; }
.mini .day-number { font-size: .75rem; padding: 2px; width: 25px; height: 25px; margin: auto; }
.mini .day-name { padding: 5px 0; font-size: .65rem; background: transparent; }
.activity-dot { display: block; color: var(--rose); line-height: 7px; }
.schedule-scroll { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line); }
.schedule { display: grid; grid-template-columns: repeat(var(--days),minmax(150px,1fr)); background: var(--paper); }
.schedule.day { grid-template-columns: 1fr; }
.schedule-day { border-right: 1px solid var(--line); min-width: 0; }
.schedule-day:last-child { border-right: 0; }
.schedule-day h4 { padding: 14px 10px; margin: 0; font-weight: 550; font-size: .8rem; background: #f2ede5; }
.schedule-day > .quiet { font-size: .75rem; margin: 4px; }
.hour-slot { min-height: 60px; border-top: 1px solid #eee7dd; padding: 4px 10px; }
.hour-label { font-size: .65rem; color: #9a8c83; }
.all-day { min-height: 18px; padding: 4px; }
/* Dialogs and feedback. */
dialog { width: min(620px,calc(100% - 24px)); max-height: 90dvh; overflow: auto; border: 1px solid var(--line); border-radius: 22px; padding: 30px; color: var(--ink); background: var(--paper); box-shadow: 0 25px 100px #3b292b30; }
dialog::backdrop { background: #3c302f70; backdrop-filter: blur(4px); }
dialog img { max-width: 100%; border-radius: 12px; }
dialog article { margin: 12px 0; }
dialog h2 { font-size: 1.9rem; }
.inline { display: flex; align-items: center; }
.inline input, .weekday-options input { width: auto; accent-color: var(--rose); }
.weekday-options { display: flex; flex-wrap: wrap; gap: 12px; }
.weekday-options label { display: flex; align-items: center; }
.event-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-actions { margin: 22px 0; }
.detail-actions button { font-size: .78rem; }
.app-footer { border-top: 1px solid var(--line); margin: 48px 0 0; padding-top: 24px; text-align: center; font-size: .68rem; color: #99877c; letter-spacing: .03em; }
.app-footer span { color: var(--rose); padding-left: 5px; }
.status { text-align: center; font-size: .84rem; margin: 18px auto 0; }
.status:empty { display: none; }
@media(min-width:1600px) { .shell { padding-top: 40px; } }
@media(max-width:850px) {
  .shell { padding: 24px; }
  .moments-layout { gap: 22px; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); }
  .card { padding: 20px; }
  .post { padding: 0; }
  .login { gap: 32px; }
  .login h1 { font-size: 3.2rem; }
  .year-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:640px) {
  .shell { padding: 20px 16px; }
  .login { grid-template-columns: 1fr; gap: 30px; padding: 12px 8px; max-width: 440px; margin: auto; }
  .login-story .pair-mark { margin-bottom: 22px; }
  .login h1 { font-size: 3.2rem; margin: 14px 0 18px; }
  .login-intro { font-size: .92rem; }
  .story-signature { display: none; }
  .login-access { padding: 26px; }
  .login-access h2 { font-size: 1.9rem; }
  .brand { gap: 10px; }
  .brand h1 { font-size: 1.5rem; }
  .pair-mark.small span { width: 28px; height: 28px; font-size: .8rem; }
  .user { flex-direction: column; align-items: flex-end; gap: 2px; }
  .user-label { font-size: .67rem; }
  .user .quiet { font-size: .75rem; padding: 3px; }
  .app-header { padding-bottom: 20px; }
  nav { width: 100%; margin: 22px 0 28px; }
  nav button { flex: 1; min-width: 0; padding: 9px 12px; }
  .section-intro { margin-bottom: 24px; }
  .section-intro h2 { font-size: 2rem; }
  .section-intro .eyebrow { font-size: .59rem; }
  .intro-flower { display: none; }
  .moments-layout { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .composer-column { position: static; }
  .composer-note { margin-bottom: 0; }
  .post-link { grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 12px; }
  .post-message { margin: 20px; }
  .post footer { padding: 14px 20px; font-size: .68rem; }
  .calendar-toolbar { padding: 18px; }
  .calendar-top h2 { font-size: 1.45rem; }
  .calendar-top > button { font-size: .76rem; padding: 9px 12px; }
  .calendar-controls { gap: 6px; margin: 18px 0; }
  .calendar-controls label { margin-left: 0; width: 100%; margin-top: 8px; }
  .calendar-controls label input { width: 100%; }
  .view-switch { display: grid; grid-template-columns: repeat(4,1fr); width: 100%; gap: 1px; }
  .view-switch button { padding: 7px 8px; }
  #cal-title { font-size: 1.35rem; flex-basis: 100%; }
  .calendar-legend { gap: 10px; font-size: .63rem; }
  #cal-refresh { margin-left: auto; font-size: .68rem; padding: 7px 0; }
  .month-grid:not(.mini) .day-cell { min-height: 95px; padding: 2px; }
  .day-number { font-size: .72rem; width: 25px; height: 25px; padding: 2px; }
  .cal-event { font-size: .62rem; padding: 3px; border-left-width: 1px; }
  .day-cell > .quiet:not(.day-number) { font-size: .6rem; padding: 3px; }
  .year-grid { gap: 10px; }
  .year-grid .card { padding: 10px; border-radius: 14px; }
  .year-grid .card > button { font-size: 1.05rem; }
  dialog { padding: 22px; }
  .app-footer { margin-top: 32px; }
}
@media(max-width:360px) {
  .brand .pair-mark { display: none; }
  .post-link { grid-template-columns: 1fr; }
  .year-grid { grid-template-columns: 1fr; }
  .calendar-legend { gap: 7px; }
}
@media(prefers-reduced-motion:reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
/* Several photos belong to one memory, with a quiet full-size viewer. */
.photo-previews { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.preview-tile { position: relative; aspect-ratio: 1; min-width: 0; }
#photo-preview .preview-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.preview-remove { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: #3e2b30d9; color: white; box-shadow: 0 2px 7px #0002; }
.photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; background: #eee6dd; }
.photo-grid.single-photo { grid-template-columns: 1fr; }
.photo-tile { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 0; overflow: hidden; background: #eee6dd; color: var(--rose-dark); font-size: .8rem; }
.single-photo .photo-tile { aspect-ratio: 4/3; }
.photo-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo-tile:hover img { transform: scale(1.025); }
.photo-tile:focus-visible { outline-offset: -4px; }
.photo-grid:not(.single-photo) .photo-tile:first-child:nth-last-child(odd) { grid-column: 1/-1; aspect-ratio: 16/9; }
dialog.photo-viewer { width: min(1000px,calc(100% - 24px)); padding: 16px; background: #f7f3ed; }
.viewer-toolbar, .viewer-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.viewer-caption { font-size: .8rem; color: var(--muted); }
.viewer-image { display: grid; place-items: center; min-height: 160px; margin: 12px 0; }
.viewer-image img { width: 100%; max-height: 65dvh; object-fit: contain; }
.viewer-controls button { font-size: .8rem; }
/* On a phone, a week is seven quick choices and one readable daily agenda. */
.week-agenda { display: none; }
@media(max-width:760px) {
  .week-desktop { display: none; }
  .week-agenda { display: grid; gap: 18px; }
  .week-days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
  .week-day { display: grid; place-items: center; gap: 3px; min-width: 0; border: 1px solid transparent; border-radius: 11px; padding: 10px 0 6px; background: transparent; color: var(--muted); }
  .week-day:hover { background: var(--blush); }
  .week-day > span:first-child { font-size: .65rem; text-transform: capitalize; }
  .week-day strong { font-size: 1.1rem; font-weight: 550; }
  .week-day.is-today { border-color: #d6b5b7; color: var(--rose-dark); }
  .week-day.selected { color: white; background: var(--rose); border-color: var(--rose); }
  .week-day-count { height: 10px; line-height: 8px; font-size: 1rem; }
  .week-agenda-card { padding: 20px; }
  .week-agenda-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
  .week-agenda-heading h3 { font-size: 1.4rem; margin: 0; text-transform: capitalize; }
  .week-agenda-heading .quiet { font-size: .75rem; white-space: nowrap; padding: 7px 0; }
  .agenda-entry { width: 100%; display: grid; gap: 6px; padding: 16px; text-align: left; margin: 12px 0 0; background: #fbf2f2; border: 1px solid #ead5d8; border-left: 3px solid #b6818b; color: var(--ink); overflow-wrap: anywhere; }
  .agenda-entry:hover { background: #f2e0e4; }
  .agenda-entry.routine { background: #f0f5ef; border-color: #d1dfd3; border-left-color: #6e947c; }
  .agenda-entry.routine:hover { background: #e3ede0; }
  .agenda-entry.reminder { background: #faf5e7; border-color: #ebdfbd; border-left-color: #c29b50; }
  .agenda-entry.reminder:hover { background: #f3eacc; }
  .agenda-time { font-size: .72rem; font-weight: 400; color: #776660; }
  .agenda-entry strong { font-size: 1rem; font-weight: 600; }
  .agenda-meta { font-size: .68rem; color: #776660; font-weight: 400; }
  .agenda-entry.completed strong { text-decoration: line-through; opacity: .65; }
  .week-empty { color: var(--muted); font-size: .87rem; padding: 24px 8px; text-align: center; margin: 0; }
}
