/* ============================================================
   polish.css — readability, signifiers, feedback, progressive disclosure.
   Loaded last. Grounded in Norman's design-psychology trilogy:

   1) The Design of Everyday Things
      discoverability · affordances · signifiers · mapping · feedback
   2) Living with Complexity
      progressive disclosure · clear hierarchy · complexity without confusion
   3) Emotional Design
      visceral polish · behavioral feedback · reflective story

   This layer is intentionally additive: removing the <link> restores the
   previous design without touching content or behaviour.
   ============================================================ */

/* ---------- 1. Legibility: lift only the text that is below comfortable reading size.
   Measured at 1600px: body 16px, project copy 12px, eval hint 11px, bench 11px.
   Do not shrink the already-comfortable 14–16px copy. ---------- */

.project-outcome span { font-size: 11px; }
.work-note { font-size: 11.5px; }
.bench-bottom { font-size: 12px; line-height: 1.8; }
.module-note { font-size: 12px; line-height: 1.8; }
.eval-input-hint { font-size: 12.5px; line-height: 1.8; }
.eval-method p { font-size: 13px; line-height: 1.95; }
.appearance-description { font-size: 13px; line-height: 1.7; }

.terminal-body { font-size: 14.5px; }
.terminal-output { font-size: 14.5px; min-height: 200px; }
.terminal-shortcuts button { font-size: 12.5px; }
.terminal-hint {
  font-size: 12px;
  color: #8fa87a;
  margin: 2px 0 14px;
  line-height: 1.7;
}

/* ---------- 2. Affordances, signifiers and tactile feedback ---------- */

.text-link,
.module-secondary,
.project-read { text-underline-offset: 4px; }
.text-link:hover,
.module-secondary:hover { text-decoration: underline; }

button:active { transform: translateY(1px); }
.module-action,
.button { will-change: transform; }

:where(a, button, [tabindex], input, textarea, summary):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 3px;
}

/* Project cards read as openable, and the hover gives a directional cue. */
.project-card { position: relative; }
.project-open { position: relative; }
.project-card .project-open::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 6px;
  background: linear-gradient(
    115deg,
    transparent 30%,
    color-mix(in srgb, var(--green) 10%, transparent) 48%,
    transparent 62%
  );
  opacity: 0;
  transform: translateX(-12%);
  transition: opacity .35s, transform .45s;
}
.project-card:hover .project-open::after { opacity: 1; transform: translateX(0); }
.project-card:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}
.project-card .project-art .art-topline { transition: opacity .25s; }
.project-card:hover .project-art .art-topline { opacity: 1; }

/* ---------- 3. Curiosity strip: one consistent device-window language ---------- */

.curiosity-grid { gap: 18px; }
.curiosity-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  isolation: isolate;
}
.curiosity-art {
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  background:
    radial-gradient(120% 100% at 30% 0%, rgba(255, 255, 255, .07), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .18));
  border: 1px solid rgba(255, 255, 255, .08);
}
.curiosity-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 14, 20, .55));
  mix-blend-mode: multiply;
}
.curiosity-art img {
  filter: saturate(.92) contrast(.96);
  transition: transform .5s cubic-bezier(.2, .9, .2, 1), filter .4s;
}
.curiosity-item:hover .curiosity-art img { transform: scale(1.04); filter: saturate(1) contrast(1); }
.curiosity-game img { filter: saturate(.8) contrast(.92) brightness(.92); }
.curiosity-item:hover { border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.curiosity-item b { transition: transform .25s; }
.curiosity-item:hover b { transform: translate(2px, -2px); }

/* ---------- 4. Progressive disclosure: summaries look and behave like controls ---------- */

details > summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 24px;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 0;
  color: var(--green);
  font-weight: 600;
  transition: transform .25s;
}
details[open] > summary::after { content: '−'; }
.maker-story summary:hover,
.eval-method summary:hover { color: var(--green); }

/* ---------- 5. Emotional design: a calmer, more deliberate hero entrance ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: hero-in .9s cubic-bezier(.2, .9, .2, 1) both; }
  .quality-lab { animation: hero-in .9s .1s cubic-bezier(.2, .9, .2, 1) both; }
}

/* ---------- 6. Appearance previews: miniature scenes instead of skeletons ---------- */

