:root {
  color-scheme: dark;
  --ink: #fff8ed;
  --muted: rgba(255, 248, 237, 0.72);
  --line: rgba(255, 248, 237, 0.24);
  --panel: rgba(32, 28, 24, 0.34);
  --panel-strong: rgba(18, 18, 18, 0.52);
  --accent: #ffd074;
  --accent-two: #98dfd6;
  --shadow: rgba(0, 0, 0, 0.34);
  --shade-left: rgba(10, 12, 14, 0.52);
  --shade-mid: rgba(10, 12, 14, 0.14);
  --shade-right: rgba(10, 12, 14, 0.62);
  --mobile-shade-top: rgba(12, 13, 15, 0.38);
  --mobile-shade-bottom: rgba(12, 13, 15, 0.72);
  --glow-a: rgba(255, 255, 255, 0.18);
  --glow-b: rgba(152, 223, 214, 0.1);
  --texture-line: rgba(255, 255, 255, 0.04);
  --texture-opacity: 0.55;
  --drift-duration: 18s;
  --drift-x: 18px;
  --drift-y: -10px;
  --default-glow-a: rgba(255, 208, 116, 0.48);
  --default-glow-b: rgba(152, 223, 214, 0.44);
  --default-base-a: rgba(22, 31, 36, 0.78);
  --default-base-b: rgba(76, 63, 50, 0.5);
  --bg-pc: none;
  --bg-sp: none;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #15130f;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(90deg, var(--shade-left), var(--shade-mid) 48%, var(--shade-right)),
    var(--bg-pc);
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, var(--glow-a), transparent 28%),
    radial-gradient(circle at 76% 72%, var(--glow-b), transparent 30%),
    repeating-linear-gradient(100deg, var(--texture-line) 0 1px, transparent 1px 9px);
  mix-blend-mode: soft-light;
  opacity: var(--texture-opacity);
  animation: drift var(--drift-duration) ease-in-out infinite alternate;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 54px);
  background: linear-gradient(180deg, rgba(16, 15, 13, 0.68), rgba(16, 15, 13, 0.12));
  backdrop-filter: blur(16px);
}

.topline {
  margin: 0;
  font-size: clamp(15px, 1.5vw, 21px);
  letter-spacing: 0;
  text-shadow: 0 1px 20px var(--shadow);
}

.login-link,
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.12);
}

.login-link {
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
}

.icon-button {
  display: none;
  border-radius: 50%;
  cursor: pointer;
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  margin: 2px 0;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 23vw);
  gap: clamp(22px, 3vw, 44px);
  width: min(1480px, calc(100vw - 56px));
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 24px 0 58px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(330px, 42vh);
  gap: clamp(18px, 2vw, 30px);
  align-content: start;
}

.work-card {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  isolation: isolate;
  transform: translateY(14px);
  opacity: 0;
  animation: cardIn 700ms ease forwards;
}

.work-open {
  position: absolute;
  inset: 0;
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.work-card:nth-child(2) {
  animation-delay: 90ms;
}

.work-card:nth-child(3) {
  animation-delay: 180ms;
}

.work-card img,
.default-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  opacity: 0.68;
  transition: transform 700ms ease, opacity 700ms ease;
}

.default-art {
  background:
    radial-gradient(circle at 26% 18%, var(--default-glow-a), transparent 23%),
    radial-gradient(circle at 74% 72%, var(--default-glow-b), transparent 28%),
    linear-gradient(135deg, var(--default-base-a), var(--default-base-b));
}

.work-card:hover img,
.work-card:hover .default-art {
  transform: scale(1.11);
  opacity: 0.8;
}

.card-copy {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 24px 24px 104px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.56), transparent);
}

.card-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 58px);
  font-weight: 500;
  line-height: 0.98;
}

.card-copy p {
  max-width: 34em;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.card-meta {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.card-engagement {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 3;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 248, 237, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.engagement-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.engagement-button,
.comment-form button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.engagement-button {
  padding: 0 13px;
}

.engagement-button:disabled,
.comment-form button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.engagement-status {
  min-width: 4em;
  color: var(--muted);
  font-size: 12px;
}

.comment-drawer {
  display: grid;
  gap: 10px;
}

.comment-drawer[hidden] {
  display: none;
}

.comment-list {
  display: grid;
  gap: 7px;
  max-height: 148px;
  overflow: auto;
}

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

.comment-item {
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.comment-item strong,
.comment-item time {
  font-size: 12px;
}

.comment-item strong {
  margin-right: 8px;
}

.comment-item time {
  color: var(--muted);
}

.comment-item p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(70px, 0.34fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.11);
  font: inherit;
  font-size: 13px;
}

.comment-form input {
  height: 34px;
  padding: 0 10px;
}

.comment-form textarea {
  min-height: 34px;
  max-height: 86px;
  padding: 8px 10px;
  resize: vertical;
}

.comment-form input::placeholder,
.comment-form textarea::placeholder {
  color: rgba(255, 248, 237, 0.56);
}

.comment-form button {
  padding: 0 14px;
}

.timeline {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 22px 20px;
  border-left: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(18px);
}

.year {
  margin: 0 0 26px;
}

.year-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 24px;
}

.year-title::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent-two);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.08);
}

