/* Page foundation and shared layout primitives. */

:root {
  font: var(--font-body)/var(--leading-body) var(--font-family);
  color: var(--color-text);
  background: var(--color-page);
}

* {
  box-sizing: border-box;
}

[hidden], p:empty {
  display: none !important;
}

body, h1, h2, p {
  margin: 0;
}

main {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 20px 16px;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 12px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.identityText {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.identityText h1 { font-size: 20px; font-weight: 600; letter-spacing: -.35px; }
.identityText .subtitle { font-size: 12px; line-height: 1.4; }

.brandMark {
  display: block;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
}


h1 {
  font-size: var(--font-heading);
  line-height: 1.25;
  font-weight: var(--weight-normal);
  color: var(--color-heading);
}

.subtitle {
  font-size: var(--font-label);
  color: var(--color-muted);
}

#message {
  position: fixed;
  bottom: 24px;
  left: 32px;
  z-index: 8;
  max-width: min(480px,calc(100vw - 48px));
  box-shadow: var(--shadow-notice);
}

.workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 16px;
}

#calendar, #editor {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  overflow: hidden;
  background: var(--color-surface);
}

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

h2 {
  font-size: 18px;
  color: var(--color-heading);
  line-height: 1.3;
  margin-top: 2px;
}

textarea {
  resize: vertical;
}

.pair {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
}

fieldset {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}

@media(max-width:760px) {
  :root {
    --font-control: 16px;
    --date-width: 24px;
    --master-width: 32px;
    --hour-width: clamp(100px,28vw,120px);
  }
  main {
    padding: 0 0 env(safe-area-inset-bottom);
  }
  .topbar {
    min-height: 60px;
    padding: 8px 12px;
  }
  .identity { gap: 8px; }
  .brandMark { width: 32px; height: 32px; flex-basis: 32px; }
  .identityText h1 { font-size: clamp(14px,4vw,18px); }
  .identityText .subtitle { font-size: 11px; line-height: 1.35; }
  h1 {
    font-size: 19px;
  }
  .subtitle {
    font-size: var(--font-xs);
  }
  #calendar, #editor {
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }
  #message {
    left: 12px;
    bottom: 16px;
    max-width: calc(100vw - 24px);
  }
}

@media(prefers-reduced-motion:no-preference) {
  button, input, select, textarea {
    transition: background-color .12s, border-color .12s;
  }
}

@media(max-width:360px) {
  .identity { gap: 5px; }
  .brandMark { width: 28px; height: 28px; flex-basis: 28px; }
}
