/* ---------------------------------------------------------------------------
   Base

   There is no CSS framework anymore: this section owns the resets and element
   defaults the rest of the file builds on.
--------------------------------------------------------------------------- */

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

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--color-bg);
  color: var(--color-text);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--color-link);
}

ol, ul {
  padding-left: 1.5rem;
}

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

button {
  cursor: pointer;
}

svg {
  vertical-align: -0.125em;
}

/* ---------------------------------------------------------------------------
   Layout
--------------------------------------------------------------------------- */

/* The 0.75rem side padding is the same gutter the navbar uses, so the two
   line up on narrow screens */
.page-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 0.75rem 3rem;
}

.center {
  position: absolute;
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
}

/* ---------------------------------------------------------------------------
   Typography
--------------------------------------------------------------------------- */

.page-title {
  font-size: 2rem;
  margin: var(--space-3) 0 var(--space-2);
}

.section-heading {
  font-size: 1.375rem;
  margin: var(--space-3) 0 var(--space-1);
}

.text-paragraph {
  margin: var(--space-2) 0;
}

.section-separator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-2);
}

.section-separator h5 {
  font-size: 1.125rem;
  white-space: nowrap;
}

.section-separator hr {
  flex: 1;
  border: none;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .page-title {
    font-size: 1.5rem;
  }
}

/* ---------------------------------------------------------------------------
   Forms
--------------------------------------------------------------------------- */

.form-label {
  display: block;
  font-weight: 500;
  margin: var(--space-2) 0 0.25rem;
}

.form-field {
  margin-top: var(--space-1);
}

.padded-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.padded-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(28, 44, 59, 0.15);
}

.status-select {
  padding: 0.5rem 0.75rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* an input with a icon box glued to its left edge */
.icon-input {
  display: flex;
  flex: 1;
  min-width: 0;
}

.icon-input-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  background-color: var(--color-icon-box);
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
}

.icon-input .padded-input {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.icon-input-row {
  display: flex;
  gap: var(--space-1);
}

/* the date/time pair that opens the date picker */
.date-picker-row {
  cursor: pointer;
}

.date-picker-row .icon-input:first-child {
  flex: 2;
}

/* checkbox */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  cursor: pointer;
}

.custom-checkbox .checkmark {
  position: relative;

  /* the one size knob: everything below is a fraction of this */
  font-size: 1.2rem;
  width: 1em;
  height: 1em;
  flex: none;

  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.4em;

  /* Center the checkmark inside */
  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition: all 0.2s ease;
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.custom-checkbox .checkmark::after {
  content: "";
  display: none; /* hidden until checked */

  /* This creates the checkmark shape, sized as a fraction of the box so it
     stays proportional */
  width: 0.25em;
  height: 0.5em;
  border: solid white;
  border-width: 0 0.11em 0.11em 0;

  /* rotating leaves it optically low; nudge it back up */
  transform: translateY(-0.05em) rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark::after {
  display: block;
}

/* auto-growing textarea: an invisible div holds the text so the wrapper takes
   the height the text needs, and the textarea is stretched over it */
.autoexpand {
  position: relative;
  width: 100%;
}

.autoexpand textarea {
  position: absolute;
  inset: 0;
  height: 100%;
  resize: none;
}

.autoexpand textarea,
.autoexpand > div {
  line-height: 1.4;
  white-space: pre-wrap;
  min-height: 4.5rem;
}

.autoexpand > div {
  word-break: break-all;
  visibility: hidden;
}

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */

.button-wrapper {
  margin: var(--space-2) 0;
  text-align: center;
}

.submit-button {
  margin: 0 var(--space-1);
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  color: #fff;
  background-color: var(--color-primary);
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.submit-button:not([disabled]):hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.submit-button:disabled {
  background-color: var(--color-disabled);
  border-color: var(--color-disabled);
  cursor: default;
}

.submit-button.secondary {
  color: var(--color-primary);
  background-color: transparent;
}

.submit-button.secondary:not([disabled]):hover {
  color: #fff;
  background-color: var(--color-primary-hover);
}

/* ---------------------------------------------------------------------------
   Modal
--------------------------------------------------------------------------- */

.modal-background {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-window {
  background-color: var(--color-surface);
  padding: var(--space-3) var(--space-4) var(--space-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: min(90vw, 28rem);
}

/* ---------------------------------------------------------------------------
   Event page
--------------------------------------------------------------------------- */

.event-title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-1);
  margin: var(--space-3) 0;
}

.event-title {
  font-size: 2.25rem;
}

.edit-event-link {
  display: flex;
  align-items: center;
  padding: var(--space-1); /* click area */
  color: var(--color-primary);
}

.event-description {
  white-space: pre-wrap;
}

.event-info-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-2) var(--space-1);
  margin: var(--space-2) 0;
}

.event-info-row {
  display: flex;
  margin-top: var(--space-2);
}

.event-info-row > * {
  flex: 1;
}

.event-info-icon {
  margin: 0 var(--space-1);
}

.event-photo-wrapper {
  display: flex;
  justify-content: center;
  margin: var(--space-2) 0;
}

.event-photo {
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-height: 60vh;
  max-width: 100%;
  transition: transform 0.3s ease;
}

.event-photo-wrapper:hover .event-photo {
  transform: scale(1.03);
}

.rsvp-section {
  margin-top: var(--space-3);
}

@media (max-width: 768px) {
  .event-title {
    font-size: 1.625rem;
  }
}

/* ---------------------------------------------------------------------------
   Attendees
--------------------------------------------------------------------------- */

.attendees {
  margin-top: var(--space-4);
}

/* ---------------------------------------------------------------------------
   Comments
--------------------------------------------------------------------------- */

.comments-header {
  margin-top: var(--space-4);
}

.comment {
  display: flex;
  flex-direction: row;
  margin: var(--space-2) 0;
}

.comment-content {
  margin: var(--space-1);
}

.comment-bubble {
  box-shadow: var(--shadow-sm);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  max-width: fit-content;
  background-color: var(--color-bubble);
  word-wrap: break-word;
}

.comment-timestamp {
  color: var(--color-text-muted);
}

.profile-picture {
  clip-path: circle();
  object-fit: scale-down;
  max-width: 50px;
}
