/*
Theme Name: SoccerJP
Description: A text-first news theme for soccer.jp.net. Built for a feed that reads equally well with no images, with repeating images and in any mix of the two.
Version: 1.9.7
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: soccerjp
*/

/* ---------------------------------------------------------------- tokens */

:root {
  --bg:        #ffffff;
  --bg-soft:   #f7f8fa;
  --text:      #16191d;
  --muted:     #667080;
  --border:    #e4e7ec;
  --accent:    #16407a;
  --link:      #16407a;

  --cat-j-league:         #1d4ed8;
  --cat-national-team:    #be123c;
  --cat-overseas-players: #0f766e;
  --cat-transfers:        #b45309;
  --cat-womens-football:  #a21caf;
  --cat-columns:          #6d28d9;
  --cat-world-football:   #15803d;
  --cat-other:            #4b5563;

  /* Japanese text needs more leading than Latin. */
  --lh-body:  1.9;
  --lh-title: 1.55;

  --wrap:    1280px;
  --content: 1fr;
  --aside:   320px;
  --gap:     40px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #14161a;
    --bg-soft: #1a1d22;
    --text:    #e6e8ea;
    --muted:   #98a1ad;
    --border:  #2a2f36;
    --accent:  #7aa5e8;
    --link:    #8fb4ee;

    --cat-j-league:         #6f9bff;
    --cat-national-team:    #f2718f;
    --cat-overseas-players: #4fbfb2;
    --cat-transfers:        #e0a355;
    --cat-womens-football:  #dd7ae8;
    --cat-columns:          #a98bf0;
    --cat-world-football:   #5cbd7a;
    --cat-other:            #9aa3ad;
  }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* System Japanese stack: native OS faces first, web fallback after. */
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
               "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: var(--lh-body);
  /* Strict line breaking for Japanese: never break before 、 or 。 */
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* No italics for Japanese: there is no oblique face, so the browser fakes an ugly slant. */
i, em, cite, dfn { font-style: normal; font-weight: 600; }

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

img { max-width: 100%; height: auto; display: block; }

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

.skip-link {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: 8px 14px;
}
.skip-link:focus { left: 8px; top: 8px; z-index: 100; }

/* ---------------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}

.site-header__bar {
  display: flex; align-items: baseline; gap: 14px;
  padding: 12px 16px; max-width: var(--wrap); margin: 0 auto;
}

/* One class for both the h1 on the front page and the p elsewhere — sizes
   are set explicitly, so both variants look identical. */
.site-title {
  margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25;
  letter-spacing: .01em;
}
.site-title a { color: var(--text); }
.site-title a:hover { text-decoration: none; color: var(--accent); }
.site-desc { font-size: 12px; color: var(--muted); margin: 0; }

.cat-nav {
  border-top: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }

