/* ==========================================================================
   modules.css — panels, cards, lists, forms, “curated clutter” components
   (Updated for more “tactile retro” energy without hurting readability.)
   ========================================================================== */

/* ------------------------------
   Panel base
------------------------------ */
.panel {
  border-radius: var(--r-3);
  border: 1px solid var(--border-strong);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  position: relative;
}

.panel::after {
  /* subtle inner sheen */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), transparent 35%),
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.18), transparent 45%);
  mix-blend-mode: soft-light;
}

body.theme-night-lamp .panel::after {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 35%),
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.06), transparent 45%);
}

/* “Window chrome” header */
.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);

  /* Stronger separator so headers read as “bars” */
  border-bottom: 1px dashed var(--border-strong);

  /* More tactile bar: faint diagonal stripe + your original gradient */
  background:
    repeating-linear-gradient(
      135deg,
      rgba(0,0,0,0.028) 0 7px,
      rgba(255,255,255,0.00) 7px 14px
    ),
    linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0.30));

  position: relative;
  z-index: 1;
}

body.theme-night-lamp .panel-h {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.05) 0 7px,
      rgba(255,255,255,0.00) 7px 14px
    ),
    rgba(255,255,255,0.07);
}

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-2);
  letter-spacing: 0.01em;
  font-weight: 700;
}

.panel-b {
  padding: var(--space-5);
  position: relative;
  z-index: 1;
}

/* ------------------------------
   Tiny “stickers” on panels
------------------------------ */
.panel.is-stickered::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 18px;
  width: 44px;
  height: 22px;
  border-radius: 999px;
  transform: rotate(6deg);
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.50));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  z-index: 2;
}

body.theme-night-lamp .panel.is-stickered::before {
  background: rgba(255,255,255,0.10);
}

/* ------------------------------
   Divider
------------------------------ */
.divider {
  border: none;
  border-top: 1px dashed var(--border-strong);
  margin: var(--space-4) 0;
}

/* ------------------------------
   Key/Value list (Status boxes)
------------------------------ */
.kv {
  margin: 0;
}

.kv-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dotted var(--border);
}

.kv-row:last-child {
  border-bottom: none;
}

.kv dt {
  font-size: var(--fs-00);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kv dd {
  margin: 0;
}

/* ------------------------------
   Accent “spines” (more scrapbook energy)
   Uses --page-accent when available (themes.css sets it per page).
------------------------------ */
.note-card,
.callout,
.entry,
.link-list li,
.check {
  border-left-width: 6px;
  border-left-style: solid;

  /* safe fallback if page accent isn't set */
  border-left-color: rgba(0,0,0,0.10);
}

@supports (color: color-mix(in srgb, #000 50%, transparent)) {
  .note-card,
  .callout,
  .entry,
  .link-list li,
  .check {
    border-left-color: color-mix(in srgb, var(--page-accent, var(--accent)) 55%, transparent);
  }
}

body.theme-night-lamp .note-card,
body.theme-night-lamp .callout,
body.theme-night-lamp .entry,
body.theme-night-lamp .link-list li,
body.theme-night-lamp .check {
  border-left-color: rgba(255,255,255,0.14);
}

@supports (color: color-mix(in srgb, #fff 50%, transparent)) {
  body.theme-night-lamp .note-card,
  body.theme-night-lamp .callout,
  body.theme-night-lamp .entry,
  body.theme-night-lamp .link-list li,
  body.theme-night-lamp .check {
    border-left-color: color-mix(in srgb, var(--page-accent, var(--accent)) 45%, transparent);
  }
}

/* ------------------------------
   Callouts / Notes
------------------------------ */
.callout {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--space-4);
  background:
    radial-gradient(circle at 20% 10%, var(--glow), transparent 50%),
    rgba(255,255,255,0.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}

body.theme-night-lamp .callout {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,79,141,0.18), transparent 55%),
    rgba(255,255,255,0.06);
}

.note-card {
  border: 1px solid var(--border);
  border-radius: var(--r-2);

  /* tiny “notepaper” texture (very subtle) */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.36)),
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.02) 0 1px,
      rgba(255,255,255,0.00) 1px 22px
    );

  padding: var(--space-4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

body.theme-night-lamp .note-card {
  background:
    rgba(255,255,255,0.06),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.06) 0 1px,
      rgba(255,255,255,0.00) 1px 22px
    );
}

