/* ============================================================
   Japan Skateparks — Wikipedia-style CSS
   ============================================================ */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg:        #f8f9fa;
    --color-surface:   #ffffff;
    --color-border:    #a2a9b1;
    --color-border-light: #eaecf0;
    --color-link:      #3366cc;
    --color-link-visited: #795cb2;
    --color-link-red:  #d33;
    --color-text:      #202122;
    --color-text-muted:#54595d;
    --color-header-bg: #1c1c1c;
    --color-header-text: #f8f9fa;
    --color-infobox-header: #cee0f2;
    --color-toc-bg:    #f8f9fa;
    --color-highlight: #eaf3fb;
    --font-serif:      'Linux Libertine', 'Georgia', 'Times', serif;
    --font-sans:       -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --sidebar-width:   160px;
    --content-max:     960px;
}

html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a { color: var(--color-link); text-decoration: none; }
a:visited { color: var(--color-link-visited); }
a:hover { text-decoration: underline; }
a.new { color: var(--color-link-red); }

/* ============================================================
   SITE HEADER
   ============================================================ */
#site-header {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: .5rem 1rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: var(--color-header-text);
    flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; color: #fff; }

.logo-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: bold;
    letter-spacing: .01em;
}

.logo-tagline {
    font-size: .65rem;
    color: #aab;
    letter-spacing: .04em;
}

/* Search bar */
.header-search {
    flex: 1;
    max-width: 480px;
    display: flex;
    gap: 0;
}

.header-search input[type="search"] {
    flex: 1;
    padding: .4rem .7rem;
    border: 1px solid #555;
    border-right: none;
    border-radius: 2px 0 0 2px;
    background: #2a2a2a;
    color: #f0f0f0;
    font-size: .875rem;
    outline: none;
}
.header-search input[type="search"]::placeholder { color: #888; }
.header-search input[type="search"]:focus {
    background: #333;
    border-color: #888;
}

.header-search button {
    padding: .4rem .8rem;
    background: #3366cc;
    border: 1px solid #2a55aa;
    border-radius: 0 2px 2px 0;
    color: #fff;
    cursor: pointer;
    font-size: .8rem;
    white-space: nowrap;
}
.header-search button:hover { background: #2255bb; }

/* Header nav links */
.header-nav {
    display: flex;
    gap: .8rem;
    margin-left: auto;
    font-size: .8rem;
}
.header-nav a {
    color: #ccd;
    padding: .2rem .4rem;
    border-radius: 2px;
}
.header-nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
#page-wrapper {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* Left sidebar */
#sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 1rem .6rem;
    border-right: 1px solid var(--color-border-light);
    min-height: calc(100vh - 48px);
    background: var(--color-surface);
}

.sidebar-portlet {
    margin-bottom: 1.2rem;
}

.sidebar-portlet h3 {
    font-size: .75rem;
    font-weight: bold;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--color-border-light);
    margin-bottom: .4rem;
}

.sidebar-portlet ul {
    list-style: none;
    padding: 0;
}
.sidebar-portlet ul li {
    padding: .15rem 0;
}
.sidebar-portlet ul li a {
    font-size: .8rem;
    color: var(--color-link);
}
.sidebar-portlet ul li a:hover { text-decoration: underline; }
.sidebar-portlet ul li a.active {
    font-weight: bold;
    color: var(--color-text);
}

/* Main content */
#content {
    flex: 1;
    background: var(--color-surface);
    padding: 1.2rem 1.6rem 2rem;
    min-width: 0;
    border-left: 1px solid var(--color-border-light);
}

/* ============================================================
   ARTICLE PAGE TABS (like Wikipedia)
   ============================================================ */
.page-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
    border-bottom: 1px solid var(--color-border);
}

.page-tab {
    padding: .4rem .9rem;
    font-size: .82rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    color: var(--color-link);
    cursor: pointer;
    text-decoration: none;
    margin-right: 2px;
    position: relative;
    top: 1px;
}
.page-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    border-bottom: 1px solid var(--color-surface);
    font-weight: bold;
}
.page-tab:hover { background: #e8e8e8; text-decoration: none; }

/* ============================================================
   ARTICLE CONTENT
   ============================================================ */
.article-title {
    font-family: var(--font-serif);
    font-size: 1.95rem;
    font-weight: normal;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: .3rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    line-height: 1.2;
}

.article-title small {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-style: italic;
    display: block;
    margin-top: .15rem;
}

.article-body h2 {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: normal;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: .2rem;
    margin: 1.5rem 0 .6rem;
    color: var(--color-text);
}

.article-body h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin: 1.1rem 0 .4rem;
    color: var(--color-text);
}

.article-body p {
    margin-bottom: .8rem;
    line-height: 1.65;
}

