/* Core tokens and shared components: portrait plates, ruled captions, buttons, forms. */

:root {
  --ink: #22304a;
  --ink-2: #46526b;
  --ink-3: #6a7489;
  --ground: #f6eff0;
  --ground-2: #efe5e7;
  --paper: #fffbfa;
  --rule: rgba(34, 48, 74, 0.22);
  --rule-strong: rgba(34, 48, 74, 0.55);
  --rail: #22304a;
  --rail-ink: #f6eff0;
  --rail-ink-2: #c3c9d6;
  --ajonc: #e9b43c;
  --ajonc-deep: #c08a12;
  --bruyere: #d98fae;
  --bruyere-deep: #8e3e63;
  --fougere: #5f7f45;
  --fougere-deep: #3f5a2c;
  --ecume: #9ccbc2;
  --ciel: #8fb3de;
  --goemon: #c4472c;
  --goemon-soft: #f6d6cc;
  --success: #3f6a33;
  --whisker: rgba(23, 21, 28, 0.35);
  --grey: #ddd8d1;
  --blush: rgba(232, 121, 138, 0.38);
  --inner: #e9a2a8;
  --collar: #c4472c;

  --font-display: 'Noto Serif Display Condensed', 'Didot', 'Bodoni 72', serif;
  --font-label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', 'Segoe UI', system-ui, sans-serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0: clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 0.9vw, 2.15rem);
  --step-3: clamp(2.1rem, 1.7rem + 1.8vw, 3.2rem);
  --step-4: clamp(2.8rem, 2rem + 3.6vw, 5rem);
  --step-5: clamp(3.6rem, 2.2rem + 6.4vw, 7.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 7rem;

  --radius: 3px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --shadow-lift: 0 18px 32px -18px rgba(34, 48, 74, 0.45);

  color-scheme: light;
  accent-color: var(--ink);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--ink-3) var(--ground-2);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: 'kern', 'liga';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ajonc);
  color: var(--ink);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--ajonc);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 400;
  line-height: 1.05;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--ajonc);
  color: var(--ink);
  font-family: var(--font-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: top 0.2s var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Type roles */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 0.92;
}

.label {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 42ch;
}

.prose {
  max-width: 68ch;
}

.prose > * + * {
  margin-top: 1em;
}

.prose ul {
  padding-left: 1.2em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose li::marker {
  color: var(--goemon);
}

.prose strong {
  font-weight: 600;
}

/* Ornament: hairline rules with a small diamond */

.ornament {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--fougere);
  max-width: 26rem;
}

.ornament::before,
.ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.ornament__diamond {
  width: 9px;
  height: 9px;
  background: currentColor;
  transform: rotate(45deg);
  flex: none;
}

/* Arrow links and buttons */

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding-bottom: 0.2em;
  border-bottom: 1.5px solid currentColor;
  font-family: var(--font-label);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.arrow-link svg,
.btn svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  transition: transform 0.35s var(--ease-out);
}

.arrow-link:hover svg,
.btn:hover svg {
  transform: translateX(4px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  min-height: 3.1rem;
  padding: 0.7rem 1.5rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ground);
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease-soft), color 0.25s var(--ease-soft), box-shadow 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

.btn:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}

.btn--ghost:hover {
  background: var(--paper);
}

.btn--sun {
  background: var(--ajonc);
  border-color: var(--ajonc);
  color: var(--ink);
}

.btn--danger {
  background: transparent;
  border-color: var(--goemon);
  color: var(--goemon);
}

.btn--danger:hover {
  background: var(--goemon);
  color: #fff;
}

.btn--small {
  min-height: 2.4rem;
  padding: 0.4rem 0.95rem;
  font-size: 0.88rem;
}

.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.45;
  pointer-events: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

/* Portrait plate */

.plate {
  --backdrop: var(--ajonc);
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.plate__frame {
  position: relative;
  padding: 7px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
}

.plate__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  outline: 1px solid var(--rule-strong);
  outline-offset: -1px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(ellipse 40% 30% at 18% 20%, rgba(34, 48, 74, 0.06), transparent 70%),
    linear-gradient(to bottom, transparent 79%, rgba(34, 48, 74, 0.09) 79%, rgba(34, 48, 74, 0.15)),
    var(--backdrop);
  transition: background-color 0.9s var(--ease-soft);
}

.plate__stage::after {
  /* painted-wall grain */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.13 0 0 0 0 0.19 0 0 0 0 0.29 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.plate__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out);
}

.plate__figure {
  position: absolute;
  left: 50%;
  bottom: 8%;
  height: 76%;
  aspect-ratio: 200 / 240;
  max-width: 92%;
  translate: -50% 0;
  transition: transform 0.6s var(--ease-out);
}