.cat-nav__list {
  display: flex; gap: 2px; list-style: none;
  margin: 0 auto; padding: 0 16px;
  max-width: var(--wrap);
}
.cat-nav__list a {
  display: block; white-space: nowrap;
  padding: 9px 11px; font-size: 13px; font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.cat-nav__list a:hover { color: var(--text); text-decoration: none; }
.cat-nav__list .is-current a { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- feed */

.feed { list-style: none; margin: 0; padding: 0; }

.feed-item {
  display: grid;
  grid-template-columns: 1fr;          /* no picture — just text */
  gap: 0 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

/* The thumbnail column appears only when there is a picture. There is
   deliberately no placeholder: a row without a picture must look finished
   rather than broken. */
.feed-item.has-thumb { grid-template-columns: 96px 1fr; }

.feed-item__thumb {
  grid-row: 1 / span 3;
  border-radius: 4px; overflow: hidden;
  background: var(--bg-soft);
  aspect-ratio: 16 / 9;
}
.feed-item__thumb img { width: 100%; height: 100%; object-fit: cover; }

.feed-item__meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; line-height: 1.4; margin-bottom: 3px;
}

.feed-item__cat { font-weight: 700; color: var(--cat-other); }
.feed-item__time { color: var(--muted); font-variant-numeric: tabular-nums; }

.feed-item__title {
  margin: 0; font-size: 16.5px; font-weight: 700;
  line-height: var(--lh-title);
}
.feed-item__title a { color: var(--text); }

.feed-item__excerpt {
  margin: 4px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--muted);
}

/* category colours */
.cat-j-league         { color: var(--cat-j-league); }
.cat-national-team    { color: var(--cat-national-team); }
.cat-overseas-players { color: var(--cat-overseas-players); }
.cat-transfers        { color: var(--cat-transfers); }
.cat-womens-football  { color: var(--cat-womens-football); }
.cat-columns          { color: var(--cat-columns); }
.cat-world-football   { color: var(--cat-world-football); }
.cat-other            { color: var(--cat-other); }

/* ---------------------------------------------------------------- section heading */

.page-head { padding: 22px 0 6px; }
.page-head__title { margin: 0; font-size: 21px; font-weight: 700; }
.page-head__desc { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------- article */

.entry { padding: 24px 0 8px; }

.entry__meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; margin-bottom: 10px;
}
.entry__cat { font-weight: 700; }
.entry__date { color: var(--muted); font-variant-numeric: tabular-nums; }

.entry__title {
  margin: 0 0 14px; font-size: 25px; font-weight: 700;
  line-height: 1.45; letter-spacing: .01em;
}

.entry__thumb { margin: 0 0 20px; border-radius: 6px; overflow: hidden; }

.entry__body { font-size: 16.5px; }
.entry__body p { margin: 0 0 1.5em; }
.entry__body a { text-decoration: underline; }

.entry__source {
  margin: 26px 0 0; padding: 12px 14px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; color: var(--muted);
}
.entry__source a { word-break: break-all; }

.site-footer__nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.site-footer__nav ul { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; }
.site-footer__nav a { color: var(--muted); text-decoration: underline; }
.site-footer__nav a:hover { color: var(--text); }

/* ---------------------------------------------------------------- navigation */

.pagination {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 22px 0 40px; font-size: 14px;
}
.pagination .page-numbers {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 4px;
  color: var(--muted);
}
.pagination .page-numbers.current {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700;
}
.pagination a.page-numbers:hover { color: var(--text); text-decoration: none; }

/* ---------------------------------------------------------------- misc */

.searchform { display: flex; gap: 6px; margin: 16px 0; }
.searchform input[type="search"] {
  flex: 1; padding: 9px 11px; font: inherit; font-size: 15px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
}
.searchform button {
  padding: 9px 16px; font: inherit; font-size: 14px; font-weight: 600;
  border: 0; border-radius: 4px; background: var(--accent); color: #fff; cursor: pointer;
}

.notice-empty { padding: 40px 0; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 30px; padding: 22px 0 34px;
  font-size: 12.5px; color: var(--muted);
}
.site-footer p { margin: 0 0 6px; }

/* ---------------------------------------------------------------- narrow screen */

@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .feed-item.has-thumb { grid-template-columns: 78px 1fr; }
  .feed-item__title { font-size: 15.5px; }
  .entry__title { font-size: 21px; }
  .entry__body { font-size: 16px; }
}

/* ---------------------------------------------------------------- layout with sidebar */

.layout {
  display: grid;
  grid-template-columns: minmax(0, var(--content)) var(--aside);
  gap: var(--gap);
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
  align-items: start;
}
.layout__main { min-width: 0; }   /* without this long words stretch the column */

.sidebar { position: sticky; top: 76px; }

.widget { margin-bottom: 26px; }
.widget__title {
  margin: 0 0 10px; font-size: 14px; font-weight: 700;
  padding-bottom: 7px; border-bottom: 2px solid var(--accent);
}

.widget-list { list-style: none; margin: 0; padding: 0; }