.month-node {
  margin-left: 5px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.month-node summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  list-style: none;
  padding: 8px 0;
}

.month-node summary small {
  min-width: 28px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.month-node summary::-webkit-details-marker {
  display: none;
}

.day-node {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  padding: 4px 0 6px 0;
}

.day-label {
  color: var(--accent-two);
  font-size: 13px;
  line-height: 1.5;
}

.day-links {
  display: grid;
  gap: 3px;
}

.day-link {
  display: block;
  padding: 0 0 5px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.45;
}

.day-link:hover {
  color: var(--ink);
}

.challenge-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.62);
  backdrop-filter: blur(18px);
}

.challenge-box {
  width: min(420px, calc(100vw - 36px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.66);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.challenge-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.challenge-box h2 {
  margin: 0 0 18px;
  font-size: 34px;
  font-weight: 500;
}

.challenge-question {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 30px;
}

.challenge-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  font: inherit;
}

.challenge-box button {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.13);
  font: inherit;
  cursor: pointer;
}

.challenge-hint,
.challenge-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
}

body.theme-morning {
  --ink: #fff8ed;
  --muted: rgba(255, 248, 237, 0.72);
  --panel: rgba(32, 28, 24, 0.34);
  --accent: #ffd074;
  --accent-two: #98dfd6;
  --shade-left: rgba(10, 12, 14, 0.5);
  --shade-mid: rgba(25, 22, 18, 0.1);
  --shade-right: rgba(10, 12, 14, 0.58);
  --mobile-shade-top: rgba(24, 20, 15, 0.28);
  --mobile-shade-bottom: rgba(18, 16, 12, 0.7);
  --glow-a: rgba(255, 236, 180, 0.2);
  --glow-b: rgba(142, 214, 205, 0.1);
  --texture-line: rgba(255, 241, 204, 0.045);
  --texture-opacity: 0.52;
  --drift-duration: 20s;
  --drift-x: 14px;
  --drift-y: -8px;
  --default-glow-a: rgba(255, 208, 116, 0.48);
  --default-glow-b: rgba(152, 223, 214, 0.44);
  --default-base-a: rgba(22, 31, 36, 0.78);
  --default-base-b: rgba(76, 63, 50, 0.5);
}

body.theme-noon {
  --ink: #fff8e8;
  --muted: rgba(255, 248, 232, 0.76);
  --panel: rgba(117, 82, 40, 0.22);
  --accent: #ffea97;
  --accent-two: #4fd0b8;
  --shade-left: rgba(43, 32, 16, 0.36);
  --shade-mid: rgba(92, 65, 24, 0.08);
  --shade-right: rgba(35, 27, 16, 0.5);
  --mobile-shade-top: rgba(50, 36, 18, 0.24);
  --mobile-shade-bottom: rgba(38, 28, 18, 0.64);
  --glow-a: rgba(255, 244, 175, 0.28);
  --glow-b: rgba(79, 208, 184, 0.12);
  --texture-line: rgba(255, 239, 176, 0.05);
  --texture-opacity: 0.58;
  --drift-duration: 17s;
  --drift-x: 20px;
  --drift-y: -7px;
  --default-glow-a: rgba(255, 234, 151, 0.52);
  --default-glow-b: rgba(79, 208, 184, 0.42);
  --default-base-a: rgba(74, 53, 26, 0.72);
  --default-base-b: rgba(25, 58, 55, 0.48);
}

body.theme-afternoon {
  --ink: #fff7df;
  --muted: rgba(255, 247, 223, 0.74);
  --panel: rgba(94, 75, 35, 0.26);
  --accent: #f4c14f;
  --accent-two: #a8d572;
  --shade-left: rgba(37, 31, 18, 0.4);
  --shade-mid: rgba(112, 86, 28, 0.1);
  --shade-right: rgba(45, 35, 20, 0.56);
  --mobile-shade-top: rgba(47, 38, 20, 0.26);
  --mobile-shade-bottom: rgba(37, 30, 19, 0.68);
  --glow-a: rgba(244, 193, 79, 0.26);
  --glow-b: rgba(168, 213, 114, 0.12);
  --texture-line: rgba(255, 226, 143, 0.05);
  --texture-opacity: 0.56;
  --drift-duration: 19s;
  --drift-x: 16px;
  --drift-y: -12px;
  --default-glow-a: rgba(244, 193, 79, 0.5);
  --default-glow-b: rgba(168, 213, 114, 0.38);
  --default-base-a: rgba(65, 55, 30, 0.76);
  --default-base-b: rgba(32, 62, 47, 0.48);
}

