:root {
  --ink: #17191e;
  --muted: #696c76;
  --paper: #f5f3ee;
  --warm-white: #fcfbf7;
  --line: #dad7ce;
  --violet: #7866b6;
  --violet-dark: #4d3e85;
  --lavender: #ece8fb;
  --danger: #9d3840;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 560px; padding: 9.5rem 2rem 6rem;
  text-align: center; color: #f8f6ff; background: #262333;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; inset: 0; opacity: .8;
  background-image: radial-gradient(circle at 12% 20%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 82% 24%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 22% 70%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 76% 76%, #fff 0 1px, transparent 1.5px);
  background-size: 250px 250px, 370px 370px, 300px 300px, 470px 470px;
}
.hero__glow { position: absolute; z-index: -1; width: 34rem; height: 34rem; top: -12rem; left: 50%; transform: translateX(-50%); border-radius: 50%; background: #9f8cd9; filter: blur(85px); opacity: .45; }
.eyebrow, .section-kicker { margin: 0; color: var(--violet); font: 500 .71rem/1.2 "DM Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.hero .eyebrow { color: #c9bdf7; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; }
h1 { max-width: 760px; margin: 1rem auto 1.4rem; font-size: clamp(3.6rem, 9vw, 7rem); line-height: .98; letter-spacing: -.06em; }
h1 em { color: #c9bdf7; font-weight: inherit; }
.hero__copy { max-width: 470px; margin: 0 auto 2rem; color: #d0cdd7; font-size: 1.08rem; line-height: 1.65; }
.hero__link { color: #fff; font: 500 .86rem "DM Mono", monospace; text-decoration: none; border-bottom: 1px solid #aea3d2; padding-bottom: .35rem; }
.hero__link span { margin-left: .35rem; color: #c9bdf7; }

.content-section { width: min(1080px, calc(100% - 3rem)); margin: 0 auto; padding: 7rem 0; }
.create-section { border-bottom: 1px solid var(--line); }
.section-heading { margin-bottom: 2.4rem; }
.section-heading--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
h2 { margin: .55rem 0 0; font-size: clamp(2.2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.045em; }
.capsule-count { margin: 0; color: var(--muted); font: .77rem "DM Mono", monospace; white-space: nowrap; }

.capsule-form { padding: clamp(1.4rem, 4vw, 3.2rem); background: var(--warm-white); border: 1px solid var(--line); box-shadow: 0 14px 40px #2c28310c; }
.form-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem; }
.field { min-width: 0; }
.field--message { grid-column: 1 / -1; }
label { display: block; margin-bottom: .6rem; font-size: .82rem; font-weight: 600; }
label span, .field__hint { color: var(--muted); font-weight: 400; }
input, textarea { display: block; width: 100%; border: 1px solid #c9c6bd; border-radius: 2px; padding: .8rem .9rem; color: var(--ink); background: #fffefa; outline: none; }
textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px #7866b625; }
.field__hint { margin: .45rem 0 0; font-size: .76rem; line-height: 1.4; }
.field__footer { display: flex; justify-content: space-between; gap: 1rem; }
.field__footer output { flex: none; margin-top: .45rem; color: var(--muted); font: .7rem "DM Mono", monospace; }
.form-error { margin: 1.3rem 0 0; color: var(--danger); font-size: .87rem; }
.button { border: 0; border-radius: 2px; padding: .82rem 1.1rem; font-size: .85rem; font-weight: 600; transition: transform .18s ease, background .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .dialog-close:focus-visible, .card-button:focus-visible { outline: 3px solid #b2a3e7; outline-offset: 3px; }
.button--primary { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.7rem; color: #fff; background: var(--violet-dark); }
.button--primary:hover { background: #392d68; }
.button__lock { font-size: 1.1rem; }

.capsules-section { padding-bottom: 8rem; }
.empty-state { padding: 4.3rem 1.5rem; border: 1px dashed #c7c3ba; text-align: center; color: var(--muted); }
.empty-state[hidden] { display: none; }
.empty-state__orb { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; margin: 0 auto 1.1rem; border-radius: 50%; color: var(--violet-dark); background: var(--lavender); font-size: 1.4rem; }
.empty-state h3 { margin-bottom: .45rem; color: var(--ink); font-size: 1.5rem; }
.empty-state p { margin: 0; font-size: .9rem; }
.capsule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.capsule-card { position: relative; min-height: 270px; padding: 1.5rem; overflow: hidden; border: 1px solid var(--line); background: var(--warm-white); }
.capsule-card--locked { background: linear-gradient(145deg, #eeebf8, #f9f8f4 62%); }
.capsule-card--unlocked { background: #fffefa; }
.card-status { display: flex; align-items: center; gap: .4rem; margin: 0 0 1.9rem; color: var(--violet-dark); font: 500 .67rem "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.card-status__lock { font-size: 1rem; }
.capsule-card h3 { overflow-wrap: anywhere; margin: 0 0 .6rem; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.03em; }
.card-date { margin: 0; color: var(--muted); font-size: .76rem; }
.countdown { margin: 1.75rem 0 .6rem; color: var(--violet-dark); font: 500 clamp(1rem, 2vw, 1.25rem) "DM Mono", monospace; }
.card-caption { margin: 0; color: var(--muted); font-size: .76rem; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; position: absolute; right: 1.3rem; bottom: 1.2rem; left: 1.3rem; }
.card-button { border: 0; padding: 0; color: var(--violet-dark); background: transparent; font-weight: 600; font-size: .82rem; }
.card-button:hover { text-decoration: underline; }
.card-button--delete { color: var(--muted); font-size: .75rem; font-weight: 400; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.7rem max(1.5rem, calc((100% - 1080px) / 2)); color: #bcbac2; background: #202029; font: .68rem "DM Mono", monospace; }
footer p { margin: 0; }

dialog { width: min(580px, calc(100% - 2rem)); max-height: min(680px, calc(100% - 2rem)); padding: 0; border: 0; background: transparent; }
dialog::backdrop { background: #16131dcc; backdrop-filter: blur(3px); }
dialog article { position: relative; padding: clamp(1.75rem, 5vw, 3rem); background: var(--warm-white); box-shadow: 0 25px 70px #09070f77; }
.message-dialog h2, .confirm-dialog h2 { margin-top: .6rem; font-size: clamp(2rem, 5vw, 3rem); overflow-wrap: anywhere; }
.dialog-close { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%; color: var(--muted); background: #efede7; font-size: 1.35rem; line-height: 1; }
.dialog-date { margin: 0 0 2rem; color: var(--muted); font: .72rem "DM Mono", monospace; }
.dialog-message { white-space: pre-wrap; overflow-wrap: anywhere; color: #313038; line-height: 1.75; }
.confirm-dialog p:not(.section-kicker) { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 2rem; }
.button--quiet { color: var(--ink); background: #e9e7e1; }
.button--danger { color: #fff; background: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .hero { min-height: 500px; padding: 7.5rem 1.5rem 4rem; }
  .content-section { width: min(100% - 2rem, 1080px); padding: 4.5rem 0; }
  .form-grid, .capsule-grid { grid-template-columns: 1fr; }
  .capsule-card { min-height: 245px; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
