/* ============================================================
   CalendarTool — style.css
   Design: minimal, fast, accessible, multilingual-ready
   ============================================================ */

/* ── Variables ── */
:root {
  --c-primary:      #1a56db;
  --c-primary-dark: #1e40af;
  --c-primary-light:#eff6ff;
  --c-success:      #059669;
  --c-success-bg:   #dcfce7;
  --c-danger:       #dc2626;
  --c-danger-bg:    #fee2e2;
  --c-warning:      #d97706;
  --c-warning-bg:   #fef3c7;
  --c-neutral:      #6b7280;
  --c-neutral-bg:   #f3f4f6;

  --c-bg:           #ffffff;
  --c-bg-alt:       #f9fafb;
  --c-text:         #111827;
  --c-text-muted:   #6b7280;
  --c-border:       #e5e7eb;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);

  --max-w: 1100px;
  --content-w: 780px;
  --gap: 1.5rem;
}

/* ── CJK font override ── */
:lang(ja), :lang(ja-JP) { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", var(--font-sans); }
:lang(zh-TW), :lang(zh-HK) { font-family: "PingFang TC", "Noto Sans TC", var(--font-sans); }
:lang(zh-CN) { font-family: "PingFang SC", "Noto Sans SC", var(--font-sans); }
:lang(ko), :lang(ko-KR) { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", var(--font-sans); }
:lang(ar), :lang(ur), :lang(he) { font-family: "Noto Sans Arabic", "Arabic Typesetting", var(--font-sans); }
:lang(th) { font-family: "Sarabun", "Noto Sans Thai", var(--font-sans); }
:lang(bn) { font-family: "Noto Sans Bengali", var(--font-sans); }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
}

img, svg { max-width: 100%; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 2px; }

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--c-primary);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: .875rem;
  z-index: 100;
}
.skip-link:focus { top: 0; }

/* ── Site Header ── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--c-text);
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--c-primary); }
.logo-icon { color: var(--c-primary); flex-shrink: 0; }

.header-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-list {
  display: flex;
  list-style: none;
  gap: .25rem;
  white-space: nowrap;
}
.nav-link {
  display: inline-block;
  padding: .25rem .625rem;
  border-radius: var(--radius-sm);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--c-text-muted);
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--c-bg-alt); color: var(--c-primary); text-decoration: none; }

/* ── Breadcrumb ── */
.breadcrumb-nav {
  padding-block: .625rem;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-alt);
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--c-text-muted);
}
.breadcrumb-link { color: var(--c-primary); }
.breadcrumb-sep { color: var(--c-border); user-select: none; }
[aria-current="page"] { color: var(--c-text); font-weight: 500; }

/* ── Main ── */
main { padding-block: 2rem 3rem; }

/* ── Tool Page ── */
.tool-header {
  padding-block: 1.5rem 1rem;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 1.5rem;
}

.tool-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
}

.tool-lead {
  margin-top: .5rem;
  font-size: 1.0625rem;
  color: var(--c-text-muted);
  max-width: 65ch;
}

.tool-meta {
  margin-top: .625rem;
  font-size: .8125rem;
  color: var(--c-text-muted);
}

/* ── Tool Widget Area ── */
.tool-widget {
  background: var(--c-primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-block: 1.5rem;
}

.tool-widget-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem;
  text-align: center;
  color: var(--c-text-muted);
  border: 2px dashed #93c5fd;
  border-radius: var(--radius);
  background: rgba(255,255,255,.6);
}
.tool-widget-placeholder svg { opacity: .4; }
.tool-widget-placeholder strong { font-size: 1rem; color: var(--c-primary-dark); }

