/* Préférences (langue, thème) : pilule en verre flottante */
.tools {
    position: absolute; top: 14px; right: 14px; z-index: 10;
    display: flex; gap: 2px; padding: 4px;
}

.page {
    width: min(1120px, 100% - 32px);
    min-height: 100svh;
    margin-inline: auto;
    padding: clamp(84px, 12vh, 128px) 0 28px;
    display: flex; flex-direction: column; justify-content: center;
}

/* Nom */
.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 21rem);
    align-items: end;
    gap: 20px 48px;
    margin-bottom: clamp(32px, 5.5vh, 60px);
}
.intro h1 {
    font-size: clamp(3.6rem, 10vw, 8.6rem);
    font-weight: 600;
    letter-spacing: -.058em;
    line-height: .86;
    margin-left: -.04em;
}
.intro h1 span { display: block; }
.intro-side { display: flex; flex-direction: column; gap: 14px; padding-bottom: .35em; }
.lead {
    font-size: 1.16rem;
    line-height: 1.45;
    color: var(--muted);
    max-width: 30ch;
    text-wrap: balance;
}
/* Situation : une LED verte fixe, comme un port actif (pas d'animation ici) */
.status {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: .92rem; font-weight: 500;
}
.status-led {
    flex: none;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

/* Grille bento */
.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(196px, auto);
    grid-auto-flow: dense;
    gap: 14px;
}
.tile-big { grid-column: span 2; grid-row: span 2; }
.tile-wide { grid-column: span 2; }

.tile-inner {
    --on: var(--accent);
    display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
    height: 100%;
    padding: 22px 24px 24px;
    border-radius: 24px;
    background: var(--raised);
    border: 1px solid var(--line);
    transition: background-color .25s ease, transform .25s ease;
}
.tile-big .tile-inner { border-radius: 34px; padding: 30px 34px 34px; }
a.tile-inner:hover { background: var(--sunk); }
a.tile-inner:active { transform: scale(.985); }
a.tile-inner:focus-visible { outline-offset: 4px; border-radius: 26px; }
.tile-big a.tile-inner:focus-visible { border-radius: 36px; }

.is-feature .tile-inner {
    --on: var(--feature-text);
    background: var(--feature-bg);
    color: var(--feature-text);
    border-color: transparent;
}
.is-feature a.tile-inner:hover { background: color-mix(in srgb, var(--feature-bg) 90%, var(--text)); }

/* Port : LED + destination */
.port {
    display: flex; align-items: center; gap: 10px;
    font-size: .86rem; font-weight: 500;
    color: var(--muted);
}
.is-feature .port { color: var(--feature-muted); }
.led {
    flex: none;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--on);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--on) 22%, transparent);
}
.is-locked .led { background: var(--led-off); box-shadow: none; }
.is-locked .tile-inner { cursor: not-allowed; }
.is-locked .tile-title { color: var(--muted); }
.is-feature.is-locked .tile-title { color: var(--feature-muted); }

.tile-text { display: flex; flex-direction: column; gap: 8px; }
.tile-title {
    font-size: 1.62rem;
    font-weight: 600;
    letter-spacing: -.032em;
    line-height: 1.04;
    overflow-wrap: anywhere;
}
.tile-wide .tile-title { font-size: 2.05rem; letter-spacing: -.038em; }
.tile-big .tile-title { font-size: clamp(2.8rem, 5.4vw, 4.6rem); letter-spacing: -.05em; line-height: .95; }
.tile-desc { font-size: .95rem; line-height: 1.42; color: var(--muted); max-width: 36ch; }
.tile-big .tile-desc { font-size: 1.08rem; max-width: 30ch; }
.is-feature .tile-desc { color: var(--feature-muted); }

/* Le moment animé : les ports s'allument un à un, puis clignotent au survol */
@keyframes link-up {
    0%, 30%   { background: var(--led-off); box-shadow: 0 0 0 3px transparent; }
    31%, 42%  { background: var(--on); }
    43%, 54%  { background: var(--led-off); }
    55%, 100% { background: var(--on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--on) 22%, transparent); }
}
@keyframes traffic {
    0%   { background: var(--on); }
    18%  { background: var(--led-off); }
    30%  { background: var(--on); }
    52%  { background: var(--led-off); }
    62%  { background: var(--on); }
    80%  { background: var(--led-off); }
    88%  { background: var(--on); }
}
.tile:not(.is-locked) .led {
    animation: link-up 1.1s step-end both;
    animation-delay: calc(350ms + var(--i, 0) * 170ms);
}
.tile:not(.is-locked) a.tile-inner:hover .led,
.tile:not(.is-locked) a.tile-inner:focus-visible .led {
    animation: traffic .95s step-end infinite;
}

.empty { color: var(--muted); font-size: 1.05rem; }

.foot {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
    margin-top: 36px;
    font-size: .88rem;
    color: var(--muted);
}
.foot a { text-underline-offset: 3px; }
.foot a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 860px) {
    .intro { grid-template-columns: 1fr; }
    .intro-side { padding-bottom: 0; gap: 12px; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(160px, auto); gap: 12px; }
    .tile-inner { padding: 18px 18px 20px; border-radius: 22px; gap: 22px; }
    .tile-big .tile-inner { padding: 24px 24px 26px; border-radius: 28px; }
    .tile-big { grid-row: span 1; }
    .tile-big .tile-inner { min-height: 250px; }
    .tile-title { font-size: 1.36rem; }
    .tile-wide .tile-title { font-size: 1.7rem; }
    .tile-big .tile-title { font-size: clamp(2.5rem, 12vw, 3.6rem); }
    .tile-desc { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tile .led, .tile a.tile-inner:hover .led { animation: none !important; }
    .tile-inner { transition: none; }
}
