/* NinjaDojo base: fonts, tokens and element defaults shared by every page (see DESIGN.md) */

@font-face {
  font-family: "Shippori Mincho B1";
  src: url("../fonts/shippori-mincho-b1-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Shippori Mincho B1";
  src: url("../fonts/shippori-mincho-b1-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Shippori Mincho B1";
  src: url("../fonts/shippori-mincho-b1-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/zen-kaku-gothic-new-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/zen-kaku-gothic-new-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("../fonts/zen-kaku-gothic-new-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ground: #0e0f11;
  --ink: #ecebe6;
  --ink-dim: #9c9c98;
  --gold: #c8a24a;
  --gold-bright: #dcb862;
  --slate: #3a3c40;
  --rail: #16171b;
  --failure: #e5735f;

  --display: "Shippori Mincho B1", "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  --text: "Zen Kaku Gothic New", "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.125rem, 4vw, 3.5rem);
  --measure: 36rem;
  --screen-gap: clamp(5rem, 12vw, 10rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
  accent-color: var(--gold);
  scrollbar-color: var(--slate) var(--ground);
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  caret-color: var(--gold);
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--gold);
  color: var(--ground);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

ul,
ol,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--gold);
  color: var(--ground);
  font-weight: 700;
}
.skip-link:focus {
  top: 0.75rem;
}

/* The mark: 忍 before the dojo name */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}

.brand-mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
}

/* The share button as iPhones draw it, inline in the steps for adding the app to the home screen */

.share-glyph {
  display: inline-block;
  width: 0.75em;
  height: 0.95em;
  margin-left: 0.3em;
  vertical-align: -0.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The Share button: a text action with the share mark, opening in place to a row of ways to share (public pages and
   the member pages). Open, its summary dims to Faded Ink like any disclosure; the ways are Paper Ink with the gold
   underline, each touch-sized. No box: the row simply pushes the page down. */

.share {
  margin-top: 1.25rem;
}

.share-open {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  cursor: pointer;
  list-style: none;
}

.share-open::-webkit-details-marker {
  display: none;
}

.share-open:hover {
  text-decoration-thickness: 2px;
}

/* the mark drawn as heavy as the 500-weight words beside it */
.share-open .share-glyph {
  margin: 0 0.5em 0 0;
  stroke-width: 2;
}

.share[open] > .share-open {
  color: var(--ink-dim);
  text-decoration-color: var(--slate);
}

.share-ways {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.share-way {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.share-way:hover {
  text-decoration-thickness: 2px;
}

/* kept in the page while empty (it takes no room), so screen readers announce "Link copied." */
.share-said {
  color: var(--ink-dim);
  font-size: 0.9375rem;
}

/* A group's training times form (the admin's and the leader's group pages): Day, Starts and Ends side by side on
   every row, the column names above the first; each page gives the fields its own look */

.times-form {
  display: grid;
  gap: 0.625rem;
}

/* the day is a short name ("Tue"), so the times keep room for a 12-hour clock's AM and PM on a phone */
.times-head,
.times-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.times-head {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.times-row .input {
  padding-inline: 0.625rem;
  font-variant-numeric: tabular-nums;
}

.times-form > .hint,
.times-form .field .hint {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.times-form .field {
  margin-top: 0.75rem;
}

.times-form .optional {
  color: var(--ink-dim);
  font-weight: 400;
}

.times-form > div:last-child {
  margin-top: 0.5rem;
}

/* A group's QR code: dark on white whatever the ground, as phone cameras read best, with its download under it */

.qr {
  margin-top: 1.25rem;
}

.qr img {
  display: block;
  width: 11rem;
  height: auto;
}

.qr figcaption {
  margin-top: 0.5rem;
}

/* The maker's credit, the last line of every page: quieter than the dojo's own footer and never gold, since gold
   marks the page's actions. The link sits in a sentence, so a Slate underline tells it apart at rest; under the
   pointer it brightens to Paper Ink, like the footer's links. Each frame places the line (site, member, admin). */

.maker-credit {
  color: var(--ink-dim);
  font-size: 0.8125rem;
}

.maker-credit a {
  display: inline-block;
  padding: 0.5rem 0;
  text-decoration-color: var(--slate);
  text-underline-offset: 0.3em;
}
.maker-credit a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* where a frame has no footer of its own, the credit is it: a line in the frame's container and gutter */
.credit-footer {
  margin: 0 auto;
  padding: 0 var(--gutter) 1rem;
}

/* Text for screen readers only */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A person's photo, or their initials where they have none: a circle beside their name, on a Slate ring so a dark
   photo keeps its edge on the night ground. The initials are a monogram in Mincho, like the 忍 mark. */

.portrait {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--slate);
  border-radius: 50%;
  color: var(--ink-dim);
  font-family: var(--display);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portrait.large {
  width: 6rem;
  font-size: 2.125rem;
}

/* A page's header with the person's portrait beside their name and the lines under it */

.with-portrait {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.25rem;
}

/* Adding or changing a photo: the picker and its button on one line, the hint under both */

.photo-control .upload {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
}
.photo-control .hint {
  flex-basis: 100%;
  max-width: 36rem;
  color: var(--ink-dim);
  font-size: 0.875rem;
}
.photo-control input[aria-invalid="true"]::file-selector-button {
  border-color: var(--failure);
}
/* on a phone the button drops under the picker: the hint comes first, so it is read before uploading */
@media (max-width: 30rem) {
  .photo-control .hint {
    order: 1;
  }
  .photo-control .upload .button {
    order: 2;
  }
}
