/* Shared base for the app (index.html) and the login page: reset, type,
   buttons, form fields, the footer and utilities. Only rules both pages need
   live here; the app's own chrome (header, dialogs, toast, backup notices) is
   at the top of journal-base.css. Colours come from theme.css on the app and
   from login.css on the login page. */
:root {
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: .55;
}
a {
  color: inherit;
}
button,
a,
input,
textarea {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
}
[hidden] {
  display: none !important;
}

/* Type */
h1 {
  font-family: "Songti SC", STSong, serif;
  font-size: 49px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 0;
}
h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2.4px;
  color: var(--label-3);
  margin: 0 0 16px;
}

/* Layout */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Buttons */
.primary,
.secondary,
.danger {
  border: 1px solid transparent;
  padding: 10px 21px;
  border-radius: 7px;
  transition: background .15s;
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: var(--label-inverse);
}
.primary:hover {
  background: #274630;
}
.primary span {
  font-size: 19px;
}
.secondary {
  background: transparent;
  border-color: var(--separator);
  color: var(--label);
}
.secondary:hover {
  background: #ecefe7;
}
.danger {
  background: #a4483f;
  color: var(--label-inverse);
}

/* Form fields */
.field {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 17px;
}
.optional {
  color: var(--label-3);
  font-weight: 400;
  margin-left: 4px;
  font-size: 11px;
}
input[type=text],
input[type=date],
textarea {
  display: block;
  border: 1px solid var(--separator);
  background: var(--surface);
  color: var(--label);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
  width: 100%;
  font-size: 14px;
}
input[type=date] {
  width: 190px;
  min-height: 44px;
}
textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.8;
}
textarea::placeholder,
input::placeholder {
  color: var(--label-5);
}
input:focus,
textarea:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 0;
}

/* Messages */
.error {
  font-size: 13px;
  background: #fff0e9;
  border: 1px solid #ecd2c7;
  padding: 10px 13px;
  border-radius: 6px;
  color: #944438;
}

/* Footer */
footer {
  max-width: 840px;
  border-top: 1px solid var(--separator);
  margin: 50px auto 0;
  padding: 22px 0 28px;
  display: flex;
  justify-content: space-between;
  color: var(--label-3);
  font-size: 11px;
  letter-spacing: 1px;
}
footer span {
  font-size: 9px;
}
.site-footer {
  flex-wrap: wrap;
  gap: 6px 18px;
}
.beian-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.beian-link img {
  width: 18px;
  height: 20px;
  object-fit: contain;
}
footer .site-version {
  font-size: inherit;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}

/* Utilities */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Phones */
@media (max-width: 640px) {
  main {
    padding: 0 22px;
  }
  h1 {
    font-size: 40px;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 2px;
  }
  footer {
    margin: 35px 23px 0;
    font-size: 10px;
  }
  footer span {
    font-size: 8px;
  }
}

/* Phones: no pinch or double-tap zoom (see js/no-zoom.js), and the page
   never drags sideways; anything too wide is clipped instead. */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; overscroll-behavior-x: none; }

/* Less motion when the system asks for it */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
