:root{
  --blob-shape: polygon(
    50% 0%,
    58% 1%,
    66% 3%,
    73% 6%,
    80% 10%,
    86% 15%,
    90% 21%,
    94% 28%,
    97% 36%,
    99% 44%,
    100% 52%,
    99% 60%,
    97% 68%,
    94% 75%,
    90% 82%,
    84% 88%,
    77% 93%,
    69% 96%,
    60% 99%,
    50% 100%,
    40% 99%,
    31% 96%,
    23% 93%,
    16% 88%,
    10% 82%,
    6% 75%,
    3% 68%,
    1% 60%,
    0% 52%,
    1% 44%,
    3% 36%,
    6% 28%,
    10% 21%,
    14% 15%,
    20% 10%,
    27% 6%,
    34% 3%,
    42% 1%
  );
}

html, body{
  background: var(--color-primary);
}

.section1{
  padding: clamp(40px, 9vh, 96px) 5vw 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: repeat(3, auto);
  align-items: center;
  column-gap: clamp(20px, 6vw, 80px);
  row-gap: clamp(12px, 2.4vh, 20px);
  text-align: left;
  background: var(--color-primary);
  background-image: none;
  width: 100%;
  margin: 0;
  position: relative;
  isolation: isolate;
}
.section1 > :not(.eyes){
  grid-column: 1;
}
.section1 .eyes{
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  justify-self: end;
}