.plate__figure .fig {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.plate__stamp {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  padding: 0.3rem 0.6rem;
  border: 1px solid currentColor;
  outline: 1px solid currentColor;
  outline-offset: 2px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.1;
}

.plate__stamp--sos {
  color: var(--goemon);
}

.plate__stamp--adopte {
  color: var(--success);
}

.plate__note {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(34, 48, 74, 0.72);
}

.plate__caption {
  display: grid;
  grid-template-columns: repeat(var(--cells, 5), minmax(0, 1fr));
  margin-top: 7px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
}

.plate__cell {
  padding: 0.55rem 0.3rem 0.5rem;
  text-align: center;
  border-left: 1px solid var(--rule);
  min-width: 0;
}

.plate__cell:first-child {
  border-left: 0;
}

.plate__cell dt {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.plate__cell dd {
  margin: 0.1rem 0 0;
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.plate__cell dd[data-value='Non'] {
  color: var(--goemon);
}

.plate--mini .plate__frame {
  padding: 5px;
}

.plate--mini .plate__note {
  display: none;
}

.plate--mini .plate__stamp {
  top: 8px;
  left: 8px;
  font-size: 0.66rem;
  padding: 0.15rem 0.4rem;
}

/* Heart ("coup de coeur"): a hairline-framed control; pressing it prints a stamp on the plate. */

.heart {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--rule-strong);
  outline: 1px solid var(--rule-strong);
  outline-offset: 2px;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), background-color 0.3s, color 0.3s;
}

.heart svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
  transition: fill 0.25s;
}

.heart:hover {
  transform: translateY(-1px);
}

.heart:focus-visible {
  outline: 3px solid var(--ajonc);
}

.heart[aria-pressed='true'] {
  color: var(--goemon);
}

.heart[aria-pressed='true'] svg {
  fill: currentColor;
}

.heart.is-popping svg {
  animation: heart-pop 0.5s var(--ease-out);
}

@keyframes heart-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.plate__stamp--love {
  top: auto;
  bottom: 14px;
  color: var(--goemon);
  transform: rotate(-4deg);
  opacity: 0;
  visibility: hidden;
}

.plate.is-loved .plate__stamp--love {
  opacity: 1;
  visibility: visible;
  animation: stamp-in 0.45s var(--ease-out);
}

@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-4deg) scale(1.6); }
  60% { opacity: 1; transform: rotate(-4deg) scale(0.94); }
  100% { transform: rotate(-4deg) scale(1); }
}

/* Illustration life */

.fig-shadow {
  fill: rgba(34, 48, 74, 0.16);
}

.fig .fig-head {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  transition: transform 0.6s var(--ease-out);
}

.fig .fig-eyes {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: blink 5.5s infinite;
  animation-delay: var(--blink-delay, 0s);
}

.fig--cat .fig-tail {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: tail-sway 3.8s ease-in-out infinite;
}

.fig--dog .fig-tail {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: tail-wag 0.55s ease-in-out infinite alternate;
}

.fig .fig-ear-r {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: ear-twitch 7s ease-in-out infinite;
  animation-delay: var(--blink-delay, 0s);
}

.fig--goat .fig-beard {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  animation: beard 4s ease-in-out infinite;
}

.plate:hover .fig-head,
.plate:focus-within .fig-head {
  transform: rotate(-7deg);
}

.plate:hover .plate__figure {
  transform: translateY(-4px);
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

@keyframes tail-sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-12deg); }
}

@keyframes tail-wag {
  from { transform: rotate(-10deg); }
  to { transform: rotate(14deg); }
}

@keyframes ear-twitch {
  0%, 86%, 100% { transform: rotate(0deg); }
  89% { transform: rotate(9deg); }
  92% { transform: rotate(-3deg); }
}

@keyframes beard {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(4deg); }
}

/* Forms */

.field {
  display: grid;
  gap: 0.35rem;
}

.field > label,
.field > .field__label,
fieldset > legend {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.field__hint {
  font-size: 0.9rem;
  color: var(--ink-2);
}

.field__error {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--goemon);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.55;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-3);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(233, 180, 60, 0.55);
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--goemon);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  line-height: 1.4;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.12rem 0 0;
  flex: none;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--rule-strong);
  outline: 1px solid var(--rule);
  outline-offset: 3px;
  background: var(--paper);
}

.notice--success {
  border-color: var(--success);
  color: var(--success);
}

.notice--error {
  border-color: var(--goemon);
  color: var(--goemon);
}

.notice svg {
  width: 1.3rem;
  height: 1.3rem;
  flex: none;
  margin-top: 0.15rem;
}

/* Scroll reveal: content is visible by default; JS opts elements in. */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}