.widget-item {
  display: flex; gap: 9px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.widget-item:last-child { border-bottom: 0; }
.widget-item__badge {
  flex: 0 0 20px; height: 20px; border-radius: 3px;
  background: var(--bg-soft); color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.widget-list--ranked .widget-item:nth-child(-n+3) .widget-item__badge {
  background: var(--accent); color: #fff;
}
.widget-item__body { min-width: 0; }
.widget-item__meta {
  display: flex; gap: 7px; align-items: center;
  font-size: 11px; line-height: 1.3; margin-bottom: 2px;
}
.widget-item__meta time { color: var(--muted); font-variant-numeric: tabular-nums; }
.widget-item a { font-size: 13px; line-height: 1.6; font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- front page: hero cards */

.hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  padding: 22px 0 4px;
}
.hero-item {
  min-width: 0; padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.hero-item__thumb {
  display: block; margin-bottom: 10px;
  border-radius: 5px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-soft);
}
.hero-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-item__meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 12px; font-weight: 700; margin-bottom: 4px;
}
.hero-item__meta time { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.hero-item__title { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.5; }
.hero-item__title a { color: var(--text); }
.hero-item__excerpt {
  margin: 6px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--muted);
}

/* ---------------------------------------------------------------- category blocks */

.cat-block { padding: 20px 0 4px; }
.cat-block__title {
  margin: 0 0 4px; font-size: 16px; font-weight: 700;
  padding-bottom: 7px; border-bottom: 2px solid currentColor;
}
.cat-block__title a { color: inherit; }
.cat-block__more { margin: 10px 0 0; font-size: 13px; }

.feed-item__views { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- narrow screen */

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .sidebar { position: static; }
  .hero { grid-template-columns: 1fr; gap: 16px; }
  .hero-item__title { font-size: 17px; }
}
/* ---------------------------------------------------------------- category blocks in two columns */

/* A category block spans the full width while its teasers sit in two columns. */
.cat-grid .cat-block { min-width: 0; }
.cat-block .feed {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px;
}
.cat-block .feed .feed-item { min-width: 0; }

/* ---------------------------------------------------------------- related posts */

.related { margin-top: 30px; padding-top: 4px; border-top: 1px solid var(--border); }
.related__title {
  margin: 18px 0 2px; font-size: 15px; font-weight: 700;
  padding-bottom: 7px; border-bottom: 2px solid var(--accent);
}

@media (max-width: 980px) {
  .cat-block .feed { grid-template-columns: 1fr; gap: 0; }
}


/* ---------------------------------------------------------------- burger menu */

.nav-toggle {
  display: none; margin-left: 2px;
  width: 38px; height: 38px; padding: 0;
  background: none; border: 0; cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 20px; height: 2px; background: var(--text);
  border-radius: 2px; transition: transform .15s ease, opacity .15s ease;
}
.nav-toggle__bars { position: relative; margin: 0 auto; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top:  6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .site-header__bar { align-items: center; }

  /* The menu is hidden until tapped. If the script failed to load the
     button simply does nothing, so navigation is kept reachable through
     :focus-within — a keyboard can still get to it. */
  .cat-nav { display: none; }
  .cat-nav.is-open, .cat-nav:focus-within { display: block; }

  .cat-nav__list { flex-direction: column; padding: 4px 16px 10px; }
  .cat-nav__list a {
    padding: 10px 2px; font-size: 15px;
    border-bottom: 1px solid var(--border); border-left: 2px solid transparent;
  }
  .cat-nav__list .is-current a { border-bottom-color: var(--border); border-left-color: var(--accent); padding-left: 8px; }
}

/* ---------------------------------------------------------------- static page */

.entry__updated {
  margin: -6px 0 20px; font-size: 12.5px; color: var(--muted);
}
.entry__updated time { font-variant-numeric: tabular-nums; }

/* The legal pages are mostly subheadings and need their own rhythm,
   otherwise h2 blends into the paragraphs. */
.entry__body h2 {
  margin: 1.8em 0 .6em; font-size: 17px; font-weight: 700;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.entry__body h2:first-child { margin-top: 0; }
.entry__body ul, .entry__body ol { margin: 0 0 1.5em; padding-left: 1.6em; }
.entry__body li { margin-bottom: .4em; }


/* ---------------------------------------------------------------- social links in the header */

.site-social {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto;
}
.site-social a {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 5px;
  color: var(--muted);
}
.site-social a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.site-social a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-social svg { display: block; }

@media (max-width: 600px) {
  .site-title { font-size: 20px; }
  .site-desc { display: none; }   /* in a narrow header the tagline pushes the icons out */
  .site-social { gap: 6px; }
  .site-social a { width: 28px; height: 28px; }
}

/* ---------------------------------------------------------------- author box */

.author-box {
  margin-top: 26px; padding: 16px 18px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px;
  display: flex; gap: 14px; align-items: flex-start;
}
/* The box stays flex even without a picture: the single child simply takes
   the full width, so no extra rule is needed. */
.author-box__avatar { flex: 0 0 auto; line-height: 0; }
.author-box__avatar img {
  display: block; width: 64px; height: 64px;
  border-radius: 50%; object-fit: cover;
}
.author-box__text { min-width: 0; }
.author-box__name { margin: 0; font-size: 15px; font-weight: 700; }
.author-box__name a { color: var(--text); }
.author-box__bio {
  margin: 6px 0 0; font-size: 13px; line-height: 1.8; color: var(--muted);
}
.author-box__more { margin: 8px 0 0; font-size: 13px; }

/* ---------------------------------------------------------------- related posts in three columns */

.related__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px;
}

@media (max-width: 1100px) {
  .related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .related__grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ------------------------------------------------- related: picture on top */

/* In a ~290 px column a row with the thumbnail on the left leaves the title
   less than two thirds of the width and it wraps onto four lines. A card with
   the picture above the title reads noticeably better at that width. */
.related__grid .feed-item.has-thumb { grid-template-columns: minmax(0, 1fr); }
.related__grid .feed-item__thumb { grid-row: auto; margin-bottom: 9px; }
.related__grid .feed-item__title { font-size: 15.5px; }

/* --------------------------------------------------------- author page head */

.page-head--author { display: flex; gap: 16px; align-items: flex-start; }
.page-head__avatar { flex: 0 0 auto; line-height: 0; }
.page-head__avatar img {
  display: block; width: 76px; height: 76px;
  border-radius: 50%; object-fit: cover;
}
.page-head__text { min-width: 0; }

/* ---------------------------------------------------------------- comments */

.comments { margin-top: 34px; }
.comments__title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; font-size: 18px;
}
.comments__count {
  padding: 0 8px; font-size: 12.5px; line-height: 1.7; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.comments__closed { font-size: 13px; color: var(--muted); }

.comments__list,
.comments__list .children { list-style: none; margin: 0; padding: 0; }
.comments__list .children {
  margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--border);
}
.comments__list .comment-body { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comments__list .comment-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px;
  margin-bottom: 6px; font-size: 13px;
}
.comments__list .comment-author { display: flex; align-items: center; gap: 8px; }
.comments__list .comment-author .avatar { width: 32px; height: 32px; border-radius: 50%; }
.comments__list .comment-author .fn { font-style: normal; font-weight: 700; }
/* The "says:" suffix after the name adds nothing in a comment list. */
.comments__list .says { display: none; }
.comments__list .comment-metadata { color: var(--muted); font-variant-numeric: tabular-nums; }
.comments__list .comment-metadata a { color: inherit; }
.comments__list .comment-content {
  font-size: 15px; line-height: 1.85; overflow-wrap: anywhere;
}
.comments__list .comment-content p { margin: 0 0 .8em; }
.comments__list .comment-content p:last-child { margin-bottom: 0; }
.comments__list .comment-awaiting-moderation {
  display: block; margin: 0 0 6px; font-size: 13px; color: var(--muted);
}
.comments__list .reply { margin-top: 6px; font-size: 13px; }

.comment-navigation .nav-links {
  display: flex; justify-content: space-between; gap: 12px;
  margin: 12px 0; font-size: 13px;
}

.comment-respond {
  margin-top: 20px; padding: 16px 18px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px;
}
.comment-reply-title { margin: 0 0 10px; font-size: 16px; }
.comment-reply-title small { margin-left: 10px; font-size: 13px; font-weight: 400; }
.comment-notes,
.logged-in-as { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.comment-form p { margin: 0 0 12px; }
.comment-form label { display: block; margin-bottom: 4px; font-size: 13px; }
.comment-form .required { color: #c0392b; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
  box-sizing: border-box; width: 100%; max-width: 100%; padding: 8px 10px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
}
.comment-form textarea { min-height: 140px; resize: vertical; }
.comment-form input:focus,
.comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment-form .comment-form-cookies-consent { display: flex; align-items: flex-start; gap: 8px; }
.comment-form .comment-form-cookies-consent input { margin-top: 5px; }
.comment-form .comment-form-cookies-consent label { display: inline; margin: 0; }
.comment-form .form-submit { margin: 0; }
/* Text takes the page background: dark on the light accent in dark mode,
   white on the dark accent in light mode. */
.comment-form .submit {
  padding: 9px 22px; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--bg); background: var(--accent);
  border: 0; border-radius: 5px; cursor: pointer;
}
.comment-form .submit:hover { opacity: .9; }

/* Honeypot: off-screen for people, still part of the form for bots. */
.sjp-hp {
  position: absolute !important; width: 1px; height: 1px; margin: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- share bar */

.share { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.share__label { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.share__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.share__btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1;
  color: #fff; border: 0; border-radius: 17px; cursor: pointer;
  text-decoration: none;
}
.share__btn:hover { opacity: .88; text-decoration: none; }
.share__btn svg { flex: 0 0 auto; fill: currentColor; }
/* Each network's own colour. */
.share__btn--x        { background: #000; }
.share__btn--line     { background: #06c755; }
.share__btn--facebook { background: #1877f2; }
.share__btn--copy,
.share__btn--native {
  color: var(--text); background: var(--bg-soft); border: 1px solid var(--border);
}
/* A black button disappears on the dark background: invert it there. */
@media (prefers-color-scheme: dark) {
  .share__btn--x { color: #000; background: #fff; }
}
