/*
 * CSS for Custom Homepage (FD Integrated)
 * Final version: Clean, modern, and elegant.
 */

/* --- Global Styles & Variables --- */
.page-template-page-home {
  --fd-ink: var(--text-inverse);
  --fd-gold: var(--gold);
  --fd-gold-light: var(--gold-hover);
  --fd-brown: var(--wood);
  --fd-ink-dim: var(--text-muted);
  --fd-shadow: 0 14px 40px rgba(0,0,0,.1);
  --fd-panel-bg-outer: var(--surface);
  --fd-panel-bg-inner: var(--surface);
  --fd-panel-radius: 24px;
  background-color: var(--bg);
}

/* --- Full Width Layout Override --- */
.page-template-page-home .site-content > .ast-container { max-width: 100%; padding: 0; }
.page-template-page-home .ast-article-single { margin: 0; }

/* --- Animation Base Styles --- */
.fd-animated-item { opacity: 0; transform: translateY(30px); transition: opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1), transform 0.8s cubic-bezier(0.19, 1, 0.22, 1); transition-delay: var(--animation-delay, 0s); }
.fd-animated-item.is-visible { opacity: 1; transform: translateY(0); }

/* --- 1. HERO SECTION --- */
.fd-hero { position:relative; isolation:isolate; overflow:hidden; background: var(--muted); }
.fd-hero__background-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; opacity: 0.3; }
.fd-hero__background-svg path { fill: none; stroke: var(--gold); stroke-width: 2px; stroke-dasharray: 1500; stroke-dashoffset: 1500; animation: draw-hero-lines 10s ease-out forwards; }
.fd-hero__background-svg .fd-hero-path-2 { animation-delay: 1s; }
.fd-hero__background-svg .fd-hero-path-3 { animation-delay: 2s; }

@keyframes draw-hero-lines {
    to {
        stroke-dashoffset: 0;
    }
}

.fd-hero__canvas { 
    min-height: 60vh; 
    display: grid; /* Use grid for 2-column layout */
    grid-template-columns: 1fr 1fr; /* Equal columns */
    align-items: center;
    gap: 4vw; 
    max-width: 1200px; 
    margin:0 auto; 
    padding: 12vh 24px 8vh; 
    position: relative; 
    z-index: 2; 
}
.fd-hero__copy { 
    --animation-delay: 0.1s; 
    max-width: 580px; /* Keep the max-width on the text content */
    width: 100%; /* Ensure it takes full width of its grid cell up to max-width */
    text-align: left; /* Revert to left align for desktop */
    margin: 0; /* Remove auto margin for desktop */
}
.fd-hero__title { --animation-delay: 0.2s; margin:0 0 1.1rem; line-height:1.3; color:var(--text-strong); font-size: clamp(28px, 4vw, 46px); }
.fd-hero__p { color: var(--text-muted); opacity: 1; line-height: 1.8; font-size: 1.05rem; }
.fd-hero__p:nth-of-type(1) { --animation-delay: 0.3s; }
.fd-hero__p:nth-of-type(2) { --animation-delay: 0.4s; }
.fd-hero__copy small {
    display:block; 
    color: var(--text-strong);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing:.04em; 
    margin-bottom:.75rem; 
}

/* Hero Cards */
.fd-hero__cards { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 16px; 
    width: 100%; /* Take full width of its grid cell */
    max-width: none; /* Remove previous max-width */
}
.fd-feast .feast-widget { background: var(--surface); color:var(--text-strong); border:1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--fd-shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; height: 100%; }
.fd-feast .feast-widget:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(0,0,0,.1); }
.fd-feast .feast-widget__title { font-weight:800; color:var(--text-strong); }
.fd-feast .feast-widget__item { border-bottom:1px dashed var(--line); padding:.5rem 5rem .8rem 0; position:relative; opacity: 0; animation: fadeIn 0.5s ease forwards; }
.fd-feast .feast-widget__item:last-child { border-bottom:none; }
.fd-feast .feast-widget__name { display:block; }
.fd-feast .feast-widget__dday { position:absolute; right:0; top:.5rem; font-weight:700; color:var(--accent); }
.fd-feast .dday-today { background-color: var(--accent); color: var(--text-inverse); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.fd-feast .feast-widget__meta { color:var(--text-muted); font-size:.95rem; }

/* --- 2. MARQUEE WRAPPER --- */
.fd-marquee-wrapper { padding: 20px 0; background-color: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text-muted); }

