/* SPDX-License-Identifier: Apache-2.0 OR MIT */
/* Styled after the Digital Agency Design System (DADS):
   Noto Sans JP, Blue-900 primary, semantic Success/Error/Warning. */
:root {
  /* DADS Blue scale (primary) */
  --primary: #0017c1;        /* Blue-900 */
  --primary-hover: #0014a8;  /* Blue-1000-ish */
  --primary-bg: #f0f4ff;     /* Blue-50 tint */
  --primary-border: #b8c4ff;

  /* Neutral / text */
  --fg: #1a1a1c;             /* near-black text */
  --fg-soft: #42454d;
  --muted: #5c6068;
  --bg: #ffffff;
  --surface: #f4f6fb;        /* light neutral surface */
  --border: #d8dce3;
  --code-bg: #f0f2f6;

  /* Semantic */
  --success: #197a4b;
  --success-bg: #e6f4ec;
  --success-border: #aedcc1;
  --error: #c4002d;
  --error-bg: #fde8ec;
  --error-border: #f3bcc7;
  --warning: #9a5b00;
  --warning-bg: #fdf3e2;
  --warning-border: #f0d8a8;

  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  line-height: 1.7;
  font-size: 16px;
}
code, pre, .mono { font-family: "Noto Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: var(--code-bg); padding: .12em .4em; border-radius: 4px; font-size: .9em; }

.container { max-width: 840px; margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0 2rem;
}
.brand {
  font-weight: 700; color: var(--primary); letter-spacing: .02em;
  margin: 0 0 .4rem; font-size: .95rem; text-transform: lowercase;
}
.brand a { color: inherit; text-decoration: none; }
.brand a:hover { text-decoration: underline; }
.site-header h1 { margin: 0 0 .8rem; font-size: 2rem; line-height: 1.3; font-weight: 700; }
.lead { margin: 0; color: var(--fg-soft); font-size: 1.02rem; max-width: 64ch; }

/* Main sections */
main.container { padding-top: 2.2rem; padding-bottom: 1rem; }
.tool h2, .result h2 { font-size: 1.35rem; font-weight: 700; margin: 0 0 .6rem; }
.section-desc { color: var(--fg-soft); margin: 0 0 1.4rem; }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--primary-border); border-radius: var(--radius);
  padding: 2.2rem 1rem; text-align: center; cursor: pointer; background: var(--bg);
  transition: border-color .12s, background .12s; margin: 0 0 1rem;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-bg); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
.dz-icon { color: var(--primary); }
.dz-inner strong { font-size: 1.08rem; font-weight: 700; }
.dz-inner span { color: var(--muted); font-size: .92rem; }

ul.dropped { list-style: none; margin: 0 0 1.2rem; padding: 0; }
.drop-item {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .25rem;
  border-bottom: 1px solid var(--border);
}
.drop-name { font-weight: 500; }
.drop-label { color: var(--muted); font-size: .85rem; flex: 1; }
.drop-x {
  border: none; background: var(--surface); color: var(--muted); width: 26px; height: 26px;
  border-radius: 50%; cursor: pointer; font-size: 1.05rem; line-height: 1; flex: none;
}
.drop-x:hover { background: var(--error-bg); color: var(--error); }

