/* ===== Base / Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
}
html, body {
    height: 100%;
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    letter-spacing: .02em;
    color: #111;
    background: #fff;
}
img {
    max-width: 100%; height: auto; vertical-align: middle;
}
a {
    color: inherit; text-decoration: underline; text-underline-offset: 3px;
}

/* --- デザイン変数の設定 --- */
:root {
    /* グラデーションの色 */
    --acc1: #ff9966;
    --acc2: #ff5e62;
    --acc3: #00F260;
    --acc4: #0575E6;

    /* その他カラー */
    --text: #111;
    --text-on-gray: #fff;
    --gray: #f2f4f8;

    /* アニメーションのタイミング */
    --ease: cubic-bezier(0.7, 0, 0.2, 1);
    --reveal-duration: 800ms;
}

/* ===== Layout ===== */
.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

header.hero {
    position: relative;
    padding: 64px 0 48px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin-bottom: 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.back-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.back-link .arrow {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right: none;
    border-bottom: none;
    transform: rotate(135deg);
    transition: transform 0.2s ease;
}

.back-link:hover .arrow {
    transform: rotate(135deg) translateX(-2px);
}

/* ===== New "Whatever-like" Reveal Effect ===== */
.grad-sweep {
    position: relative;
    overflow: hidden;
}

/* グラデーションのオーバーレイ */
.grad-sweep::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(90deg, var(--acc1), var(--acc2), var(--acc3), var(--acc4));
    transform: scaleX(0);
    transform-origin: left;
}

/* 表示されるコンテンツの親(h1, h2) */
.grad-sweep > h1,
.grad-sweep > h2 {
    opacity: 0;
    transition: opacity 0.2s linear;
    position: relative;
}

/* レイヤー1: 単色の文字 (最初は透明) */
.grad-sweep h1 > span,
.grad-sweep h2 > span {
    position: relative;
    color: var(--text);
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* レイヤー2: グラデーションの文字 (最初は不透明) */
.grad-sweep h1::after,
.grad-sweep h2::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(90deg, var(--acc1), var(--acc2), var(--acc3), var(--acc4));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 1;
    transition: opacity 0.4s ease;
}

/* is-inviewになった時のアニメーション */
.grad-sweep.is-inview::after {
    animation: reveal-overlay var(--reveal-duration) var(--ease) forwards;
}

/* コンテンツ全体のフェードイン */
.grad-sweep.is-inview > h1,
.grad-sweep.is-inview > h2 {
    opacity: 1;
    transition-delay: calc(var(--reveal-duration) * 0.4);
}

/* クロスフェードのトリガー */
.grad-sweep.is-inview h1 > span,
.grad-sweep.is-inview h2 > span {
    opacity: 1;
    transition-delay: calc(var(--reveal-duration) * 0.4 + 500ms);
}
.grad-sweep.is-inview h1::after,
.grad-sweep.is-inview h2::after {
    opacity: 0;
    transition-delay: calc(var(--reveal-duration) * 0.4 + 500ms);
}

@keyframes reveal-overlay {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    50% {
        transform: scaleX(1);
        transform-origin: left;
    }
    51% {
        transform-origin: right;
    }
    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

/* ===== General Typography & Helpers ===== */
h1, h2 {
    margin: 0;
}
h1 {
    font-size: clamp(32px, 8vw, 72px);
}
h2 {
    font-size: clamp(22px, 4.6vw, 36px);
}
p {
    margin: .75rem 0 0;
}
.muted {
    color: #6b7280;
}

.subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    margin: 0;
    opacity: .68;
    font-weight: 600;
    margin: .5rem 0 2rem;
}

/* ===== Archive Section ===== */
section {
    padding: 80px 0;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.archive-card {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.archive-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.archive-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--acc1), var(--acc2), var(--acc3), var(--acc4));
    z-index: 1;
}

/* Card gradient sweep effect on hover */
.archive-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(90deg, var(--acc1), var(--acc2), var(--acc3), var(--acc4));
    opacity: 0;
    transform: translateX(-100%);
    transition: none;
    pointer-events: none;
}
.archive-card:hover::after {
    opacity: 0.15;
    transform: translateX(100%);
    transition: transform 0.6s var(--ease), opacity 0.3s ease;
}

/* カードのコンテンツを前面に */
.archive-card > * {
    position: relative;
    z-index: 3;
}

.archive-status {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: rgb(239, 68, 68);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.archive-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
}

.archive-description {
    color: #6b7280;
    margin: 0 0 16px;
    line-height: 1.6;
}

.archive-tech {
    font-size: 0.9rem;
    color: var(--acc1);
    font-weight: 500;
    margin: 0 0 16px;
}

.archive-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--acc1);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.archive-link:hover {
    opacity: 0.8;
}

.archive-link .external-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ===== Footer ===== */
footer {
    padding: 56px 0;
    color: #666;
    border-top: 1px solid #eee;
}

footer small {
    color: #666;
}