/* --- 3. PANEL CARDS SECTION --- */
#fd-panel-001 { font-family:'Noto Serif KR', serif; color:var(--text-strong); margin: 0; padding: 80px 0; isolation:isolate; }
#fd-panel-001.fd-animated-item { --animation-delay: 0.2s; }
#fd-panel-001 .outer-bg { background: var(--fd-panel-bg-outer); border-radius: var(--fd-panel-radius); padding: 2px; box-shadow: none; max-width: 1200px; margin: 0 auto; transition: background .3s ease, padding .3s ease; }
#fd-panel-001 .panel { background: var(--fd-panel-bg-inner); border-radius: calc(var(--fd-panel-radius) - 2px); overflow: hidden; box-shadow: var(--fd-shadow); border:1px solid var(--line); }
#fd-panel-001 .head { padding: 26px 22px 6px; border-bottom: 1px solid var(--line); background: var(--surface); }
#fd-panel-001 .head .sub { color:var(--text-muted); font-weight:700; letter-spacing:.03em; }
#fd-panel-001 .head h2 { margin: 8px 0 10px; font-size: clamp(20px,3.2vw,28px); color:var(--text-strong); }
#fd-panel-001 .inner { padding: 22px; }
#fd-panel-001 .grid { display:grid; gap: 18px; grid-template-columns: repeat(4, 1fr); }
#fd-panel-001 .card { background: var(--surface); border-radius: 24px; overflow: hidden; border:1px solid var(--line); box-shadow: 0 8px 22px rgba(0,0,0,.05); transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease; }
#fd-panel-001 .card:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0,0,0,.1); border-color: var(--gold); }
#fd-panel-001 .thumb { position:relative; aspect-ratio: 4/3; background: #eee center/cover no-repeat; }
#fd-panel-001 .thumb::after { content:""; position:absolute; inset:0; background: linear-gradient(to bottom, transparent 70%, rgba(0,0,0,.1)); }
#fd-panel-001 .body { padding: 14px 14px 16px; text-align: center; background: var(--surface); }
#fd-panel-001 .title { font-weight:800; color: var(--text-strong); margin: 2px 0 12px; font-size: 1.05rem; }
#fd-panel-001 .btn { display:inline-block; padding:8px 14px; border-radius:999px; border:1px solid var(--gold); color:var(--gold); text-decoration:none; font-weight:700; background: transparent; transition: background .3s ease, color .3s ease, transform .3s ease; }
#fd-panel-001 .btn:hover { background: var(--gold); color: var(--text-inverse); transform: scale(1.05); }
#fd-panel-001 .sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }

/* --- Keyframes for Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 4. SVG Ornament Animation --- */
.fd-marquee-wrapper .fd-ornament path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.5px;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-ornament 6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards 1s;
}

@keyframes draw-ornament {
    to {
        stroke-dashoffset: 0;
    }
}

/* --- Responsive Adjustments --- */

/* Tablet & Small Desktop */
@media (max-width: 1024px) {
  .fd-hero__canvas {
    grid-template-columns: 1fr; /* Stack hero content and cards */
    gap: 40px;
    text-align: center;
  }
  .fd-hero__copy {
    max-width: 680px; /* Allow text to be a bit wider */
    margin: 0 auto; /* Center the text block */
  }
  .fd-hero__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
  }
  #fd-panel-001 .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .fd-hero__canvas {
    padding: 8vh 20px 6vh; /* Reduce padding */
    text-align: left;
    gap: 20px; /* Reduced gap for mobile */
  }
  .fd-hero__title {
      font-size: clamp(24px, 7vw, 36px); /* Adjust font size for mobile */
      margin-bottom: 0.55rem; /* Reduced margin for mobile */
  }
  .fd-hero__copy small {
      font-size: 1rem;
      margin-bottom: 0.375rem; /* Reduced margin for mobile */
  }
  .fd-hero__p {
      font-size: 0.95rem;
  }
  .fd-hero__cards {
    grid-template-columns: 1fr; /* Stack the 3 cards vertically */
    margin-top: 15px; /* Reduced margin-top for mobile */
  }
  #fd-panel-001 { padding: 20px 0 !important; }
  #fd-panel-001 .outer-bg { background: transparent !important; padding: 0 !important; box-shadow: none !important; }
  #fd-panel-001 .panel { background: transparent !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; }
  #fd-panel-001 .inner { padding: 0 10px !important; }
  #fd-panel-001 .grid { grid-template-columns: repeat(2, 1fr); gap: 8px !important; }
  #fd-panel-001 .card .title { font-size: 0.9rem; }
  #fd-panel-001 .card .btn { padding: 6px 12px; font-size: 0.9rem; }
  #fd-panel-001 .head { text-align: center; padding-left: 0; padding-right: 0; }

  /* Mobile CTA Button Stack */
  .fd-hero__cta-row {
    flex-direction: column; /* Stack buttons vertically */
    gap: 0.5rem; /* Narrow spacing */
  }
  .fd-hero__cta-row .wp-block-button__link, .fd-hero__cta-row button {
    width: 100%; /* Make buttons take full width */
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  #fd-panel-001 .grid {
    grid-template-columns: 1fr; /* Stack panel cards on very small screens */
  }
  #fd-panel-001 .card .title { font-size: 0.85rem; }
  #fd-panel-001 .card .body { padding: 12px; }
}