/* Today Status Badge */
.status-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.status-date { font-size: .875rem; color: var(--c-text-muted); }
.status-badge {
  padding: .25rem .875rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .875rem;
}
.status-badge--holiday  { background: var(--c-success-bg); color: #065f46; }
.status-badge--workday  { background: var(--c-neutral-bg); color: #374151; }

/* Countdown */
.countdown {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.countdown-unit { text-align: center; min-width: 3rem; }
.countdown-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
}
.countdown-label {
  display: block;
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
  margin-top: .25rem;
}

/* Converter Input */
.converter-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .75rem;
  align-items: end;
  background: #fff;
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.converter-swap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .5rem;
  color: var(--c-primary);
  cursor: pointer;
  font-size: 1.25rem;
}
.field-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .25rem;
}
.field-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
}
.field-input:focus { outline: 2px solid var(--c-primary); border-color: var(--c-primary); }
.btn-convert {
  display: block;
  width: 100%;
  margin-top: .75rem;
  padding: .625rem 1.25rem;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-convert:hover { background: var(--c-primary-dark); }

/* ── Section Titles ── */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--c-primary-light);
}

/* ── Data Table ── */
.data-section { margin-block: 2rem; }

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.data-table thead { background: var(--c-bg-alt); }
.data-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--c-bg-alt); }
.data-table tr.is-today { background: var(--c-warning-bg) !important; font-weight: 600; }
.data-table tr.is-holiday td:first-child { border-left: 3px solid var(--c-success); }

.holiday-type {
  display: inline-flex;
  align-items: center;
  padding: .125rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}
.holiday-type--national { background: var(--c-success-bg); color: #065f46; }
.holiday-type--bank     { background: #dbeafe; color: #1e40af; }
.holiday-type--optional { background: var(--c-neutral-bg); color: #374151; }

/* ── About Section ── */
.about-section {
  margin-block: 2rem;
  padding: 1.5rem;
  background: var(--c-bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
}
.about-section h2 { margin-bottom: .75rem; }
.about-section p { color: var(--c-text-muted); margin-bottom: .75rem; }
.about-section p:last-child { margin-bottom: 0; }

/* ── FAQ ── */
.faq-section { margin-block: 2rem; }

.faq-list { list-style: none; }
.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #fff;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--c-text);
  font-family: inherit;
  gap: .75rem;
}
.faq-question:hover { background: var(--c-bg-alt); }
.faq-chevron {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--c-text-muted);
  transition: transform .2s;
}
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--c-text-muted);
  font-size: .9375rem;
  line-height: 1.7;
}
.faq-answer p { margin-bottom: .5rem; }
.faq-answer p:last-child { margin-bottom: 0; }

/* ── Related Tools ── */
.related-section {
  margin-block: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  list-style: none;
  margin-top: 1rem;
}
.related-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.related-card:hover { box-shadow: var(--shadow-md); border-color: var(--c-primary); }
.related-link {
  display: block;
  padding: .875rem 1rem;
  text-decoration: none;
  color: var(--c-text);
}
.related-lang {
  display: block;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
  margin-bottom: .25rem;
}
.related-name {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}

/* ── Homepage ── */
.home-hero {
  padding-block: 3rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--c-primary-light) 0%, #fff 100%);
  border-bottom: 1px solid var(--c-border);
}
.home-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--c-text);
  margin-bottom: .75rem;
}
.home-hero p {
  font-size: 1.0625rem;
  color: var(--c-text-muted);
  max-width: 55ch;
  margin-inline: auto;
}

.home-content { padding-block: 2.5rem; }

.home-intro { margin-bottom: 2rem; }
.home-intro p { color: var(--c-text-muted); line-height: 1.75; margin-bottom: .75rem; }
.home-intro p:last-child { margin-bottom: 0; }

.phase-block { margin-bottom: 2.5rem; }
.phase-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-primary);
  border-left: 3px solid var(--c-primary);
  padding-left: .625rem;
  margin-bottom: 1rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  list-style: none;
}
.tool-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s, transform .1s;
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--c-primary);
  transform: translateY(-1px);
}
.tool-card-link {
  display: block;
  padding: 1.125rem 1.25rem;
  text-decoration: none;
  color: var(--c-text);
}
.tool-card-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .375rem;
}
.tool-card-lang {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  padding: .125rem .5rem;
  border-radius: 999px;
}
.tool-card-d {
  font-size: .6875rem;
  color: var(--c-text-muted);
  background: var(--c-neutral-bg);
  padding: .125rem .5rem;
  border-radius: 999px;
}
.tool-card h3 {
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: .25rem;
}
.tool-card-kw {
  font-size: .75rem;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Utility ── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.placeholder-box {
  padding: 2.5rem;
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--c-text-muted);
  background: var(--c-bg-alt);
}
.placeholder-box p { margin-bottom: .5rem; font-size: .9375rem; }

