/* FREEDOM v9 — service.html only: the 3 domain sections (集める / つくる / 導く) and the 7 service cards.
   Loaded after style.css and illust.css. Uses the role tokens of style.css only (var(--…)); no font metrics assumed.
   Structure per card:  name → catch → description  /  [こんな課題に] → [主な支援内容]
   The card is NOT a link: no hover lift, no pointer affordance. */

/* ---------- domain header: English title + 和文 + lead, the domain illustration on the right ---------- */
.svc-domain {
  --svc-max: 1360px;
  --svc-ill: clamp(104px, 17vw, 216px);
}
.svc-domain-head,
.svc-cards { max-width: var(--svc-max); }

.svc-domain-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--svc-ill);
  column-gap: clamp(16px, 4vw, 64px);
  align-items: end;
}
.svc-domain-head > :not(.svc-ill) { grid-column: 1; }
.svc-domain-head .sec-title { margin-bottom: 0; }
.svc-domain-head .domain-lead { margin-top: clamp(20px, 2.4vw, 32px); }
.svc-domain-head > .svc-ill {
  --ill-max: var(--svc-ill);
  --ill-paper: var(--paper);          /* point markers take the section surface */
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  justify-self: end;
}
@media (max-width: 767px) {             /* phone: illustration beside the English title only; the lead takes the full width */
  .svc-domain-head > .svc-ill { grid-row: 1; }
  .svc-domain-head > .domain-lead { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
  .svc-domain-head > .svc-ill { align-self: end; }
}

/* ---------- the list of cards ---------- */
/* Concept: 「不自由 = 曇り → 自由 = クリア」. Pale logo facets lie behind the group; each card is a frosted sheet
   over them (the facet hue bleeds through, so every card gets its own wash); inside, the problem panel is the
   recessed, hazy side and the support panel a solid sheet lying on top of it. Radii: 20px (card) / 12px (inner). */
.svc-cards {
  --r-card: 20px;
  --r-inner: 12px;
  --glass: rgb(255 255 255 / .64);
  position: relative;
  isolation: isolate;                 /* the facets sit behind the cards, inside this group only */
  display: grid;
  gap: clamp(20px, 2.6vw, 36px);
  margin-top: var(--head-gap);
}

/* the facets: same angular planes and hues as the logo / hero back layer, pale, behind the cards */
.svc-facets {
  position: absolute;
  z-index: -1;
  --fy: clamp(24px, 5vw, 72px);
  --fx: clamp(16px, 7vw, 120px);
  top: calc(var(--fy) * -1);
  left: calc(var(--fx) * -1);
  width: calc(100% + var(--fx) * 2);   /* explicit size: an <svg> with inset + auto keeps the viewBox ratio */
  height: calc(100% + var(--fy) * 2);
  max-width: none;
  pointer-events: none;
  overflow: visible;
}
/* strength of each plane (tuned so the hue reads through the glass; the HTML attributes are the no-CSS fallback) */
#attract .svc-fc--a { opacity: .55; }  #attract .svc-fc--b { opacity: .34; }  #attract .svc-fc--c { opacity: .44; }
#build .svc-fc--a   { opacity: .5; }   #build .svc-fc--b   { opacity: .58; }  #build .svc-fc--c   { opacity: .3; }
#guide .svc-fc--a   { opacity: .34; }  #guide .svc-fc--b   { opacity: .4; }   #guide .svc-fc--c   { opacity: .55; }
.svc-fc-line { fill: none; stroke: rgba(18, 51, 61, .16); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.svc-fc, .svc-fc-line { transform-box: fill-box; transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {   /* drift: a few px over 40–60s, never noticeable as motion */
  .svc-fc--a { animation: svc-drift-a 46s ease-in-out infinite alternate; }
  .svc-fc--b { animation: svc-drift-b 58s ease-in-out infinite alternate; }
  .svc-fc--c { animation: svc-drift-a 52s ease-in-out -20s infinite alternate-reverse; }
}
@keyframes svc-drift-a { to { transform: translate(10px, -6px) rotate(.6deg); } }
@keyframes svc-drift-b { to { transform: translate(-8px, 7px) rotate(-.5deg); } }

.svc-card {
  container-type: inline-size;
  position: relative;
  scroll-margin-top: 24px;            /* + html scroll-padding-top (header) → the card top stays visible */
  padding: clamp(20px, 3.6vw, 56px) clamp(18px, 3.6vw, 56px) clamp(22px, 3.6vw, 56px);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(18, 51, 61, .07);                 /* faint outer hairline */
  border-radius: var(--r-card);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .8),               /* light inner edge */
    0 22px 44px -34px rgba(18, 51, 61, .32);               /* one soft, low shadow */
  color: var(--fg-body);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .svc-cards { --glass: rgb(255 255 255 / .95); }
}
/* reduced transparency = VELLUM: no blur at all; a mostly-opaque sheet, the facets show faintly with crisp edges (tracing paper) */
@media (prefers-reduced-transparency: reduce) {
  .svc-cards { --glass: rgb(255 255 255 / .84); }
  .svc-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* top: name → catch → description */
.svc-card-head { display: grid; row-gap: 12px; }
.svc-card-name {
  font-family: var(--f-min);
  font-size: clamp(21px, 1.9vw, 28px);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .08em;
  color: var(--fg);
  word-break: auto-phrase;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.svc-card-tag {
  font-family: var(--f-min);
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.9;
  letter-spacing: .08em;
  color: var(--accent);
  word-break: auto-phrase;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.svc-card-desc {
  margin-top: 8px;
  max-width: 34em;
  font-size: var(--fs-body);
  line-height: 2.1;
  color: var(--fg-body);
  word-break: auto-phrase;
  line-break: strict;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
@container (max-width: 420px) {        /* phone: keep long names breaking at 「・」, not inside a word */
  .svc-card-name { font-size: 20px; letter-spacing: .04em; }
}
@media (max-width: 479px) {             /* phone: give the nested panels the width, not the frame */
  .svc-card { padding-inline: 14px; }
}
@container (min-width: 820px) {
  .svc-card-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(32px, 4cqi, 64px);
    row-gap: 10px;
  }
  .svc-card-name { grid-column: 1; grid-row: 1; }
  .svc-card-tag  { grid-column: 1; grid-row: 2; align-self: start; }
  .svc-card-desc { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}

/* bottom: problem (hazy, recessed) → support (clear sheet lying on top of it)
   Phone / narrow card: stacked; the support sheet overlaps the bottom of the problem panel, the arrow chip sits on the seam (↓).
   Wide card: side by side; the support sheet overlaps the problem panel's right edge and sits a little higher (→). */
.svc-flow {
  --ov: 14px;                          /* how far the clear sheet lies over the hazy panel */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: clamp(28px, 3.2vw, 48px);
}
.svc-panel {
  position: relative;
  min-width: 0;
  padding: clamp(18px, 2.4vw, 32px) clamp(16px, 2.4vw, 32px) clamp(20px, 2.6vw, 34px);
  border-radius: var(--r-inner);
}
.svc-panel--issue {                   /* the hazy side: cooler, recessed into the glass */
  padding-bottom: calc(clamp(20px, 2.6vw, 34px) + var(--ov) + 12px);
  background: rgb(206 228 233 / .5);
  border: 1px solid rgb(255 255 255 / .55);
  box-shadow: inset 0 1px 3px rgba(18, 51, 61, .08), inset 0 0 0 1px rgba(18, 51, 61, .03);
}
.svc-panel--support {                 /* the clear side: an opaque white sheet above the glass */
  z-index: 1;
  margin-top: calc(var(--ov) * -1);
  padding-top: calc(clamp(18px, 2.4vw, 32px) + 12px);
  background:
    linear-gradient(90deg, var(--blue), var(--teal) 55%, var(--green)) top left / 100% 3px no-repeat,
    var(--field);
  border: 1px solid rgba(18, 51, 61, .08);
  box-shadow: 0 1px 2px rgba(18, 51, 61, .06), 0 18px 34px -22px rgba(18, 51, 61, .3);
}
@container (min-width: 720px) {
  .svc-flow { --ov: 18px; grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr); align-items: stretch; }
  .svc-panel--issue { padding-bottom: clamp(20px, 2.6vw, 34px); padding-right: calc(clamp(16px, 2.4vw, 32px) + var(--ov) + 16px); }
  .svc-panel--support {
    margin: -12px 0 12px calc(var(--ov) * -1);
    padding-top: clamp(18px, 2.4vw, 32px);
    padding-left: calc(clamp(16px, 2.4vw, 32px) + 18px);
  }
}

.svc-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: .12em;
}
.svc-panel--issue .svc-panel-title { color: var(--fg-2); }
.svc-panel--support .svc-panel-title { color: var(--accent); }
.svc-panel-title::after {             /* short hairline after the heading: quiet, editorial */
  content: "";
  flex: 1 1 auto;
  max-width: 48px;
  height: 1px;
  background: currentColor;
  opacity: .5;
}

.svc-items {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: .04em;
}
.svc-items > li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  word-break: auto-phrase;            /* Chrome: break at phrase boundaries (JA) */
  line-break: strict;
  text-wrap: pretty;                  /* avoid a lone character on the last line */
  overflow-wrap: anywhere;
}
.svc-items > li + li { padding-top: 14px; border-top: 1px solid var(--line); }
.svc-panel--issue .svc-items > li + li { border-top-color: rgb(18 51 61 / .1); }
.svc-mark {
  width: 20px;
  height: 20px;
  margin-top: calc((1.9em - 20px) / 2);   /* centred on the first line box, whatever the font */
  overflow: visible;
}
.svc-panel--issue .svc-mark { color: var(--fg-2); }
.svc-panel--support .svc-mark { color: var(--accent); --svc-check-fg: var(--field); }

/* the arrow chip on the seam: ↓ when stacked, → side by side */
.svc-flow-arrow {
  position: relative;
  z-index: 2;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  translate: 0 calc(var(--ov) * -1);
  color: var(--accent);
}
.svc-flow-arrow svg {
  box-sizing: content-box;
  flex: none;
  max-width: none;                    /* style.css caps svg at 100% of a 0-wide column */
  width: 22px;
  height: 22px;
  padding: 10px;
  background: var(--accent);
  color: var(--field);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--field), 0 6px 14px -8px rgba(18, 51, 61, .4);
  transform: rotate(90deg);
  overflow: visible;
}
@container (min-width: 720px) {
  .svc-flow-arrow { height: auto; width: 0; translate: calc(var(--ov) * -1) -6px; }
  .svc-flow-arrow svg { transform: none; }
}

/* motion: the card itself fades in (data-reveal="fade", style.css). The arrow draws once, after it. */
.mo:not(.rm) .svc-card .svc-flow-arrow path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.mo:not(.rm) .svc-card.is-in .svc-flow-arrow path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .8s var(--ease) .55s;      /* shaft */
}
.mo:not(.rm) .svc-card.is-in .svc-flow-arrow path + path { transition-duration: .6s; transition-delay: 1.05s; }  /* head */

@container (max-width: 420px) {        /* phone: the width goes to the text, not to nested frames */
  .svc-panel { padding-inline: 14px; }
  .svc-items > li { column-gap: 10px; }
}

@media (prefers-reduced-transparency: reduce) {   /* vellum: the hazy side stays cooler and recessed, a little more opaque */
  .svc-panel--issue { background: rgb(206 228 233 / .62); }
}

@media (forced-colors: active) {
  .svc-card, .svc-panel { border-color: CanvasText; }
  .svc-panel--support .svc-mark { --svc-check-fg: Canvas; }
}
@media print {
  .svc-card { break-inside: avoid; box-shadow: none; }
}