/* === PATCH v3: Panel spacing + border removal (TIGHT) — 2025-08-11 === */
.page-template-page-home #fd-panel-001 .panel{ border: none !important; }
.page-template-page-home #fd-panel-001 .head{ border-bottom: none !important; }
.page-template-page-home #fd-panel-001{ padding: 40px 0 !important; }
.page-template-page-home #fd-panel-001 .inner{ padding: 16px !important; }
.page-template-page-home #fd-panel-001 .grid{ gap: 16px !important; }

/* === PATCH: Hero cards vertical stack on desktop === */
.page-template-page-home .fd-hero__cards {
    grid-template-columns: 1fr !important;
}



/* === FD APPEND 2025-08-21 — Safe tweaks (do not remove existing rules) === */



/* Remove any leftover marquee spacing (if wrapper exists) */
.page-template-homepage-modulepage-home-php .fd-marquee-section-wrapper,
.page-template-page-home .fd-marquee-section-wrapper,
.home.page .fd-marquee-section-wrapper { display:none !important; }

.page-template-homepage-modulepage-home-php .fd-hero,
.page-template-page-home .fd-hero,
.home.page .fd-hero { margin-bottom:0 !important; padding-bottom:0 !important; }

/* Mobile: make the 4-card block (#fd-panel-001) 2x2 */
@media (max-width: 767px) {
  #fd-panel-001 .inner > .grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
  #fd-panel-001 .inner > .grid > * { width: 100% !important; margin: 0 !important; }
}
/* === /FD APPEND === */


/* === STYLES MOVED FROM INLINE <style> BLOCK === */
.fd-hero__image-showcase {
    position: relative; /* For positioning the overlay */
    display: block;
    margin: 2.5rem 0; /* Adjusted margin for full width */
    width: 100%; /* Fill the available width of the column */
    /* max-width is no longer needed as the grid column controls the width */
    /* border-radius is removed to allow for a soft mask edge */
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 14 / 5; /* Reduced height to ~80% of previous */
    -webkit-mask-image: radial-gradient(circle, black 65%, transparent 95%);
    mask-image: radial-gradient(circle, black 65%, transparent 95%);
}
/* Add a dark gradient overlay for better text readability */
.fd-hero__image-showcase::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
    pointer-events: none; /* Allow clicks to go through to the link */
}
.image-overlay-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.2rem 1.5rem;
    color: white;
    font-family: 'Noto Serif KR', serif;
    font-size: 1.25rem;
    font-weight: 500;
    text-align: right;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    z-index: 1;
}
/* This block was broken and is now removed, as it was being ignored by browsers.
    display: block;
    margin: 2.5rem auto;
    max-width: 640px;
    width: 90%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 21 / 9; /* Set a wide aspect ratio for the frame */
