/* css/tools.css
   All styles for the tools discovery page. Complements global.css, never overrides it. */

/* ── Prevent horizontal overflow globally ── */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Typography & Colors Specific to Tools Page */
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: Georgia, 'Times New Roman', serif;
}

/* Page Hero Section */
.tools-hero {
    padding: 5rem 2.5rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tools-hero__label {
    display: block;
    margin-bottom: 16px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: #888;
}

.tools-hero__heading {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 4.5rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    line-height: 1.1;
    color: var(--color-text);
}

.tools-hero__sub {
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 400;
    color: #444;
    max-width: 520px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.tools-hero__divider {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 0 auto;
    max-width: 1000px;
    width: 100%;
}

/* Search Bar Section */
.tools-search-section {
    max-width: 560px;
    margin: 2.5rem auto 1.5rem;
    padding: 0 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tools-search__inner {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tools-search__label {
    display: block;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: #888;
}

.tools-search__input-wrap {
    position: relative;
    width: 100%;
}

.tools-search__input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--color-text);
    outline: none;
    font-family: var(--font-family);
    font-size: 1.1rem;
    color: var(--color-text);
    padding: 0.75rem 0;
    transition: border-color 0.2s;
    text-align: center;
    box-sizing: border-box;
}

.tools-search__input::placeholder {
    color: #bbb;
}

.tools-search__input-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--color-text);
    transition: width 0.3s ease, left 0.3s ease;
    border-radius: 2px;
}

.tools-search__input-wrap:focus-within::after {
    width: 100%;
    left: 0;
}

.tools-search__results-count {
    margin-top: 0.5rem;
    font-family: var(--font-family);
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

/* ── Filter Chips Nav Wrapper ── */
.tools-filters-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 700px;
    margin: 0 auto 3rem;
    padding: 0 2.5rem;
    box-sizing: border-box;
}

/* ── Arrow Buttons ── */
.filter-arrow {
    display: none;
    /* Hidden on desktop and mobile */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: transparent;
    color: #888;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.filter-arrow:hover {
    border-color: var(--color-text);
    color: var(--color-text);
    background: rgba(26, 26, 26, 0.05);
}

.filter-arrow.is-hidden {
    opacity: 0.25;
    pointer-events: none;
}

/* ── Filter Chips Scroll ── */
.tools-filters-scroll {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.tools-filters-scroll::-webkit-scrollbar {
    display: none;
}

.tools-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 4px;
    width: auto;
}

.tools-filter {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 0.35rem 1rem;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tools-filter:hover {
    border-color: var(--color-text);
}

.tools-filter.active {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

/* Tools Grid Section */
.tools-grid {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2.5rem 5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  box-sizing: border-box;
}

/* Tool Cards */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e8e5e0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  opacity: 0; /* for entrance animation */
}

.tool-card.card-visible {
  animation: cardFadeUp 0.5s ease forwards;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
  border-color: #c8c4be;
}

/* ── Square Cover ── */
.tool-card__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* perfect square */
  overflow: hidden;
  background: #f5f3ef;
}

.tool-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.tool-card:hover .tool-card__cover img {
  transform: scale(1.04);
}

/* ── Badge — overlaps top-right of image ── */
.tool-card__badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #555;
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
}

/* ── Card Body ── */
.tool-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

/* ── Title ── */
.tool-card__title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: #1a1a1a;
  line-height: 1.3;
  margin: 0;
}

/* ── Description ── */
.tool-card__desc {
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: #555;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

/* ── Open Tool link — bottom right ── */
.tool-card__link {
  display: block;
  text-align: right;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  text-decoration: none;
  margin-top: 0.5rem;
  transition: color 0.2s;
}

.tool-card:hover .tool-card__link {
  color: #1a1a1a;
}

@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.tools-empty {
    display: none;
    padding: 4rem 1.5rem;
}

.tools-empty.empty-visible {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tools-empty__heading {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.6rem;
    color: #ccc;
    font-weight: 400;
    margin: 0 0 16px;
    letter-spacing: -0.01em;
}

.tools-empty__sub {
    font-family: var(--font-family);
    font-size: 1rem;
    color: #aaa;
    margin: 0;
    line-height: 1.7;
}

/* ═══════════════════════════════════════
   RESPONSIVE — 768px and below
═══════════════════════════════════════ */
@media (max-width: 768px) {

    .navbar__hamburger {
        display: flex !important;
    }

    /* Hero */
    .tools-hero {
        padding: calc(var(--navbar-height, 64px) + 20px) 1.25rem 1.5rem;
        max-width: 100%;
        width: 100%;
    }

    .tools-hero__heading {
        font-size: 2.6rem;
        margin-bottom: 16px;
    }

    .tools-hero__sub {
        font-size: 1rem;
        margin-bottom: 24px;
    }

    .tools-hero__divider {
        max-width: 100%;
    }

    /* Search */
    .tools-search-section {
        width: 100%;
        max-width: 100%;
        padding: 0 1.25rem;
        margin-top: 1.5rem;
        box-sizing: border-box;
    }

    /* Filter nav */
    .filter-arrow {
        display: none;
    }

    .tools-filters-nav {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0 0 2rem 0;
        box-sizing: border-box;
    }

    .tools-filters-scroll {
        overflow-x: auto;
        padding: 0 1.25rem 4px;
        box-sizing: border-box;
        -ms-overflow-style: none;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        justify-content: flex-start;
    }

    .tools-filters {
        width: max-content;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    /* Grid — 2 columns on tablet */
    .tools-grid {
        grid-template-columns: 1fr 1fr;
        padding: 0 1.25rem 4rem;
        gap: 1rem;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ═══════════════════════════════════════
   RESPONSIVE — 480px and below
═══════════════════════════════════════ */
@media (max-width: 480px) {

    .tools-hero__heading {
        font-size: 2rem;
    }

    .tools-hero__sub {
        font-size: 0.95rem;
    }

    .tools-search__input {
        font-size: 1rem;
    }

    /* Filter chips — exactly 3 visible, scroll for rest */
    .tools-filters-scroll {
        padding: 0 1rem 4px;
    }

    .tools-filter {
        /* 3 chips visible = (100vw - left pad - right pad - 2 gaps) / 3 */
        min-width: calc((100vw - 2rem - 1rem) / 3);
        max-width: calc((100vw - 2rem - 1rem) / 3);
        padding: 0.35rem 0.25rem;
        font-size: 0.72rem;
        text-align: center;
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Grid — single column on phones */
    .tools-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem 3rem;
        gap: 0.75rem;
    }

    .tool-card__title {
        font-size: 1.1rem;
    }

    .tool-card__body {
        padding: 1rem 1.25rem 1.25rem;
    }

    .tools-empty__heading {
        font-size: 1.8rem;
    }
}