.title1{
  display: block;
  text-align: left;
  font-size: clamp(40px, 6.4vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 920px;
  margin: 0;
  color: var(--color-secondary);
  animation: home-slide-up .65s ease both;
}
.title1 strong{
  font-family: "Display Bold", "Display Book", "Display Light", "Intro Rust", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  font-weight: 700;
}
.subtitle{
  margin: 0;
  color: rgb(227, 227, 227);
  display: block;
  text-align: left;
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1.6;
  max-width: 720px;
  animation: home-slide-up .65s ease both;
  animation-delay: .08s;
}

@keyframes home-slide-up{
  from{
    opacity: 0;
    transform: translateY(18px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce){
  .title1,
  .subtitle{
    animation: none;
  }
}

.home-search{
  width: min(500px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: clamp(8px, 2.5vh, 20px);
}
.home-search__input{
  flex: 1 1 380px;
  min-width: 220px;
  width: 100%;
  padding: 16px 22px;
  border-radius: 999px;
  border: 1px solid var(--color-primary);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: clamp(16px, 2vw, 18px);
}
.home-search__input:focus{
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.home-search__button{
  flex: 0 0 auto;
  width: clamp(46px, 6vw, 56px);
  height: clamp(46px, 6vw, 56px);
  border-radius: 999px;
  border: 0;
  background: #d9d9d9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .2s ease;
}
.home-search__button:hover{
  background: #cfcfcf;
}
.home-search__button svg{
  display: block;
}

.eyes{
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin-left: 0;
}

.eye{
  position: relative;
  width: clamp(170px, 22vw, 230px);
  height: clamp(170px, 22vw, 230px);
  background: var(--color-secondary);
  border-radius: 50%;
  clip-path: var(--blob-shape);
  overflow: hidden;
}

.pupil{
  --x: 0px;
  --y: 0px;
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(95px, 12vw, 130px);
  height: clamp(95px, 12vw, 130px);
  background: var(--color-text);
  border-radius: 50%;
  clip-path: var(--blob-shape);
  transform: translate3d(-50%, -50%, 0) translate3d(var(--x), var(--y), 0);
  transition: none;
  will-change: transform;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* Safari/WebKit fallback: clip-path on a moving element can stutter; degrade pupil shape for smoothness */
@supports (-webkit-touch-callout: none) {
  .pupil{
    clip-path: none;
    border-radius: 50%;
  }
}

.section1 .eyes{
  transform: translateX(clamp(-48px, -3vw, -20px));
}

@media (max-width: 900px){
  .section1{
    grid-template-columns: 1fr;
  }
  .section1 > :not(.eyes){
    grid-column: auto;
  }
  .section1 .eyes{
    grid-column: auto;
    grid-row: auto;
    justify-self: center;
    margin-top: clamp(12px, 4vh, 28px);
    transform: none;
  }
  .eye{
    width: clamp(150px, 32vw, 200px);
    height: clamp(150px, 32vw, 200px);
  }
  .pupil{
    width: clamp(88px, 18vw, 115px);
    height: clamp(88px, 18vw, 115px);
  }
}

@media (max-width: 640px){
  .home-search{
    position: relative;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .home-search__input{
    padding-right: 56px;
  }
  .home-search__button{
    position: absolute;
    top: 50%;
    right: 12px;
    width: 36px;
    height: 36px;
    background: transparent;
    transform: translateY(-50%);
  }
  .eyes{
    justify-content: center;
  }
}

.section2{
  background: var(--color-secondary);
  padding: clamp(32px, 6vw, 64px) 0 clamp(48px, 8vw, 96px);
}
.section2__inner{
  width: min(1200px, 92%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.6vw, 24px);
}
.section2__controls{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
.section2__controls-left{
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}
.section2__select-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--color-text);
  transition: color .2s ease;
}
.section2__select-wrap:hover{
  color: var(--color-btn);
}
.section2__select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border-radius: 999px;
  padding: 8px 36px 8px 16px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  font: inherit;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.section2__select:hover{
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-btn);
}
.section2__select-wrap::after{
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
  mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
  pointer-events: none;
}
.section2__tabs{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.section2__tabs::-webkit-scrollbar{ display: none; }
.section2__tab{
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 85%, #fff);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.section2__tab.is-active{
  background: color-mix(in srgb, var(--color-btn) 15%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-text);
}
.section2__tab:hover{
  background: color-mix(in srgb, var(--color-btn) 10%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 35%, transparent);
}
.section2__filter{
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.section2__filter:hover{
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-btn);
}
.section2__filter .filter-icon{
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/filter.svg") center / contain no-repeat;
  mask: url("/assets/icons/filter.svg") center / contain no-repeat;
}

.section2__filter-panel{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 0;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--color-text) 12%, transparent);
  border-width: 0;
  background: #fff;
  box-shadow: var(--shadow-sm);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: max-height .25s ease, opacity .2s ease, transform .25s ease, padding .25s ease, border-width .25s ease;
}
.section2__filter-panel.is-open{
  padding: 14px;
  border-width: 1px;
  max-height: 360px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.section2__filter-panel[hidden]{
  display: none;
}
@media (prefers-reduced-motion: reduce){
  .section2__filter-panel{
    transition: none;
    transform: none;
  }
}
.filter-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--color-text);
}
.filter-label{
  font-weight: 700;
}
.filter-field input,
.filter-field select{
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}
.filter-field input:focus,
.filter-field select:focus{
  outline: 2px solid color-mix(in srgb, var(--color-btn) 55%, #fff);
  outline-offset: 2px;
}
.filter-reset{
  align-self: end;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #f7f7f7;
  color: var(--color-text);
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.filter-reset:hover{
  background: color-mix(in srgb, var(--color-btn) 12%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 35%, transparent);
}

.home-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: clamp(16px, 2.4vw, 22px);
}
.home-grid__loading{
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--color-text) 20%, transparent);
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
  font-weight: 700;
}
.home-grid__empty{
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--color-text) 20%, transparent);
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
}
.section2__show-more{
  align-self: center;
}
.section2__show-more-icon{
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
  mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
}
.section2__show-more[hidden]{
  display: none;
}
.home-card__media{
  aspect-ratio: 4 / 3;
}
.section2 .post-card__media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-card__art{
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.home-card__art--1{
  background: linear-gradient(120deg, #4c7a2e, #b8d86c);
}
.home-card__art--2{
  background: linear-gradient(135deg, #073c3f, #0e6b63 60%, #d3e74a);
}
.home-card__art--3{
  background: linear-gradient(135deg, #e9e9e9, #c7d4e2);
}
.home-card__art--4{
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.15), transparent 45%),
    linear-gradient(135deg, #1a1f26, #3a2d25 60%, #0b0f13);
}
.home-card__art--5{
  background: radial-gradient(circle at 45% 35%, #f5a3c4, #f7d6e6 45%, #f2f2f2 100%);
}
.home-card__art--6{
  background: linear-gradient(135deg, #1b1e22, #2b2d30 55%, #0f1012);
}
.home-card__art--7{
  background: linear-gradient(135deg, #f7f8fb, #e3e9f2 60%, #cfd9e6);
}
.home-card__art--8{
  background: linear-gradient(135deg, #2f2a24, #7b4d2e 55%, #e6c07a);
}

@media (max-width: 820px){
  .section2__controls{
    align-items: center;
  }
  .section2__filter{
    width: auto;
    justify-content: center;
  }
}
