@layer reset, gov2, utilities, app;

@layer app {
  body { background: #fff; color: #111; }
  main { padding-block: clamp(1.5rem, 5vw, 3.5rem) 4rem; }

  .lead {
    display: flex;
    align-items: center;
    gap: clamp(.75rem, 2vw, 1.5rem);
    margin: 0 0 clamp(1.5rem, 4vw, 3rem);
  }
  /* The PNG is square with wide empty bands above and below the drawing; crop them. */
  .logo { flex: none; width: clamp(6rem, 15vw, 10.5rem); height: auto; aspect-ratio: 8 / 5; object-fit: cover; }
  .lead h1 {
    margin: 0;
    max-width: 16ch;
    font-size: clamp(1.4rem, 3.2vw, 2.4rem);
    line-height: 1;
    letter-spacing: -.03em;
    text-wrap: balance;
  }
  .lead h1 small {opacity: .8; color: #339;}

  /* Rotating footer title, motion copied from index-gov2.ro. */
  .rot {
    display: grid;
    overflow: hidden;
    perspective: 400px;
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.045em;
  }
  .rot > span {
    grid-area: 1 / 1;
    justify-self: start;
    transition: transform .36s cubic-bezier(.5,0,.2,1), opacity .36s, filter .36s, clip-path .42s cubic-bezier(.6,0,.2,1), letter-spacing .42s;
    clip-path: inset(0 0 0 0);
  }
  .rot > span.in { transition: none; }
  .rot > .out, .rot > .in { opacity: 0; }
  [data-fx="rise"] > .out { transform: translateY(-60%) skewX(-8deg); filter: blur(3px); }
  [data-fx="rise"] > .in { transform: translateY(60%) skewX(8deg); filter: blur(3px); }
  [data-fx="drop"] > .out { transform: translateY(70%); }
  [data-fx="drop"] > .in { transform: translateY(-70%); }
  [data-fx="flip"] > .out { transform: rotateX(90deg); }
  [data-fx="flip"] > .in { transform: rotateX(-90deg); }
  [data-fx="wipe"] > .out { clip-path: inset(0 0 0 100%); opacity: 1; }
  [data-fx="wipe"] > .in { clip-path: inset(0 100% 0 0); opacity: 1; }
  [data-fx="zoom"] > .out { transform: scale(1.35); filter: blur(5px); }
  [data-fx="zoom"] > .in { transform: scale(.6); }
  [data-fx="slide"] > .out { transform: translateX(-40%); filter: blur(2px); }
  [data-fx="slide"] > .in { transform: translateX(40%); filter: blur(2px); }
  [data-fx="spread"] > .out { letter-spacing: .4em; filter: blur(4px); }
  [data-fx="spread"] > .in { letter-spacing: -.25em; }

  .projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .project { position: relative; display: flex; min-width: 0; flex-direction: column; }
  /* The title link covers the whole card. */
  .body h2 a::after { content: ""; position: absolute; inset: 0; }
  .shot { display: block; overflow: hidden; aspect-ratio: 2 / 1; background: #f2f2f2; }
  .shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .3s; }
  .project:hover .shot img { transform: scale(1.02); }
  .body { display: flex; flex: 1; flex-direction: column; gap: .5rem; padding: 1.1rem 0 0; }
  .body h2, .body p { margin: 0; }
  .body h2 { font-size: 1.4rem; line-height: 1.25; letter-spacing: -.015em; }
  .body h2 a { color: #111; }
  .body p { color: #444; font-size: 1.08rem; line-height: 1.5; }
  .body .project-url { margin-top: .1rem; color: #666; font-size: .88rem; line-height: 1.35; overflow-wrap: anywhere; }

  .g2-footer { background: #111; border: 0; color: #fff; padding-block: 0; }
  .g2-footer a { color: #fff; }
  .g2-footer-in { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 1.25rem; padding-block: 1.75rem 1.5rem; }
  .footer-logo { display: block; width: clamp(6rem, 12vw, 8rem); height: auto; align-self: flex-start; margin: .75em 0; }
  .contact { display: flex; align-items: center; gap: 1.25rem; font-size: 1.05rem; }
  /* 8-bit anthem player, reused from the old gov2.ro. */
  .anthem { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; margin-left: auto; }
  .anthem .controls { display: flex; gap: .25rem; }
  .anthem button { width: 2rem; height: 2rem; padding: 0; border: 1px solid #444; border-radius: 4px; background: none; color: #fff; font: inherit; line-height: 1; cursor: pointer; }
  .anthem button:hover { border-color: #aaa; }
  .anthem .play[aria-pressed="true"] { border-color: #fcd116; color: #fcd116; }
  .social-links { display: inline-flex; align-items: center; gap: .75rem; }
  .social-links a { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; }
  .social-links a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
  .social-links svg { display: block; width: 100%; height: 100%; fill: currentColor; }

  @media (max-width: 850px) {
    .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 560px) {
    main { padding-top: 1.25rem; }
    .rot { font-size: clamp(1.35rem, 6.6vw, 2rem); }
    .rot { min-height: 2.2em; }
    .contact { flex-wrap: wrap; }
    .anthem { flex-basis: 100%; margin-left: 0; }
    .projects { grid-template-columns: 1fr; gap: 1.75rem; }
    .project { flex-direction: row; align-items: flex-start; gap: 1rem; }
    .shot { flex: none; width: 5.5rem; aspect-ratio: 1; }
    .body { padding: 0; gap: .3rem; }
    .body h2 { font-size: 1.2rem; }
    .body p { font-size: 1rem; line-height: 1.45; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
  }
}