/* Fields & options */
.field { margin: 1.2rem 0; }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; font-size: .95rem; }
.field small { display: block; color: var(--muted); margin-top: .3rem; font-size: .85rem; }
input[type="datetime-local"] {
  padding: .5rem .65rem; font-size: 1rem; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; background: var(--bg); color: var(--fg);
}
input[type="datetime-local"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

fieldset.opts {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin: 1.2rem 0; display: flex; flex-direction: column; gap: .7rem;
}
fieldset.opts legend { font-weight: 700; font-size: .9rem; padding: 0 .4rem; color: var(--fg-soft); }
.opt { display: flex; align-items: flex-start; gap: .55rem; font-size: .92rem; cursor: pointer; }
.opt input { width: 1.05rem; height: 1.05rem; margin-top: .25rem; flex: none; accent-color: var(--primary); }
.muted { color: var(--muted); font-size: .85rem; }

/* Buttons */
button.primary {
  background: var(--primary); color: #fff; border: none; padding: .65rem 1.6rem;
  font-size: 1rem; font-weight: 700; border-radius: 6px; cursor: pointer;
  font-family: inherit; transition: background .12s;
}
button.primary:hover:not(:disabled) { background: var(--primary-hover); }
button.primary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button.primary:disabled { background: #c4c8d0; color: #fff; cursor: not-allowed; }

.note {
  color: var(--muted); font-size: .88rem; line-height: 1.7;
  border-left: 3px solid var(--border); padding-left: .9rem; margin: 1.3rem 0 0;
}

/* About / technical-detail page */
.doc { padding: .5rem 0 1rem; }
.doc h2 { margin: 2rem 0 .6rem; font-size: 1.25rem; font-weight: 700; }
.doc h2:first-of-type { margin-top: 1rem; }
.doc p { margin: 0 0 .9rem; max-width: 70ch; }
.doc ul { margin: 0 0 .9rem; padding-left: 1.2rem; max-width: 70ch; }
.doc li { margin: 0 0 .5rem; }
.doc a { color: var(--primary); }

.fetch-summary:not(:empty) { margin: 0 0 1rem; font-size: .88rem; }
.fetch-line { font-weight: 700; }
.fetch-fail { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--warning); }
.fetch-fail code { background: var(--code-bg); font-size: .82em; }

/* Result */
.result {
  margin-top: 2.4rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.result.hidden { display: none; }
.verdict { font-size: 1.3rem; font-weight: 700; padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.1rem; border: 1px solid transparent; }
.verdict.pass { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.verdict.fail { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.verdict.indet { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.verdict .sub { display: block; font-size: .9rem; font-weight: 400; margin-top: .25rem; color: var(--fg-soft); }

/* Status chips */
.checks { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 1.3rem; }
.chip {
  display: inline-flex; align-items: baseline; gap: .4rem;
  padding: .32rem .75rem; border-radius: 999px; font-size: .85rem;
  border: 1px solid transparent;
}
.chip b { font-weight: 700; }
.chip span { opacity: .9; }
.chip.pass { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.chip.fail { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.chip.indet { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.chip.neutral { background: var(--surface); color: var(--fg-soft); border-color: var(--border); }

/* Certificate chain */
h3 { margin: 1.8rem 0 .7rem; font-size: 1.05rem; font-weight: 700; }
ol.chain { list-style: none; margin: 0; padding: 0; position: relative; }
.chain-step {
  border: 1px solid var(--border); border-left: 4px solid #c2cadb;
  border-radius: 6px; padding: .75rem .95rem; margin: 0 0 .6rem; background: var(--bg);
}
.chain-step.bridge { border-left-color: var(--primary); }
.chain-step:not(:last-child)::after {
  content: "↓"; display: block; text-align: center; color: var(--muted);
  margin: .3rem 0 -.3rem; font-size: .9rem;
}
.step-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.step-role {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface); color: var(--fg-soft); padding: .14rem .55rem; border-radius: 4px;
}
.step-dn { font-weight: 700; }
.bridge-tag {
  font-size: .72rem; color: var(--primary); background: var(--primary-bg);
  padding: .14rem .55rem; border-radius: 4px;
}
.step-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .4rem; }
.step-meta .chip { font-size: .78rem; padding: .22rem .58rem; }
.step-detail {
  display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .8rem;
}
.step-detail code { background: var(--code-bg); }

/* Disclosures */
.disc-weak {
  background: var(--warning-bg); color: var(--warning); padding: .55rem .85rem;
  border-radius: 6px; font-size: .85rem; margin-bottom: .75rem; border: 1px solid var(--warning-border);
}
dl.disclosures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .4rem .9rem; margin: 0;
}
dl.disclosures > div { display: flex; justify-content: space-between; gap: .6rem;
  border-bottom: 1px dotted var(--border); padding: .3rem 0; }
dl.disclosures dt { color: var(--muted); font-size: .82rem; }
dl.disclosures dd { margin: 0; font-size: .82rem; text-align: right; }

details#raw { margin-top: 1.8rem; }
details#raw summary { cursor: pointer; font-weight: 700; color: var(--primary); }

pre {
  background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow-x: auto;
  font-size: .82rem; line-height: 1.5; max-height: 60vh; margin-top: .6rem;
}
.status { color: var(--muted); font-size: .9rem; margin-top: 1.4rem; }
.status.error { color: var(--error); font-weight: 500; }

/* Footer */
.site-footer {
  margin-top: 3rem; padding: 2rem 0 3rem; background: var(--surface);
  border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem;
}
.site-footer p { margin: 0 0 .5rem; max-width: 64ch; }
.footer-meta { font-size: .82rem; }
.site-footer a { color: var(--primary); }