.appearance-preview { position: relative; overflow: hidden; }
.appearance-preview::before {
  content: '';
  position: absolute;
  right: 9%;
  top: 18%;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .72;
}
.preview-dream::before {
  background: radial-gradient(circle at 34% 30%, #f6e2bd, #c9b48e 46%, #4a3f31 72%, #1a1c22 100%);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .04), 0 0 0 16px rgba(255, 255, 255, .025);
}
.preview-workstation::before {
  background: radial-gradient(circle at 36% 30%, #d9f7c6, #7ea76b 40%, #244632 70%, #0e1a14 100%);
  box-shadow: 0 0 0 7px rgba(206, 250, 128, .12);
}
.preview-archive::before {
  background: linear-gradient(145deg, #f7f3e7, #dfe8f2 55%, #b9cadd);
  border-radius: 6px;
  transform: rotate(-6deg);
  box-shadow: 8px 10px 0 rgba(90, 110, 140, .12);
}
.preview-desk::before {
  background: linear-gradient(145deg, #f6c79a, #e08a55 60%, #a94f2c);
  border-radius: 14px;
  transform: rotate(-4deg);
  box-shadow: 6px 8px 0 rgba(120, 70, 40, .15);
}
.appearance-preview::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .12));
}

/* ---------- 7. About: give the shorter column a deliberate rhythm ---------- */

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: 420px;
}
.about-stats > span { display: flex; flex-direction: column; gap: 3px; }
.about-stats b { font-size: 22px; font-weight: 600; letter-spacing: -.5px; }
.about-stats small { font-size: 10.5px; color: var(--muted); letter-spacing: .2px; line-height: 1.5; }

/* ---------- 8. Terminal: a working surface, not a mostly empty box ---------- */

#terminal-dialog { width: min(860px, calc(100% - 32px)); }
#terminal-dialog .terminal-body {
  display: flex;
  flex-direction: column;
  min-height: min(62vh, 560px);
}
#terminal-dialog .terminal-output { flex: 1; max-height: none; min-height: 220px; }
.terminal-boot { color: #88a56f; font-size: 12.5px; letter-spacing: .3px; }
.terminal-tip { color: #a8c28c; }
#terminal-dialog .terminal-form { margin-top: auto; }

/* ---------- 9. Mobile: less header competition, same touch targets ---------- */

@media (max-width: 700px) {
  .site-header { width: calc(100% - 36px); }
  .header-actions { gap: 8px; }
  .header-contact { display: none; }
  .appearance-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .appearance-toggle span { display: none; }
  .appearance-toggle svg { display: block; }
  .monogram { font-size: 34px; }
  .wordmark { gap: 10px; }
  .wordmark-name { font-size: 12px; padding-left: 12px; }
  .about-stats { max-width: none; }
  .curiosity-grid { gap: 12px; }
}

/* ---------- 10. Pet: 27-row extended sheet, sleep state, care actions ---------- */

.pet-sprite { --pet-step: -9.09090909%; }
.pet-sprite[data-rows="27"] { --pet-step: -3.7037037%; }
.pet-sprite img {
  height: 1100%;
  transform: translate(calc(var(--col) * -12.5%), calc(var(--row) * var(--pet-step)));
}
.pet-sprite[data-rows="27"] img { height: 2700%; }

.pet-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pet-actions button {
  font: 11px var(--font);
  color: #cfe3b8;
  border: 1px solid #8aa26a66;
  padding: 7px 10px;
  border-radius: 4px;
  min-height: 34px;
  transition: border-color .2s, background .2s;
}
.pet-actions button:hover { border-color: #cefa80; background: #cefa800d; }
.pet-actions #pet-affection {
  margin-left: auto;
  font: 10px var(--mono);
  color: #91aa79;
  letter-spacing: .5px;
}

#module-pet.pet-asleep .pet-sprite img { filter: saturate(.5) brightness(.78); }
#module-pet.pet-asleep .pet-speech { color: #a9b99e; border-color: #6f8a5e66; }
#module-pet.pet-asleep .pet-platform { opacity: .55; }

@media (prefers-reduced-motion: reduce) {
  .project-card .project-open::after,
  .curiosity-art img,
  .curiosity-item b,
  .pet-sprite img { transition: none; }
}
