/* =============================================================
   common.css — 全ページ共通スタイル
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* --- CSS変数（テーマで上書き可能） --- */
:root {
    --primary:       #3b82f6;
    --primary-hover: #2563eb;
    --danger:        #ef4444;
    --danger-hover:  #dc2626;
    --success:       #22c55e;
    --bg:            #f8fafc;
    --surface:       #ffffff;
    --border:        #94a3b8;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --radius:        10px;
    --shadow:        0 4px 24px rgba(0,0,0,0.07);
    --font-en:       'DM Sans', sans-serif;
    --font-ja:       'Noto Sans JP', sans-serif;
}

/* --- リセット --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: var(--font-en), var(--font-ja);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- レイアウト --- */
.container {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

/* --- ヘッダー --- */
.site-header {
    width: 100%;
    max-width: 560px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 20px;
}

.site-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.site-header nav a {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-header nav a:hover { color: var(--primary); }

/* --- ボタン --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--border);
    color: var(--text);
}
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 0.875rem;
}
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }

/* --- エラーボックス --- */
.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    color: var(--danger);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- ページナビ --- */
.page-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

/* --- プロフィールページ専用 --- */
.link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.link-button {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.link-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.link-button--web {
    background: #f59e0b;
}
.link-button--web:hover { background: #d97706; }

/* --- QRページ専用 --- */
.qr-section {
    text-align: center;
    padding: 16px 0;
}

.qr-section p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.qr-link { display: inline-block; }

.qr-image {
    width: 100%;
    max-width: 420px;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px;
    background: #fff;
}

/* --- フッター --- */
.site-footer {
    width: 100%;
    max-width: 560px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 12px;
    font-size: 0.875rem;
    color: var(--text-muted);
    gap: 12px;
    flex-wrap: wrap;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover { color: var(--primary); }

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
        padding: 12px 0 8px;
        font-size: 0.8rem;
    }
}

/* --- テキストのみのリンク（ボタンなし） --- */
.text-link {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.2s;
}

.text-link:hover { color: var(--primary); }

/* --- Share / Save ボタン --- */
.share-wrap {
    position: relative;
}

.share-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.share-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.share-item:last-child { border-bottom: none; }
.share-item:hover      { background: var(--bg); }
.share-item.copied     { color: #16a34a; }

/* =============================================================
   モバイル向けスペーシング調整
   ============================================================= */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 18px 14px;
    }

    .site-header {
        padding: 10px 0 12px;
    }

    .btn {
        padding: 10px 16px;
    }

    .page-nav {
        gap: 8px;
        margin-top: 16px;
    }

    .link-list {
        gap: 10px;
    }

    .link-button {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .qr-section {
        padding: 8px 0;
    }

    .qr-section p {
        margin-bottom: 12px;
    }

    .qr-image {
        max-width: 100%;
        padding: 8px;
    }
}