body.theme-evening {
  --ink: #fff2ec;
  --muted: rgba(255, 242, 236, 0.74);
  --panel: rgba(75, 39, 55, 0.28);
  --accent: #ff9f70;
  --accent-two: #ffd36d;
  --shade-left: rgba(18, 20, 34, 0.54);
  --shade-mid: rgba(68, 42, 67, 0.18);
  --shade-right: rgba(20, 28, 45, 0.6);
  --mobile-shade-top: rgba(22, 26, 42, 0.36);
  --mobile-shade-bottom: rgba(17, 22, 35, 0.76);
  --glow-a: rgba(255, 159, 112, 0.28);
  --glow-b: rgba(255, 211, 109, 0.16);
  --texture-line: rgba(255, 199, 158, 0.048);
  --texture-opacity: 0.62;
  --drift-duration: 16s;
  --drift-x: 22px;
  --drift-y: -14px;
  --default-glow-a: rgba(255, 159, 112, 0.5);
  --default-glow-b: rgba(255, 211, 109, 0.42);
  --default-base-a: rgba(48, 29, 56, 0.76);
  --default-base-b: rgba(74, 50, 38, 0.52);
}

body.theme-night {
  --ink: #edf7ff;
  --muted: rgba(237, 247, 255, 0.72);
  --panel: rgba(14, 27, 45, 0.36);
  --accent: #9ad7ff;
  --accent-two: #e0d3ff;
  --shade-left: rgba(2, 10, 24, 0.58);
  --shade-mid: rgba(8, 29, 50, 0.2);
  --shade-right: rgba(3, 11, 26, 0.68);
  --mobile-shade-top: rgba(4, 14, 30, 0.42);
  --mobile-shade-bottom: rgba(3, 9, 22, 0.78);
  --glow-a: rgba(154, 215, 255, 0.18);
  --glow-b: rgba(224, 211, 255, 0.14);
  --texture-line: rgba(193, 224, 255, 0.04);
  --texture-opacity: 0.5;
  --drift-duration: 23s;
  --drift-x: 12px;
  --drift-y: -8px;
  --default-glow-a: rgba(154, 215, 255, 0.42);
  --default-glow-b: rgba(224, 211, 255, 0.34);
  --default-base-a: rgba(10, 27, 51, 0.8);
  --default-base-b: rgba(36, 31, 61, 0.54);
}

body.theme-deep-night {
  --ink: #eef5ff;
  --muted: rgba(238, 245, 255, 0.68);
  --panel: rgba(5, 10, 24, 0.48);
  --accent: #86c8ff;
  --accent-two: #bfb6ff;
  --shade-left: rgba(0, 4, 15, 0.68);
  --shade-mid: rgba(3, 8, 22, 0.34);
  --shade-right: rgba(0, 4, 13, 0.78);
  --mobile-shade-top: rgba(2, 7, 18, 0.52);
  --mobile-shade-bottom: rgba(0, 3, 12, 0.84);
  --glow-a: rgba(134, 200, 255, 0.12);
  --glow-b: rgba(191, 182, 255, 0.12);
  --texture-line: rgba(177, 202, 255, 0.032);
  --texture-opacity: 0.42;
  --drift-duration: 29s;
  --drift-x: 8px;
  --drift-y: -6px;
  --default-glow-a: rgba(134, 200, 255, 0.34);
  --default-glow-b: rgba(191, 182, 255, 0.32);
  --default-base-a: rgba(4, 12, 28, 0.86);
  --default-base-b: rgba(19, 16, 38, 0.62);
}

@keyframes cardIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes drift {
  to {
    transform: translate3d(var(--drift-x), var(--drift-y), 0);
  }
}

@media (max-width: 820px) {
  .backdrop {
    background-image:
      linear-gradient(180deg, var(--mobile-shade-top), var(--mobile-shade-bottom)),
      var(--bg-sp);
  }

  .topbar {
    grid-template-columns: 1fr auto auto;
    padding: 14px 16px;
  }

  .icon-button {
    display: inline-grid;
  }

  .login-link {
    padding: 0 13px;
  }

  .shell {
    display: block;
    width: calc(100vw - 28px);
    padding-top: 16px;
  }

  .gallery {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(360px, 72vh);
  }

  .card-copy {
    padding: 20px 20px 104px;
  }

  .card-engagement {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .engagement-row {
    flex-wrap: wrap;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .comment-form button {
    width: 100%;
  }

  .timeline {
    position: fixed;
    inset: 70px 0 0 auto;
    z-index: 30;
    width: min(84vw, 340px);
    max-height: none;
    transform: translateX(110%);
    transition: transform 280ms ease, opacity 280ms ease;
    opacity: 0;
    border-right: 0;
    border-left: 1px solid var(--line);
    background: rgba(18, 18, 18, 0.58);
  }

  .timeline.open {
    transform: translateX(0);
    opacity: 1;
  }
}