.article-body ul, .article-body ol {
    margin: .5rem 0 .8rem 1.8rem;
}
.article-body li { margin-bottom: .2rem; }

/* ============================================================
   INFOBOX
   ============================================================ */
.infobox {
    float: right;
    clear: right;
    margin: 0 0 1rem 1.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: .82rem;
    width: 270px;
    border-collapse: collapse;
    line-height: 1.4;
}

.infobox caption,
.infobox-title {
    background: var(--color-infobox-header);
    text-align: center;
    font-weight: bold;
    padding: .4rem .6rem;
    font-size: .88rem;
    border-bottom: 1px solid var(--color-border);
    display: block;
}

.infobox-image {
    text-align: center;
    padding: .4rem;
    border-bottom: 1px solid var(--color-border-light);
}

.infobox-image img {
    max-width: 100%;
    max-height: 200px;
    object-fit: cover;
}

.infobox-image-placeholder {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #e8eef4 0%, #d0dce8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #778;
    font-size: 2rem;
}

.infobox-image-placeholder span {
    font-size: .7rem;
    margin-top: .3rem;
    color: #99a;
}

.infobox table {
    width: 100%;
    border-collapse: collapse;
}

.infobox tr td {
    padding: .3rem .5rem;
    border-top: 1px solid var(--color-border-light);
    vertical-align: top;
}

.infobox tr td:first-child {
    font-weight: bold;
    width: 42%;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */
.toc {
    background: var(--color-toc-bg);
    border: 1px solid var(--color-border);
    padding: .6rem .8rem;
    display: inline-block;
    min-width: 200px;
    max-width: 380px;
    margin: .5rem 0 1rem;
    font-size: .85rem;
}

.toc-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: .4rem;
}

.toc ol {
    margin: 0;
    padding-left: 1.6rem;
}
.toc li { padding: .1rem 0; }
.toc a { color: var(--color-link); }

/* ============================================================
   CATEGORIES (bottom of article)
   ============================================================ */
.article-categories {
    margin-top: 1.5rem;
    padding: .5rem .7rem;
    border: 1px solid var(--color-border);
    border-left: 4px solid #36c;
    background: var(--color-toc-bg);
    font-size: .82rem;
}

.article-categories strong {
    margin-right: .4rem;
}

.article-categories a {
    margin-right: .5rem;
    color: var(--color-link);
}

/* ============================================================
   MAIN / FRONT PAGE
   ============================================================ */
.main-page-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-top: .5rem;
}

.main-box {
    border: 1px solid var(--color-border);
}

.main-box-header {
    background: var(--color-infobox-header);
    padding: .4rem .8rem;
    font-weight: bold;
    font-family: var(--font-serif);
    font-size: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.main-box-body {
    padding: .7rem .8rem;
    font-size: .88rem;
}

.main-box-body p { margin-bottom: .5rem; }

/* Featured article on main page */
.featured-article {
    border: 1px solid var(--color-border);
    margin-bottom: 1.2rem;
}

.featured-article-header {
    background: #cee0f2;
    padding: .4rem .8rem;
    font-weight: bold;
    font-family: var(--font-serif);
    font-size: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.featured-article-body {
    padding: .7rem .8rem;
    display: flex;
    gap: 1rem;
}

.featured-article-image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    background: linear-gradient(135deg, #e8eef4, #cde);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 1px solid var(--color-border-light);
}

.featured-article-text { flex: 1; font-size: .88rem; }
.featured-article-text h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: .3rem;
}
.featured-article-text h3 a { color: var(--color-text); }
.featured-article-text h3 a:hover { text-decoration: underline; }

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 1px;
    margin: .8rem 0;
    border: 1px solid var(--color-border);
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: .6rem .4rem;
    background: var(--color-toc-bg);
    border-right: 1px solid var(--color-border-light);
    font-size: .8rem;
}
.stat-item:last-child { border-right: none; }
.stat-item .stat-number {
    font-size: 1.4rem;
    font-weight: bold;
    color: #3366cc;
    display: block;
}
.stat-item .stat-label { color: var(--color-text-muted); }

/* ============================================================
   ARTICLE LIST / SEARCH RESULTS
   ============================================================ */
.article-list { list-style: none; padding: 0; }
.article-list-item {
    padding: .6rem 0;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: flex-start;
    gap: .8rem;
}
.article-list-item:last-child { border-bottom: none; }

.article-list-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #eaf0f8, #d0dce8);
    border: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.article-list-info { flex: 1; }
