/* fonts */

@font-face {
  font-family: "Helvetica Neue Roman";
  src: url("/fonts/HelveticaNeueLTStd-Roman.otf") format("opentype");
}
@font-face {
  font-family: "Helvetica Neue Medium";
  src: url("/fonts/HelveticaNeueLTStd-Md.otf") format("opentype");
}
@font-face {
  font-family: "Helvetica Neue Bold";
  src: url("/fonts/HelveticaNeueLTStd-Bd.otf") format("opentype");
}

h1 {
  font-family: "Helvetica Neue Medium", sans-serif;
  font-size: 32px;
  font-weight: 400;
}

h2 {
  font-family: "Helvetica Neue Medium", sans-serif;
  font-size: 24px;
  font-weight: 400;
}

body, textarea, input {
  font-family: 'Helvetica Neue Roman', Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 400;
}

.meta, .author__text-input {
  font-family: 'Helvetica Neue Bold', Helvetica, sans-serif;
  font-size: 32px;
}

/* resets */

body,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
p {
  margin: 0;
}

h1, h2 {
  line-height: 1;
}

ul {
  list-style: none;
  padding-inline-start: 0;
}

a {
  text-decoration: none;
  color: grey;
}

button {
  border: none;
  background-color: transparent;
  text-transform: uppercase;
  font-size: 18px;
  font-weight: bold;
  color: grey;
  cursor: pointer;
}

/* styles */

main {
  @media (min-width: 720px) {
    max-width: 480px;
  }
}

header {
  padding: 18px 20px 18px;
}

.header-upper {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 4px;
}

section {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
  margin-bottom: 24px;
}

section:has([js-button-edit]) form {
  display: none;
}

section:has([js-button-edit]) form[data-form-state="edit"] {
  --content-opacity: 1;
  --icon-opacity: 0;
  display: block;
}

section:has([js-button-edit])
  form[data-form-state="edit"]
  ~ article:has([js-button-edit]) {
  display: none;
}

article {
  --gutters: 24px;
  display: flex;
  position: relative;
  flex-direction: column;
  justify-content: space-between;
  margin: 8px 20px;
}

article:before {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0px 2px 2px grey, inset 2px 0px 2px lightgrey,
    inset -2px 0px 2px lightgrey;
  pointer-events: none;
}

article:has([js-button-edit]) {
  order: -1;
}

.content {
  position: relative;
  background-color: var(--color-background, #b3f473);
  color: var(--color-text, #000000);
  padding: 24px var(--gutters);
  min-height: 300px;
  font-size: 20px;
}

.meta {
  display: flex;
  flex-direction: column;
  padding: 16px var(--gutters) 28px;
  text-transform: uppercase;
}

.meta__footer {
  display: flex;
  justify-content: space-between;
}

.author {
  display: inline-flex;
  column-gap: 2px;
  width: 100%;
}

.author__text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.author__restricted-icon {
  margin-top: 2px;
  font-size: 0.6em;
}

.button--edit,
.submit {
  align-self: flex-end;
}

/* forms */

form {
  --content-opacity: 0;
  --icon-opacity: 1;
}

form .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.7;
}

form svg {
  width: 200px;
  height: 200px;
  opacity: var(--icon-opacity);
  transition: opacity 200ms ease-in-out;
}

form textarea,
form input,
form label,
form button {
  opacity: var(--content-opacity);
  transition: opacity 200ms ease-in-out;
}

form:focus-within {
  --content-opacity: 1;
  --icon-opacity: 0;
}

form[data-form-state="edit"] {
  --content-opacity: 1;
  --icon-opacity: 0;
}

.content__textarea {
  display: inline-block;
  width: 100%;
  height: 100%;
  background-color: transparent;
  color: var(--color-text, #000000);
  border: none;
  outline: none;
  box-shadow: none;
  margin-block: 0px;
  padding: 0px;
  font-size: 20px;
  resize: none;
}

.author-input {
  display: flex;
  justify-content: flex-start;
  column-gap: 2px;
  width: 100%;
}

.author__text-input {
  width: 100%;
  border: none;
  outline: none;
  margin-block: 0px;
  padding: 0px;
  text-transform: uppercase;
}

.colour-input-wrapper {
  position: relative;
}

.color-input {
  position: absolute;
  width: 100%;
  border: none;
  background-color: transparent;
  cursor: pointer;
  opacity: 0;
}
