/* CSS Variables for Easy Customization */
:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --muted-color: #475569;
    --primary-color: #2563eb;
    --accent-color: #3b82f6;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --soft-bg: #f1f5f9;
    --danger-color: #ef4444;
    --max-width: 1000px;
}

/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header & Sticky Navigation */
header {
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 24px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

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

/* Hero Section */
.page-title {
    padding: 56px 0 8px;
    text-align: center;
}

.page-title h1 {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.hero-figure {
    margin: 28px 0 0;
}

.hero {
    min-height: 540px;
    border-radius: 24px;
    overflow: hidden;
    background: url('assets/hero.png') center/cover no-repeat;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.hero-figure figcaption {
    margin-top: 6px;
    color: var(--muted-color);
    font-size: 0.72rem;
    line-height: 1.3;
    text-align: center;
}

.intro-card {
    width: 100%;
    margin: 28px 0 12px;
    padding: 30px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.section-with-top {
    position: relative;
}

.top-link {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 4px 9px;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--muted-color);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.top-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.intro-card p {
    font-size: 1.2rem;
    color: var(--muted-color);
    max-width: 680px;
    margin: 0 auto 28px auto;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    background-color: #ffffff;
    color: var(--text-color);
    padding: 12px 24px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-color);
    border-color: rgba(15, 23, 42, 0.22);
}

/* Sections */
.grid-section {
    padding: 48px 0;
}

.grid-section h2 {
    margin-bottom: 28px;
    font-size: 1.9rem;
    letter-spacing: -0.02em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.card,
.table-section {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.card h3,
.table-section h3,
.map-card h3 {
    margin-bottom: 12px;
    font-size: 1.35rem;
}

.map-card {
    display: grid;
    grid-template-columns: minmax(170px, 0.55fr) minmax(360px, 1.45fr);
    gap: 24px;
    align-items: center;
    margin-top: 24px;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.map-card p {
    color: var(--muted-color);
    margin-bottom: 18px;
}

.map-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 8px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 999px;
    background: var(--soft-bg);
    color: var(--text-color);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.map-toggle:hover {
    border-color: var(--primary-color);
}

.toggle-track {
    width: 44px;
    height: 24px;
    padding: 3px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
}

.toggle-knob {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.map-toggle[aria-pressed="true"] {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--primary-color);
}

.map-toggle[aria-pressed="true"] .toggle-track {
    background: var(--primary-color);
}

.map-toggle[aria-pressed="true"] .toggle-knob {
    transform: translateX(20px);
}

.map-figure {
    margin: 0;
}

.map-scroll {
    width: 100%;
    height: 430px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--soft-bg);
    cursor: zoom-in;
}

.map-link {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.map-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--soft-bg);
    transform-origin: top left;
    transition: width 0.12s ease, height 0.12s ease;
}

.map-figure figcaption {
    margin-top: 6px;
    color: var(--muted-color);
    font-size: 0.72rem;
    line-height: 1.3;
    text-align: center;
}

.timeline,
.notes-list {
    list-style-position: inside;
    display: grid;
    gap: 10px;
}

.timeline {
    list-style: none;
}

.section-intro {
    color: var(--muted-color);
    margin-bottom: 20px;
}

/* Fillable tables */
.table-section + .table-section {
    margin-top: 28px;
}

.table-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
    gap: 10px;
    align-items: start;
    margin-bottom: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 0.8rem;
    font-weight: 700;
}

.password-hint {
    color: var(--muted-color);
    font-size: 0.72rem;
    line-height: 1.25;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font: inherit;
    font-size: 0.95rem;
}

.form-field textarea {
    resize: vertical;
    min-height: 110px;
}

.table-form .form-field {
    gap: 2px;
}

.table-form .form-field label {
    font-size: 0.74rem;
}

.table-form .form-field input {
    padding: 6px 9px;
    min-height: 34px;
    font-size: 0.9rem;
}

.table-form .btn {
    align-self: end;
    margin-bottom: 0;
    padding: 6px 14px;
    min-height: 34px;
    font-size: 0.88rem;
}


.form-field input:focus,
.form-field textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: var(--primary-color);
}

.form-message {
    margin: -6px 0 18px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.form-message:empty {
    display: none;
}

.form-message.is-success {
    background: #dcfce7;
    color: #166534;
}

.form-message.is-error {
    background: #fee2e2;
    color: #991b1b;
}

.form-message.is-info {
    background: #dbeafe;
    color: #1e40af;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

thead tr {
    background: var(--soft-bg);
    text-align: left;
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.action-column {
    text-align: right;
}

.delete-button {
    background: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 999px;
    color: var(--danger-color);
    cursor: pointer;
    font-weight: 700;
    padding: 5px 10px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-delete {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.delete-button:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.empty-row {
    color: var(--muted-color);
    text-align: center;
}

/* Comments */
.comment-section {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.comment-form {
    display: grid;
    gap: 14px;
    margin-bottom: 28px;
}

.comment-form .form-field input,
.comment-form .form-field textarea {
    padding: 11px 12px;
    font-size: 1rem;
}

.comment-list {
    display: grid;
    gap: 14px;
}

.comment-card {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--soft-bg);
}

.comment-card header {
    position: static;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    background: transparent;
    border: 0;
    backdrop-filter: none;
}

.comment-card header div {
    display: grid;
    gap: 2px;
}

.comment-card strong {
    color: var(--text-color);
}

.comment-card time {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.comment-card p {
    white-space: pre-wrap;
}

.comment-delete {
    flex-shrink: 0;
    font-size: 0.85rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: #64748b;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
}

@media (max-width: 760px) {
    .container {
        padding: 0 14px;
    }

    nav {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
        padding: 14px 0;
    }

    .logo {
        font-size: 1.1rem;
    }

    .nav-links {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }

    .nav-links a {
        display: inline-block;
        padding: 4px 0;
        font-size: 0.95rem;
    }

    .page-title {
        padding: 34px 0 4px;
    }

    .page-title h1 {
        font-size: clamp(1.9rem, 9vw, 2.8rem);
        letter-spacing: -0.03em;
    }

    .hero-figure {
        margin-top: 18px;
    }

    .hero {
        min-height: 300px;
        border-radius: 18px;
        background-size: contain;
        background-color: var(--soft-bg);
    }

    .hero-figure figcaption,
    .map-figure figcaption {
        font-size: 0.68rem;
        text-align: center;
    }

    .intro-card {
        padding: 22px 18px;
    }

    .intro-card p {
        font-size: 1.05rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    .map-toggle {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .grid-section {
        padding: 34px 0;
    }

    .grid-section h2 {
        font-size: 1.55rem;
        margin-bottom: 18px;
        padding-right: 54px;
    }

    .top-link {
        top: 10px;
        right: 10px;
        min-width: 34px;
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .table-form {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .table-form .btn,
    .comment-form .btn {
        margin-top: 4px;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap td {
        width: 100%;
    }

    .table-wrap table {
        background: transparent;
    }

    .table-wrap thead {
        display: none;
    }

    .table-wrap tbody {
        display: grid;
        gap: 12px;
    }

    .table-wrap tr {
        position: relative;
        padding: 12px 46px 12px 12px;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    }

    .table-wrap td {
        display: flex;
        justify-content: flex-start;
        align-items: baseline;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
    }

    .table-wrap td::before {
        content: attr(data-label);
        flex: 0 0 52px;
        color: var(--muted-color);
        font-size: 0.74rem;
        font-weight: 700;
        text-align: left;
    }

    .table-wrap td:last-child {
        border-bottom: 0;
        align-items: center;
    }

    .table-wrap .action-cell {
        position: absolute;
        top: 10px;
        right: 10px;
        display: block;
        width: auto;
        padding: 0;
        border-bottom: 0;
    }

    .table-wrap .action-cell::before {
        content: none;
    }

    .table-wrap .action-column {
        text-align: right;
    }

    .table-wrap .empty-row {
        display: block;
        text-align: center;
    }

    .table-wrap .empty-row::before {
        content: none;
    }

    th,
    td {
        padding: 10px 12px;
    }

    .map-card {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .map-scroll {
        height: 320px;
        background: var(--soft-bg);
    }

    .map-card img {
        object-fit: contain;
        object-position: center;
    }

    .card,
    .table-section,
    .comment-section {
        padding: 22px;
        border-radius: 14px;
    }

    .comment-card header {
        flex-direction: column;
    }

    footer {
        margin-top: 48px;
    }
}

@media (max-width: 420px) {
    .page-title h1 {
        font-size: clamp(1.7rem, 8.5vw, 2.25rem);
    }

    .hero {
        min-height: 250px;
    }

    .map-scroll {
        height: 280px;
    }

    .card,
    .table-section,
    .comment-section,
    .map-card {
        padding: 18px;
    }
}