.note-title {
  font-size: var(--fs-2);
  margin-bottom: var(--space-2);
}

/* ------------------------------
   Grids
------------------------------ */
.grid-2 {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ------------------------------
   Cards
------------------------------ */
.card-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 780px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-3);
  overflow: hidden;
  background: rgba(255,255,255,0.62);
  box-shadow: var(--shadow-1);
  position: relative;

  transition:
    transform var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease);
}

body.theme-night-lamp .card {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.16);
}

.card-link {
  display: grid;
  grid-template-rows: auto 1fr;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
  .card:hover {
    transform: none;
  }
}

.card-media {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.22);
}

.card-body {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.card-title {
  font-weight: 700;
}

.card-sub {
  font-size: var(--fs-00);
}

/* ------------------------------
   Button wall (micro collectibles)
------------------------------ */
.button-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
}

.micro-btn {
  display: block;
  border-radius: var(--r-2);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-1);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.58), rgba(255,255,255,0.30));

  transition:
    transform var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease);
}

body.theme-night-lamp .micro-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.16);
}

/* tiny “sticker tilt” — stable, not random */
.micro-btn:nth-child(odd) { transform: rotate(-0.8deg); }
.micro-btn:nth-child(3n)  { transform: rotate(0.9deg); }
.micro-btn:nth-child(5n)  { transform: rotate(-0.4deg); }

.micro-btn:hover {
  transform: translateY(-2px) rotate(0deg);
  box-shadow: var(--shadow-2);
}

.micro-img {
  border: none;
  border-radius: 0;
}

/* Respect reduced motion: no tilts/lifts */
@media (prefers-reduced-motion: reduce) {
  .micro-btn { transition: none; transform: none !important; }
  .micro-btn:hover { transform: none !important; }
}

/* ------------------------------
   Bullets / lists
------------------------------ */
.bullets {
  margin: 0;
  padding-left: 1.2em;
}

.bullets li + li {
  margin-top: var(--space-2);
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  background: rgba(255,255,255,0.34);
}

body.theme-night-lamp .link-list li {
  background: rgba(255,255,255,0.06);
}

.link-list li + li {
  margin-top: var(--space-3);
}

/* ------------------------------
   Logs (Updates, lists)
------------------------------ */
.log {
  margin: 0;
  padding-left: 1.2em;
}

.log li {
  padding: var(--space-2) 0;
  border-bottom: 1px dotted var(--border);
}

.log li:last-child {
  border-bottom: none;
}

/* ------------------------------
   Avatar row
------------------------------ */
.avatar-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--space-4);
  align-items: center;
  margin: 0;
}

.avatar {
  border-radius: 999px;
}

.avatar img {
  border-radius: 999px;
}

/* ------------------------------
   Quote styling
------------------------------ */
.quote {
  font-size: var(--fs-2);
  font-style: italic;
  margin: 0 0 var(--space-3);
}

/* ------------------------------
   Checklists
------------------------------ */
.checklist {
  display: grid;
  gap: var(--space-2);
}

.check {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border-radius: var(--r-2);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.36);
}

body.theme-night-lamp .check {
  background: rgba(255,255,255,0.06);
}

.check input {
  width: 18px;
  height: 18px;
  margin-top: 0.18rem;
}

/* ------------------------------
   Forms (Guestbook placeholder)
------------------------------ */
.form {
  display: grid;
  gap: var(--space-4);
}

.form-row {
  display: grid;
  gap: var(--space-2);
}

label {
  font-size: var(--fs-00);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-2);
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.70);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}

body.theme-night-lamp input,
body.theme-night-lamp textarea {
  background: rgba(255,255,255,0.08);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

textarea {
  resize: vertical;
}

/* ------------------------------
   Entries (Guestbook)
------------------------------ */
.entry {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--space-4);
  background: rgba(255,255,255,0.34);
}

body.theme-night-lamp .entry {
  background: rgba(255,255,255,0.06);
}

.entry + .entry {
  margin-top: var(--space-4);
}

.entry-title {
  font-size: var(--fs-2);
  margin-bottom: var(--space-2);
}

/* ------------------------------
   Audio
------------------------------ */
.audio {
  width: 100%;
}

/* ------------------------------
   Small tweaks
------------------------------ */
@media (max-width: 520px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .button-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-h {
    padding: var(--space-4);
  }

  .panel-b {
    padding: var(--space-4);
  }
}