/* ===== Tokens (from Figma) ===== */
:root {
  --color-dark: #282d46;
  --color-white: #ffffff;
  --color-divider: #c4c4c4;
  --color-button-hover: #f2f2f7; /* Figma: backgrounds/secondary */

  --font: "Poppins", system-ui, sans-serif;

  --fs-title: clamp(32px, 1.6rem + 1.6vw, 48px);
  --fs-body: clamp(16px, 0.75rem + 0.6vw, 20px);
  --lh-body: 1.481;

  --text-width: 677px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-white);
  color: var(--color-dark);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
h1, p { margin: 0; }

/* ===== Home layout: photo | content ===== */
.home {
  display: grid;
  /* content column never narrower than text (677) + padding (2 × 80) */
  grid-template-columns: minmax(0, 1fr) minmax(837px, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}

.home__photo {
  position: relative;
  min-height: 100%;
}
.home__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home__content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 48px;
  padding: 80px 80px 40px;
}

.home__logo { display: block; }
.home__logo img { width: 277.89px; height: 50px; }

/* ===== Intro ===== */
.intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  max-width: var(--text-width);
}

.intro__title {
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: normal; /* Figma 100% = font's natural line height */
  letter-spacing: -0.03em;
}

.intro__text {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
/* Figma uses an empty line between paragraphs */
.intro__text > p + p { margin-top: calc(var(--lh-body) * 1em); }

.button {
  display: inline-flex;
  padding: 8px 16px;
  border: 1px solid var(--color-dark);
  border-radius: 8px;
  color: var(--color-dark);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.button:hover,
.button:focus-visible {
  background: var(--color-button-hover);
}
.button:focus-visible { outline: 2px solid var(--color-dark); outline-offset: 3px; }

/* ===== Footer / social ===== */
.home__footer {
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid var(--color-divider);
}

.social {
  display: flex;
  align-items: flex-end;
  gap: 32px;
}

.social__link {
  display: block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.social__link:hover { opacity: 0.6; transform: translateY(-2px); }
.social__link:focus-visible { outline: 2px solid var(--color-dark); outline-offset: 4px; border-radius: 2px; }

.social__link--mail img { width: 24px; height: 17.8799px; }
.social__link--in { width: 24px; height: 24px; padding-top: 0.36px; }
.social__link--in img { width: 23.97px; height: 23.31px; }

/* ===== Selected work page (work.html) ===== */
.topbar {
  display: flex;
  justify-content: center;
  padding: 24px 80px;
}
.topbar__logo { display: block; }
.topbar__logo img { width: 178px; height: 32px; }

.work {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px;
  max-width: calc(1166px + 2 * 16px);
  margin: 0 auto;
  padding: 0 16px 40px;
}

.work__intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 768px;
}

.work__title {
  font-size: 32px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: -0.03em;
}

.work__text {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
.work__text > p + p { margin-top: calc(var(--lh-body) * 1em); }

/* Cards */
.cards {
  list-style: none;
  margin: 0;
  padding: 14px 0; /* room for the hover scale (Figma row is 311px for 283px cards) */
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.card {
  --radius: 15.971px;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(241, 241, 241, 0.3);
  border-radius: var(--radius);
  box-shadow: 1.248px 23.797px 52.596px 0 rgba(18, 19, 20, 0.12);
  color: var(--color-dark);
  text-decoration: none;
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(.2,.7,.2,1);
}

/* Figma hover: card grows from 372×283 to 409×311 (≈ ×1.1) */
.card:focus-visible {
  position: relative;
  z-index: 1;
  transform: scale(1.0995);
}
@media (hover: hover) {
  .card:hover {
    position: relative;
    z-index: 1;
    transform: scale(1.0995);
  }
}
.card:focus-visible { outline: 2px solid var(--color-dark); outline-offset: 4px; }

.card__media {
  display: block;
  height: 165.703px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(18, 19, 20, 0.12);
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 7.986px;
  padding: 15.971px;
}

.card__title {
  font-size: 19.964px;
  font-weight: 500;
  line-height: normal;
}

.card__desc {
  font-size: 15.971px;
  font-weight: 400;
  line-height: var(--lh-body);
}

.work__back {
  display: flex;
  justify-content: center;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile — Figma frame "M_Selected work" */
@media (max-width: 820px) {
  .topbar { padding: 40px 24px 0; }
  .topbar__logo img { width: 177.85px; height: 32px; }

  .work {
    align-items: stretch;
    gap: 32px;
    padding: 24px 24px 24px;
  }
  .work__intro { gap: 32px; max-width: none; }
  .work__text { font-size: 16px; }

  .cards {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .card {
    --radius: 16px;
    box-shadow: 1.25px 23.84px 52.69px 0 rgba(18, 19, 20, 0.12);
  }
  .card__media { height: 118px; }
  .card__body { gap: 8px; padding: 16px; }
  .card__title { font-size: 20px; }
  .card__desc { font-size: 16px; }

  .work__back .button { width: 100%; justify-content: center; }
}

/* ===== Entrance animation (enabled by script.js) ===== */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .reveal:nth-child(2) { transition-delay: 0.1s; }
.js .reveal:nth-child(3) { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .home__content { padding: 64px 48px 32px; }
}

/* Mobile — Figma frame "M_Home" */
@media (max-width: 820px) {
  .home {
    display: flex;
    flex-direction: column;
  }

  .home__photo {
    flex-shrink: 0;
    height: 145px;
    min-height: 0;
  }
  .home__photo img { object-position: 50% 59.8%; }

  .home__content {
    flex: 1 0 auto;
    align-items: center;
    gap: 24px; /* minimum; space-between distributes the rest like Figma */
    padding: 40px 24px 24px;
  }

  .home__logo img { width: 177.85px; height: 32px; }

  .intro { width: 100%; max-width: none; }
  .intro__title { font-size: 32px; }
  .intro__text { font-size: 16px; }

  .button {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 20px;
    white-space: normal;
  }

  .social { justify-content: center; }
}