.article-list-info h4 {
    font-family: var(--font-serif);
    font-size: 1rem;
    margin-bottom: .15rem;
}
.article-list-info h4 a { color: var(--color-link); }
.article-list-info p {
    font-size: .82rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.article-list-meta {
    font-size: .78rem;
    color: #999;
    margin-top: .2rem;
}

/* Tag badges */
.tag-badge {
    display: inline-block;
    background: var(--color-highlight);
    border: 1px solid #b8d4f0;
    color: #3366cc;
    font-size: .72rem;
    padding: .05rem .4rem;
    border-radius: 2px;
    margin: .1rem .1rem 0 0;
    text-decoration: none;
}
.tag-badge:hover { background: #d4e8fc; text-decoration: none; }
.tag-badge:visited { color: #3366cc; }

/* ============================================================
   PREFECTURE GRID
   ============================================================ */
.prefecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .5rem;
    margin-top: .6rem;
}

.prefecture-card {
    border: 1px solid var(--color-border);
    padding: .5rem .6rem;
    text-align: center;
    background: var(--color-surface);
    text-decoration: none;
    color: var(--color-text);
    font-size: .85rem;
    transition: background .15s;
}
.prefecture-card:hover {
    background: var(--color-highlight);
    text-decoration: none;
    color: var(--color-text);
}
.prefecture-card .pref-name-ja {
    display: block;
    font-size: 1rem;
    margin-bottom: .1rem;
}
.prefecture-card .pref-count {
    font-size: .72rem;
    color: var(--color-text-muted);
}

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: .6rem;
    margin-bottom: 1rem;
}

.search-count {
    font-size: .85rem;
    color: var(--color-text-muted);
    margin-top: .3rem;
}

/* ============================================================
   NOTICES / HATNOTES
   ============================================================ */
.hatnote {
    font-style: italic;
    font-size: .88rem;
    color: var(--color-text-muted);
    padding: .2rem 0 .5rem .6rem;
    border-left: 3px solid var(--color-border);
    margin-bottom: .8rem;
}

.notice-box {
    background: #eaf3fb;
    border: 1px solid #a2c5e8;
    padding: .5rem .8rem;
    margin-bottom: .8rem;
    font-size: .85rem;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}
.notice-box .notice-icon { flex-shrink: 0; font-size: 1.1rem; }

/* ============================================================
   MAP LINK
   ============================================================ */
.map-link {
    font-size: .8rem;
    color: #3366cc;
}
.map-link::before { content: '🗺 '; }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-header {
    background: #2c3e50;
    color: #fff;
    padding: .6rem 1rem;
    margin: -1.2rem -1.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.admin-header h1 { font-size: 1rem; font-weight: bold; }
.admin-header nav a { color: #adc; font-size: .82rem; margin-right: .8rem; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.admin-table th {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: .4rem .6rem;
    text-align: left;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
}
.admin-table td {
    border: 1px solid var(--color-border-light);
    padding: .4rem .6rem;
    vertical-align: top;
}
.admin-table tr:hover td { background: var(--color-toc-bg); }

.btn {
    display: inline-block;
    padding: .3rem .7rem;
    border-radius: 2px;
    border: 1px solid;
    font-size: .8rem;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
}
.btn-primary {
    background: #3366cc;
    border-color: #2a55aa;
    color: #fff;
}
.btn-primary:hover { background: #2255bb; color: #fff; text-decoration: none; }

.btn-danger {
    background: #d33;
    border-color: #b00;
    color: #fff;
}
.btn-danger:hover { background: #b00; color: #fff; text-decoration: none; }

.btn-secondary {
    background: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn-secondary:hover { background: #e8e8e8; text-decoration: none; color: var(--color-text); }

/* Forms */
.form-group { margin-bottom: .9rem; }
.form-group label {
    display: block;
    font-weight: bold;
    font-size: .82rem;
    margin-bottom: .25rem;
    color: var(--color-text-muted);
}
.form-group input[type=text],
.form-group input[type=url],
.form-group input[type=number],
.form-group input[type=tel],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .35rem .5rem;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    font-size: .88rem;
    font-family: var(--font-sans);
    background: #fff;
    color: var(--color-text);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 2px rgba(51,102,204,.15);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}
.form-grid .full-width { grid-column: 1 / -1; }

/* ============================================================
   FOOTER
   ============================================================ */
#site-footer {
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
    padding: 1rem;
    font-size: .78rem;
    color: var(--color-text-muted);
    text-align: center;
}
#site-footer a { color: var(--color-text-muted); }
#site-footer a:hover { color: var(--color-link); }
#site-footer .footer-links { margin-bottom: .4rem; }
#site-footer .footer-links a { margin: 0 .5rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
    #sidebar { display: none; }
    #content { border-left: none; }
    .infobox { float: none; width: 100%; margin: 0 0 1rem; }
    .main-page-columns { grid-template-columns: 1fr; }
    .header-nav { display: none; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .header-inner { flex-wrap: wrap; }
    .header-search { width: 100%; max-width: none; order: 3; }
    .article-title { font-size: 1.5rem; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.clearfix::after { content: ''; display: table; clear: both; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.divider {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: 1rem 0;
}

