:root {
  --stylo-green: var(--navy, #00345a);
  --stylo-green-dark: var(--navy, #00345a);
  --stylo-orange: var(--orange, #ff7515);
  --stylo-orange-dark: #e05f00;
  --stylo-cream: #f7fafc;
  --stylo-paper: #ffffff;
  --stylo-muted: var(--text-gray, #464646);
  --stylo-line: rgba(0, 52, 90, 0.14);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--stylo-paper); }

.stylo-portfolio {
  min-height: 100vh;
  padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 10vw, 10rem);
  color: var(--stylo-green-dark);
  background: var(--stylo-paper);
  font-family: var(--font, 'Poppins', sans-serif);
}

.stylo-portfolio *,
.stylo-modal * { box-sizing: border-box; }

.stylo-heading {
  max-width: 1200px;
  margin: 0 auto 1.75rem;
}

.stylo-heading h1,
.stylo-modal h2 {
  margin: 0;
  color: var(--stylo-green);
  font-family: var(--font, 'Poppins', sans-serif);
  font-weight: 600;
  letter-spacing: -.02em;
}

.stylo-heading h1 { font-size: 28px; line-height: 1.3; margin: 0 0 8px; }
.stylo-heading > p { max-width: 720px; margin: 0; color: var(--stylo-muted); font-size: 14px; line-height: 1.6; }
.stylo-eyebrow { margin: 0 0 6px; color: var(--stylo-orange-dark); font-size: .74rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }

.stylo-categories {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .85rem;
  max-width: 1200px;
  margin: 0 auto 1.75rem;
}
.stylo-category-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 3px solid transparent;
  border-radius: 1rem;
  padding: 0;
  cursor: pointer;
  background: var(--stylo-cream);
  outline: 0;
  opacity: 1;
  filter: none;
  transition: opacity .6s cubic-bezier(.22, 1, .36, 1), filter .6s cubic-bezier(.22, 1, .36, 1), border-color .6s cubic-bezier(.22, 1, .36, 1), transform .6s cubic-bezier(.22, 1, .36, 1);
}
.stylo-category-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(7, 29, 27, .82)); pointer-events: none; }
.stylo-category-tile img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .5s ease; }
.stylo-category-tile:hover img { transform: scale(1.06); }
.stylo-category-tile.is-active { border-color: var(--stylo-orange); transform: translateY(-3px); }
.stylo-category-tile.is-active span { color: #ffd7ba; }
.stylo-category-tile.is-dimmed { opacity: .55; filter: grayscale(.45); }
.stylo-category-tile.is-dimmed:hover { opacity: .8; }
.stylo-category-tile span {
  position: absolute;
  z-index: 2;
  left: .8rem;
  right: .8rem;
  bottom: .7rem;
  color: white;
  font: 700 .82rem/1.2 var(--font, 'Poppins', sans-serif);
  text-align: left;
}
.stylo-category-tile:focus-visible { outline: 3px solid rgba(255, 117, 21, .45); outline-offset: 3px; }

.stylo-toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 0;
  background: rgba(255, 253, 250, .94);
  backdrop-filter: blur(14px);
}

.stylo-search {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex: 0 0 auto;
  width: 100%;
  max-width: 280px;
  padding: .6rem .9rem;
  border: 1px solid var(--stylo-line);
  border-radius: 999px;
  color: var(--stylo-muted);
  background: white;
}
.stylo-search svg { width: 17px; height: 17px; flex: none; }
.stylo-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--stylo-green-dark);
  font: 500 .85rem/1 var(--font, 'Poppins', sans-serif);
}
.stylo-search input::placeholder { color: var(--stylo-muted); }

.stylo-filters { display: flex; flex-wrap: wrap; gap: .55rem; }
.stylo-filter {
  padding: .7rem 1rem;
  border: 1px solid var(--stylo-line);
  border-radius: 999px;
  color: var(--stylo-muted);
  background: transparent;
  cursor: pointer;
  font: 700 .82rem/1 var(--font, 'Poppins', sans-serif);
}
.stylo-filter:hover,
.stylo-filter.is-active { color: white; background: var(--stylo-green); border-color: var(--stylo-green); }

.stylo-results-bar { max-width: 1200px; margin: .7rem auto 1rem; }
.stylo-results-bar p { margin: 0; color: var(--stylo-muted); font-size: .82rem; }
.stylo-results-bar[hidden] { display: none; }