*/
.fd-hero__image-showcase:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.fd-hero__image-showcase img {
    display: block;
    width: 100%;
    height: 100%; /* Make image fill the frame */
    object-fit: cover; /* Crop the image, don't distort */
}
            .fd-latest-posts-board {
                padding: 2.5rem 0;
                background-color: #fdfdfd; /* Slightly off-white */
            }
            .fd-latest-posts-board .fd-container {
                max-width: 1200px;
                margin: 0 auto;
                padding: 0 1rem;
            }
            .fd-latest-posts-board h2 {
                font-size: 1.5rem; /* Reduced */
                margin-top: 0;
                margin-bottom: 1.5rem; /* Increased margin for title spacing */
                color: #333;
                text-align: center; /* Centered title */
            }
            .fd-latest-posts-board .fd-posts-list {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 1.5rem;
                border-top: none; /* Removed top border */
            }
            .post-list-link {
                text-decoration: none;
                color: inherit;
                display: block;
                height: 100%;
            }
            .post-list-item {
                background: #fff;
                border: 1px solid #eee;
                border-radius: 12px;
                padding: 1.25rem;
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                box-shadow: 0 4px 12px rgba(0,0,0,0.04);
                transition: transform 0.3s ease, box-shadow 0.3s ease;
            }
            .post-list-link:hover .post-list-item {
                transform: translateY(-5px);
                box-shadow: 0 8px 20px rgba(0,0,0,0.08);
            }
            .post-list-title {
                font-size: 1.05rem; /* Reduced */
                font-weight: 600;
                line-height: 1.4;
                margin: 0 0 1rem 0;
                /* Line clamping for compactness */
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;  
                overflow: hidden;
                min-height: 2.8em; /* 1.4 * 2 lines */
            }
            .post-list-meta {
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 0.8rem; /* Reduced */
                color: #666;
                border-top: 1px solid #f0f0f0;
                padding-top: 0.75rem;
                margin-top: auto; /* Pushes meta to the bottom */
            }
            .post-list-author,
            .post-list-date {
                margin: 0;
            }
            .no-posts-found {
                padding: 2rem 1rem;
                text-align: center;
                grid-column: 1 / -1; /* Span all columns if no posts */
            }

            /* Mobile Styles */
            @media (max-width: 768px) {
                .fd-latest-posts-board {
                    padding: 2rem 0;
                }
                .fd-latest-posts-board .fd-posts-list {
                    grid-template-columns: 1fr;
                    gap: 1rem;
                }
                .fd-latest-posts-board h2 {
                    font-size: 1.3rem;
                }
                .post-list-title {
                    font-size: 1rem;
                }
                .post-list-meta {
                    font-size: 0.75rem;
                }
            }
/* 'New' Badge for the first post */
.post-list-item {
    overflow: hidden; /* Ensures the badge stays within the rounded corners */
    position: relative; /* Needed for absolute positioning of the badge */
}

.fd-latest-posts-board .fd-posts-list > .post-list-link:first-child .post-list-item::before {
    content: 'New';
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--accent, #5A3C95); /* Use theme's accent color */
    color: white;
    padding: 0.2em 0.7em;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0 12px 0 8px; /* Stylish corner rounding for bottom-left of badge */
    box-shadow: -1px 1px 5px rgba(0,0,0,0.2);
}
/* === CTA row just below the bookshelf card (2025-09-16) === */
.fd-hero__cta-row{
  display:flex;
  justify-content: center; /* Center buttons horizontally */
  gap: 1rem; /* Space between buttons */
  margin-top: 2rem; /* Add some space above the buttons */
  flex-wrap:wrap;
}
.fd-hero__cta-row .wp-block-button__link, .fd-hero__cta-row button{
  background:var(--gold-btn);color:var(--text-inverse);border:1px solid transparent;border-radius:10px;padding:.75rem 1.5rem;font-weight:600;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Subtle shadow for depth */
  transition: all 0.3s ease; /* Smooth transitions */
  display: inline-flex; /* Use flexbox for icon-text alignment */
  align-items: center; /* Vertically center items */
  justify-content: center; /* Horizontally center items if needed */
}
.fd-hero__cta-row .wp-block-button__link:hover, .fd-hero__cta-row button:hover{
  background:var(--gold-hover);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Enhanced shadow on hover */
  transform: translateY(-1px); /* Slight lift effect */
}

.fd-hero__cta-row .button-icon {
  width: 1.2em; /* Adjust icon size */
  height: 1.2em; /* Adjust icon size */
  margin-right: 0.5em; /* Space between icon and text */
  fill: currentColor; /* Ensure icon color matches text color */
}

.fd-hero__cta-row .disabled-button {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--muted); /* Use a muted background color */
  color: var(--text-muted); /* Use muted text color */
  border-color: var(--line); /* Add a subtle border */
  box-shadow: none; /* No shadow for disabled buttons */
  transform: none; /* No lift effect for disabled buttons */
}