/* ── Footer ── */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-alt);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-block: 2.5rem;
}

.footer-logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--c-text);
  display: block;
  margin-bottom: .5rem;
}
.footer-desc { font-size: .875rem; color: var(--c-text-muted); line-height: 1.6; }

.footer-nav-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-muted);
  margin-bottom: .75rem;
}
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: .375rem; }
.footer-nav a { font-size: .875rem; color: var(--c-text-muted); }
.footer-nav a:hover { color: var(--c-primary); }

.footer-bottom {
  border-top: 1px solid var(--c-border);
  padding-block: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: space-between;
  align-items: center;
}
.footer-copy, .footer-accuracy { font-size: .8125rem; color: var(--c-text-muted); }

/* ── RTL overrides ── */
[dir="rtl"] .breadcrumb-list { flex-direction: row-reverse; }
[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td { text-align: right; }
[dir="rtl"] .tool-lead { text-align: right; }
[dir="rtl"] .footer-inner { direction: rtl; }
[dir="rtl"] .header-inner { flex-direction: row-reverse; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .converter-form { grid-template-columns: 1fr; }
  .converter-swap { transform: rotate(90deg); }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .tools-grid, .related-grid { grid-template-columns: 1fr; }
  .home-hero { padding-block: 2rem 1.5rem; }
  .nav-list { gap: 0; }
  .nav-link { padding: .25rem .375rem; }
}

/* ── FAQ collapse behaviour ── */
.faq-answer { display: none; }
.faq-item[open] .faq-answer { display: block; }

/* ── Button variants ── */
.btn-outline {
  display: inline-block;
  padding: .5rem 1.25rem;
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.btn-outline:hover { background: var(--c-primary-light); }

/* ── Static content pages (About, Contact, Privacy, Terms) ── */
.content-page { padding-block: 2rem 4rem; }
.page-header { margin-bottom: 2rem; border-bottom: 2px solid var(--c-border); padding-bottom: 1rem; }
.page-title { font-size: 2rem; font-weight: 900; color: var(--c-text); margin: 0 0 .5rem; }
.page-body { max-width: 820px; }
.page-body h2 { font-size: 1.375rem; font-weight: 700; margin: 2rem 0 .75rem; color: var(--c-text); }
.page-body h3 { font-size: 1.0625rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.page-body p { line-height: 1.8; margin-bottom: 1rem; }
.page-body ul, .page-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.page-body li { line-height: 1.75; margin-bottom: .35rem; }
.page-body a { color: var(--c-primary); text-decoration: underline; }
.page-body a:hover { text-decoration: none; }
.page-body code { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 3px; padding: .1em .35em; font-size: .875em; }
.page-body table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.page-body table th, .page-body table td { padding: .5rem .75rem; border: 1px solid var(--c-border); font-size: .9375rem; text-align: left; }
.page-body table th { background: var(--c-primary-light); font-weight: 700; }
.page-body table tr:nth-child(even) { background: #f9fafb; }
@media (max-width: 768px) {
  .page-title { font-size: 1.5rem; }
  .page-body table { font-size: .8125rem; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ── Holiday Year Statistics ── */
.hol-stats { margin-bottom: 1.5rem; }

.hstat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: .75rem;
}

.hstat-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-primary);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.hstat-card-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: .5rem;
}

.hstat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
  margin-bottom: .375rem;
}

.hstat-card-sub {
  font-size: .8125rem;
  color: var(--c-text-muted);
}

@media (max-width: 600px) {
  .hstat-grid { grid-template-columns: 1fr; }
}

/* ── Print ── */
@media print {
  .site-header, .site-footer, .related-section, .faq-section, .breadcrumb-nav { display: none; }
  .data-table { font-size: .8rem; }
  a::after { content: " (" attr(href) ")"; font-size: .75rem; }
}