.stylo-prompt { max-width: 1200px; margin: 0 auto 2rem; padding: 2.4rem 1.5rem; border: 1px dashed var(--stylo-line); border-radius: 1.1rem; text-align: center; }
.stylo-prompt p { margin: 0; color: var(--stylo-muted); font-size: .9rem; font-weight: 600; }
.stylo-prompt[hidden] { display: none; }

.stylo-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  min-height: 46px;
  padding: .75rem 1.1rem;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--stylo-orange);
  box-shadow: 0 10px 25px rgba(214, 94, 31, .22);
  cursor: pointer;
  font: 700 .83rem/1 var(--font, 'Poppins', sans-serif);
  text-decoration: none;
}
.stylo-submit:hover { background: var(--stylo-orange-dark); }

.stylo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; max-width: 1200px; margin: 0 auto; }
.stylo-grid[hidden] { display: none; }
.stylo-card { position: relative; overflow: hidden; aspect-ratio: 4 / 5; border-radius: 1.1rem; background: var(--stylo-cream); cursor: pointer; outline: 0; }
.stylo-card[hidden] { display: none; }
.stylo-card::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(7, 29, 27, .88)); pointer-events: none; }
.stylo-card > img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .5s ease; }
.stylo-card:hover > img { transform: scale(1.045); }
.stylo-card-copy { position: absolute; z-index: 2; right: 1rem; bottom: 1rem; left: 1rem; color: white; }
.stylo-card-copy span { display: block; margin-bottom: .45rem; color: #ffd7ba; font-size: .63rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.stylo-card-copy strong { display: block; font: 600 clamp(1.05rem, 1.5vw, 1.4rem)/1.12 var(--font, 'Poppins', sans-serif); }
.stylo-card:focus-visible,
.stylo-filter:focus-visible,
.stylo-submit:focus-visible { outline: 3px solid rgba(255, 117, 21, .45); outline-offset: 3px; }
.stylo-empty { padding: 5rem 1rem; color: var(--stylo-muted); text-align: center; }
.stylo-empty button { border: 0; color: var(--stylo-green); background: none; cursor: pointer; font-weight: 800; text-decoration: underline; }

.stylo-modal-close { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1px solid var(--stylo-line); border-radius: 50%; color: var(--stylo-green); background: white; cursor: pointer; font-size: 1.55rem; line-height: 1; }

.stylo-modal { width: min(980px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: 1.3rem; background: var(--stylo-paper); box-shadow: 0 24px 70px rgba(13, 47, 45, .22); overflow: hidden; font-family: var(--font, 'Poppins', sans-serif); }
.stylo-modal::backdrop { background: rgba(6, 25, 24, .72); backdrop-filter: blur(6px); }
.stylo-modal[open] { display: grid; grid-template-columns: 1.25fr .75fr; }
.stylo-modal-media { min-height: 570px; background: var(--stylo-cream); }
.stylo-modal-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.stylo-modal-copy { display: flex; flex-direction: column; justify-content: center; padding: 3rem; }
.stylo-modal-copy h2 { font-size: clamp(2.2rem, 4vw, 3.7rem); line-height: 1; }
.stylo-modal-copy > p:not(.stylo-eyebrow) { margin: 1.4rem 0 2rem; color: var(--stylo-muted); line-height: 1.65; }
.stylo-modal-close { position: absolute; z-index: 2; top: 1rem; right: 1rem; }
.stylo-modal-copy .stylo-submit { align-self: flex-start; }

@media (max-width: 1050px) {
  .stylo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stylo-categories { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .stylo-toolbar { display: grid; }
  .stylo-search { max-width: none; }
  .stylo-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
  .stylo-filters::-webkit-scrollbar { display: none; }
  .stylo-filter { flex: 0 0 auto; }
  .stylo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stylo-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stylo-modal[open] { grid-template-columns: 1fr; overflow: auto; }
  .stylo-modal-media { min-height: 45vh; max-height: 58vh; }
  .stylo-modal-copy { padding: 2rem 1.3rem; }
}

@media (max-width: 520px) {
  .stylo-portfolio { padding-inline: .8rem; }
  .stylo-grid { gap: .65rem; }
  .stylo-card { aspect-ratio: 3 / 4; border-radius: .85rem; }
  .stylo-card-copy { right: .75rem; bottom: .75rem; left: .75rem; }
  .stylo-card-copy strong { font-size: 1rem; }
  .stylo-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stylo-portfolio *,
  .stylo-modal * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
